-
Notifications
You must be signed in to change notification settings - Fork 451
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
Optional serde support for SpanContext
#1075
Conversation
Codecov ReportPatch coverage has no change and project coverage change:
Additional details and impacted files@@ Coverage Diff @@
## main #1075 +/- ##
=======================================
- Coverage 50.9% 50.8% -0.1%
=======================================
Files 165 165
Lines 19689 19697 +8
=======================================
Hits 10025 10025
- Misses 9664 9672 +8
☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense and having behind a feature flag is good 👍🏼
I think this seems a little against the spirit of the propagator spec as this would suggest a simple way to bypass that API, but I don't feel strongly enough to block if others find this useful. @TommyCpp thoughts? |
Since we've had a few people speak up in favor of this in #576, it feels like we should accept it. @jtescher what are the risks/issues with bypassing the propagator? |
I agree this seems odd to implement on |
@shaun-cox what do you think about |
@djc, @wperron, @jtescher thanks for the feedback and questions and patience as I attempt to learn and contribute here. My use case is in in the context of a library that I'm wanting to instrument. This library communicates with other instances of itself over the network using a binary protocol. That binary protocol is already relying on My first thought was that I should limit myself to I looked at I thought I was on the right track with this PR approach, after noticing that I also noticed that To be clear, I want to help push Thanks! |
Is the BinaryFormat in contrib what you're looking for? |
I've also since understood that binary format propagators have been removed from the spec, and there is an issue #437 to address adding them back at some point. I think I understand the need for "open" binary protocols to propagate context, but I hope the community sees the interim need for context to be opaquely propagated inside "closed" binary protocols in the meantime, which is how I view my use case.
Oh, thanks! I'll check it out... |
My issue here is that this is possible to do using the Propagator traits already. It's not clear to me how I'm not necessarily opposed to this change, I would just like to see a better use-case defined; Why do the existing traits not work for you? What are the possible drawbacks or footguns that come with this change? |
Do we know why the spec mandates this? Leaving out useful features for spec compliance seems like a bad pattern. (And having a canonical way to do something doesn't maybe quite mandate that it's the only way?) |
It's also worth pointing out that Binary Propagators are coming at some point to the specification, which will solve the Maybe the best course of action would be an experimental |
I'm really not sure. I'm just an interested party here, might be worth asking in the otel-specification channel in the CNCF Slack. Again though I'm not opposed to having Or, put differently, the |
@wperron wrote:
Yeah, jtescher pointed out above that it's there at All it does is serialize the I am also interpreting the following, from CONTRIBUTING.md
|
I think it's fine to introduce the |
I also updated the PR to not actually serialize the |
Something worth noting is that span context serialization is standardized through the propagation apis so that environments with multiple language implementations are more likely to properly propagate the context correctly. In that sense users should be discouraged from implementing their own serialization formats unless there is a compelling reason to do so (e.g. noticing that span context implements As we get closer to 1.0 for the trace signal we should be clear about what API guarantees we want to make, and how lower context readers will interpret and use the interfaces we expose. |
That is a good point it would certainly hinder the library as pushing internals out as a public interface could cause pain in the future. |
We chatted briefly about this in the Rust SIG meeting today. I'm happy to close this and go think more on how to use binary propagators in my own protocol. We decided to leave the PR open in the meantime for more discussion/context. |
While binary propagator contrib stuff wasn't applicable to my use case, I was able to work around with my own struct which is convertible from |
Fixes #1074
Changes
Follow Rust API Guidelines in regards to
SpanContext
data structure implementing Serde's Serialize and Deserialize traits, optionally based on "serde" feature flag.Merge requirement checklist
CHANGELOG.md
files updated for non-trivial, user-facing changes