Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDk/Sampler concepts leaked in API #1043

Open
cijothomas opened this issue Apr 25, 2023 · 7 comments
Open

SDk/Sampler concepts leaked in API #1043

cijothomas opened this issue Apr 25, 2023 · 7 comments
Assignees
Labels
A-trace Area: issues related to tracing release:required-for-stable Must be resolved before GA release, or nice to have before GA.

Comments

@cijothomas
Copy link
Member

cijothomas commented Apr 25, 2023

https://github.com/open-telemetry/opentelemetry-rust/blob/main/opentelemetry/src/trace/tracer.rs#L277
SamplingResult is the type returned by Samplers, and it is a pure SDK concept.
If this was unintentional, we should remove it before 1.0 stable release.

Similar: #1042

@cijothomas
Copy link
Member Author

I think the only "Sampling" related concepts that should be part of Tracing API are:

  1. spanContext TraceFlags for SAMPLED.
  2. span.IsRecording

Based on the comment (https://github.com/open-telemetry/opentelemetry-rust/blob/main/opentelemetry-sdk/src/trace/tracer.rs#L174-L176), I think this is done to accommodate tracing-opentelemetry crate. Related discussion around that crate : #1032

@TommyCpp TommyCpp added A-trace Area: issues related to tracing release:required-for-stable Must be resolved before GA release, or nice to have before GA. labels May 1, 2023
@cijothomas cijothomas added this to the Tracing API And SDK Stable milestone Oct 17, 2023
@cijothomas
Copy link
Member Author

@hdost Moving back to Tracing API stable, as the fix for this (if we chose to), would be in the API itself!

@cijothomas
Copy link
Member Author

@open-telemetry/rust-approvers
The natural fix for this would be to simply remove this from the API. But that'd probably (or surely?) break tracing-opentelemetry, unless tracing-opentelemetry can depend on the SDK (it does seem to depend on SDK today...)... But even then, there is no such support in OTel spec to support externally sampled spans..

Given the popularity of tracing crate for both logging and distributed tracing in Rust ecosystem, I think we should keep this, but make this a well-documented decision by OTel Rust maintainers/approvers. At minimum, we need to document this as a conscious decision (and not an accidental leak/bug), and document we commit to keep support tracing-opentelemetry by specially treating the crate.

Please share your thoughts on how best to proceed.

My proposal:

  1. Document this in the same place Document spec deviations with rationale #1297 prefers (that is undecided as of now)
  2. Call this out in this repo's main readme file itself. I can work on some wordings once I get an okay for this direction.

@lalitb
Copy link
Member

lalitb commented Oct 24, 2023

  • 1 on keeping it. We can also document it as doc comments for SamplingResult and SamplingDecision.

@djc
Copy link
Contributor

djc commented Oct 24, 2023

@jtescher any thoughts on changing tracing-opentelemetry to accomodate this?

@cijothomas
Copy link
Member Author

From SIG meeting:
Yes, we want to support tracing specially
Hide from docs, so people won't accidentally see/use it.

@cijothomas cijothomas self-assigned this Oct 24, 2023
@jtescher
Copy link
Member

jtescher commented Oct 24, 2023

@jtescher any thoughts on changing tracing-opentelemetry to accomodate this?

We could look at updating tracing-opentelemetry, the main reason it needs these types currently is so that it can do sampling ahead of time as it creates spans on end and needs to consistently apply the same sampling to sub spans. It could potentially avoid this via a mechanism to specify the parent trace id at span start and disallowing assigning the parent after that point.

More context for the current implementation is here https://github.com/tokio-rs/tracing-opentelemetry/blob/v0.1.x/src/tracer.rs#L14-L27

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-trace Area: issues related to tracing release:required-for-stable Must be resolved before GA release, or nice to have before GA.
Projects
None yet
Development

No branches or pull requests

6 participants