-
Notifications
You must be signed in to change notification settings - Fork 11
Description
Is your feature request related to a problem? Please describe.
Honeycomb can't easily interoperate with OpenTelemetry systems that perform sampling. Specifically, in a multi-service OTel-first system, there's no convenient method or place to adapt OTel p-values into sampleRate attributes.
Describe the solution you'd like
Update api.honeycomb.io's OTLP/gRPC ingest to behave like so: For each span during TranslateTraceRequest,
- Deserialize a span's trace state, sourced from Span.GetTraceState. See details on OpenTelemetry's use of trace state here: https://github.com/open-telemetry/opentelemetry-specification/blob/v1.11.0/specification/trace/tracestate-handling.md
- If trace state defines a p-value in the interval [0, 62], set the Honeycomb event's
SampleRateto2 ** p. The OTel spec refers to this quantity as "adjusted count". - If trace state defines a p-value equal to 63, drop the event.
- Otherwise, use the existing
getSampleRatelogic that consults span attributes.
Note: I'm unsure of the correctness of step (3). Am seeking clarification with the OTel Sampling SIG now: https://cloud-native.slack.com/archives/C027DS6GZD3/p1652294663462109
Describe alternatives you've considered
A processor in the OpenTelemetry Collector that copies/adapts p values into a sampleRate span attribute might be feasible, but no one's open-sourced such a processor yet.
Additional context
- Honeycomb's OTLP ingest supports span attributes
sampleRateandSampleRateas a means of conveying "this is how much to re-weight this span by when doing aggregate calculations". (src) - Since OpenTelemetry spec v1.9.0 there's been an (experimental) OTel-native way to convey this information: a "p-value" in a span's TraceState.