You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(custom_)sampling_context is a Sentry-specific concept that doesn't fit with how OTel works.
The purpose of a sampling_context is to provide extra external data to use for decision making in the traces_sampler. Right now, we're using it to make things like the transaction name, parent sampled decision, request object or queue name accessible in the sampler.
The goal is to store everything necessary on the span as attributes instead and expose those. However, since attribute types are very limited, we can't just save a custom object like e.g. the request as an attribute. Instead, we need to preprocess it into serializable attributes. For each integration, we need to see what important data we can extract and save on the span.
The idea:
no custom_sampling_context argument for start_transaction/start_span anymore
start_span instead gets an extra attributes argument which, when provided, prepopulates the attributes
integrations that were providing a custom_sampling_context will instead provide a set of prepopulated attributes (that can't be objects)
the sampling_context accessible in traces_sampler will change:
it'll contain all span attributes by default
it'll also contain the current data (transaction_context.name, transaction_context.op, parent_sampled) in some slightly modified form
Integrations that are currently setting a custom_sampling_context that will now have to set specific attributes:
see if there's any framework-specific stuff in e.g. the asgi scope (starlette/fastapi adds endpoint, for instance), and add if possible
seen in the wild: wsgi_environ.REQUEST_URI, wsgi_environ.HTTP_ headers stuff
consider serializing args and kwargs (mostly celery, rq) always in the same way (i.e., not via _serialize_span_attributes) so that the type doesn't randomly change on users
error handling (except: or capture_internal_exceptions)
- Add support for the sampled flag for start_span and respect it when making sampling decisions.
- Rework sampling_context in traces_sampler to work with span attributes instead. Make sure we still have the same data accessible as now.
We could go one step further and change the format of sampling_context to just be the actual span attributes without any postprocessing into the current format. I kept the format in line with what we have now to make it easier to update.
See #3746Closes#3739
This is a breaking change since we're removing custom_sampling_context. It'll break multiple integrations until we fix them (see #3746).
(custom_)sampling_context
is a Sentry-specific concept that doesn't fit with how OTel works.The purpose of a
sampling_context
is to provide extra external data to use for decision making in thetraces_sampler
. Right now, we're using it to make things like the transaction name, parent sampled decision, request object or queue name accessible in the sampler.The goal is to store everything necessary on the span as attributes instead and expose those. However, since attribute types are very limited, we can't just save a custom object like e.g. the request as an attribute. Instead, we need to preprocess it into serializable attributes. For each integration, we need to see what important data we can extract and save on the span.
The idea:
custom_sampling_context
argument forstart_transaction
/start_span
anymorestart_span
instead gets an extraattributes
argument which, when provided, prepopulates the attributescustom_sampling_context
will instead provide a set of prepopulatedattributes
(that can't be objects)sampling_context
accessible intraces_sampler
will change:transaction_context.name
,transaction_context.op
,parent_sampled
) in some slightly modified formIntegrations that are currently setting a
custom_sampling_context
that will now have to set specific attributes:endpoint
, for instance), and add if possiblewsgi_environ.REQUEST_URI
,wsgi_environ.HTTP_
headers stuff_serialize_span_attributes
) so that the type doesn't randomly change on usersexcept:
orcapture_internal_exceptions
)Related:
POTelSpan
Remove custom_sampling_context #3747The text was updated successfully, but these errors were encountered: