-
Notifications
You must be signed in to change notification settings - Fork 976
Sampling based on URL #1597
Copy link
Copy link
Closed
Labels
area:samplingRelated to trace samplingRelated to trace samplingarea:semantic-conventionsRelated to semantic conventionsRelated to semantic conventionsspec:traceRelated to the specification/trace directoryRelated to the specification/trace directory
Metadata
Metadata
Assignees
Labels
area:samplingRelated to trace samplingRelated to trace samplingarea:semantic-conventionsRelated to semantic conventionsRelated to semantic conventionsspec:traceRelated to the specification/trace directoryRelated to the specification/trace directory
What are you trying to achieve?
The Hypertrace agents collect all request and response data (headers and payloads). This data is not needed for every request, hence I would like to implement a sampler that would make a decision based on the URL/endpoint pattern when this data should be collected (e.g. one in 100 requests). The decision should be propagated to downstream services (e.g. via tracestate) to make the decision coherent across the transaction.
The custom sampler would make a decision whether to collect payload and headers, the span sampling would still go through the normal sampling process (e.g. my custom sampler would delegate to it).
To fully implement this use-case these parts are needed:
tracestate(supported by the API) or drop the header and payload attributes inSpanProcessor#onEnd(not supported by the API).What is missing in the spec to solve my use-case
The sampler does not have access to the URL. The sampler interface (at least in Java) accepts attributes, however the instrumentation (e.g. servlet in otel-java-instrumentation) is not passing URL attribute there nor spec mandates it to do it.