Tail sampling depending on sampled bit set
Closed this issue · 2 comments
Hi!
To be able to implement tail sampling depending on sampled bit set (in OTEL format) it's required to extract such flag from the traceparent. However, for some reason it is ignored during decoding:
https://github.com/fastracelabs/fastrace/blob/aa7463e432e0781e0ec3d8bc9a2a2af1a52a7928/fastrace/src/collector/mod.rs#L211
... and is not propagated further.
Is there a reason for such behavior?
I am asking, because it is possible to manually set the "sampled" flag while encoding:
https://github.com/fastracelabs/fastrace/blob/aa7463e432e0781e0ec3d8bc9a2a2af1a52a7928/fastrace/src/collector/mod.rs#L256
Thank you for raising this point. The decision to not propagate the "sampled" flag during decoding was initially driven by our confidence in fastrace's performance. However, given that we've committed to supporting the w3c standard, it would indeed be prudent to align with it fully. Accommodating the standard in this case seems like the right direction.
Initial thoughts:
- sampled bit should be passed through SpanContext just like TraceId
- fastrace will not regard the sampled bit, user should manually cancel the root span before drop. (is auto cancelling a good idea?)
Edit: fastrace will regard the sampled bit