-
Notifications
You must be signed in to change notification settings - Fork 132
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
Remove Span.get_trace_attribute #47
Conversation
@@ -180,7 +180,8 @@ The client and server examples above propagated the Span/Trace over the wire, in | |||
span.set_trace_attribute('auth-token', '.....') | |||
|
|||
# server side (one or more levels down from the client) | |||
token = span.get_trace_attribute('auth-token') | |||
h_ctx, h_attr = tracer.propagate_span_as_text(span) | |||
token = h_attr.get_trace_attribute('auth-token') |
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.
this does not remove Heisenberg effect, since the end app still can get the attribute, it just makes the API harder to use.
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.
Also, this won’t work given current semantics, because the OT tracer has no obligation to return the key/value map with any specific keys. For example, it can merge all trace attributes into a single base64 string and return a single key in the map. Or, more likely, it can prepend a certain prefix to all attribute keys so that the map keys are not mixed up with any other random HTTP headers, as well as to allow the tracer on the receiving side to read only the headers that represent trace attributes.
For reference sake Heisenberg Tracing refers to: When tracing goes from only instrumentation to having additional features (that the application becomes dependant on) then; The act of observation/instrumentation itself changes what is observed. Now there's no such thing as pure observation-only code. Even logging interferes (synchronous logging with disk IO and latency, asynchronous with memory). And there's an argument that because the DCP mechanism is happening behind the scenes that we're already on that slippery slope and might as well slide down it. By removing span.get_trace_attribute we're letting Span remain more of a clean instrumentational API. The functionality is still there but moved into a more flexible, and more DCP, part of the API. Against the current SpanPropagator API the functionality might get lost, but will definitely remain with #45 in place. |
- simply initial api (just one way of doing things) - avoid Heisenberg tracing References: - opentracing/opentracing-java#7 (comment) - #47
5223140
to
d53afbf
Compare
@michaelsembwever please see my second comment above, #47 (comment). We cannot rely on the name in the kv-map encoding to retrieve the attribute by the name end-user knows. |
@yurishkuro let's continue this once #45 is sorted. I believe there is ample ways of doing it, but it'll be more clear afterwards. A quick example is one can use the vanilla map extractor
But more to he point, I think we'll see clearer ways of doing even that once the Injector/Extractor discussion evolves. |
agree, let's wait, but fwiw, with our tracer implementing OT the only way it would work is
because the tracer prepends Also, as a side note, the distributed context propagation was widely viewed as a positive feature by people at Zipkin workshop, I don't recall anyone objecting to it. In implementations like grpc, the gRPC examples:
|
I think span is the wrong place to add general purpose propagated attributes. I'll repeat a comment I've made many times, especially as DCP came up for the third time at our third workshop. The workshop discussed a decoupled context (tag set), baggage, an independent api. It does not require routing through a tracer api to get to baggage. Ex. my scheduler, or metrics api does not need to hold a reference to the tracer api to get the same context. This is what is generally sought out (and in fact implemented in tons of frameworks!) It is very important to understand a vote for distributed context propagation is not necessarily a vote for Span/Tracer.setAttribute(arbitrary baggage). The fact that DCP is stuffed inside the Tracer api is the polarizing topic, not the act of propagating tags. The day we finally decouple this, is the day we can stop losing time in cyclic discussion. |
@adriancole I agree, I think it's conceptually much better -- however, in a practical sense I'm not sure exactly how to place DCP in context with OT interface. I thought that perhaps OT could extend a DCP API with a TraceContext object, so I prototyped it over the weekend. Unfortunately, my results ended up being less satisfactory than I hoped. I discovered this in the process of converting all the use-cases.md examples (and also thinking about what examples are not covered there). In the spirit of showing reasoning behind things as you mentioned on Monday--and also hoping for a better solution from someone else--here's the PR in case anyone is interested: dkuebric#1 |
@adriancole I hear you (in fact, I will point out that my initial forays here separated the DCP stuff as part of TraceContext)... the question in my mind is how to "make the simple things simple" while still supporting the cleanest DCP-friendly API we can muster. I guess I would encourage anyone and everyone to try and solve this via a diff to the core use-cases (like @dkuebric did). In my experience it was (too) challenging to both cleanly separate DCP and keep vanilla span creation and propagation "concept-lean". |
PS: this is an excellent thing to discuss at our inaugural hangout in a few hours! |
Would love to join, but my flight plans seem to be clash quite consistency
with these catchups :( just wanted to send some thoughts before I became
AWOL in transit.. And on that note boarding
|
@adriancole safe flight! Here's the notes from @bensigelman on the hangout: #44 (comment) For the relevant part, discussion on Attributes: they are important enough that OT wants them, but context isolation not important enough for OT to make extra work for instrumentation that would be required by a clean separation of context and span. (I would have been happy for a clean API that both separates the two and also does not require extra work in propagating multiple objects. Unfortunately I was not able to produce one and in the process of trying to do so convinced myself it is quite a challenge.) It will still be quite easy to implement a context-only tracer, which uses the same instrumentation (for context propagation purposes only) and no-ops Spans. The semantic issue faced is that Span will be the interface to the Attribute data, which isn't a very obvious API as you point out above. |
I think we have reached the agreement on the video call to keep read/write methods for trace attributes. Suggest to close this in 48hrs. |
Sorry to bring this up late but… Why not have just the Since the |
I am not sure what you mean, tags and attributes are different sets of data. We do not expose read function for tags in the API, they are write-only, reported to storage out of band, and tracers are not required to guarantee that all tags will even be preserved. |
That is, has the decision been made that the two sets are kept separate. That is can trace attributes be exposed via tags. This would make sense because these are the things are reported to storage. But it wouldn't make sense because of the different value types permitted. My questioning was as much to ask for the reference to the discussion/rationale to any decision made on this front. " We do not …" doesn't cut it. |
I don't have specific pointers to discussions, as this topic was touched upon in various other related discussions. I can try to summarize:
|
thanks. |
+1 on Yuri's summary. I will concede that "trace attributes" never really rolled of the tongue (and still doesn't). I had a nice VC with Rodrigo Fonseca and Jonathan Mace (author of the excellent PivotTracing paper among other things) and I started to like the term "baggage" since real-life baggage is something you "carry with you", much as these key:value pairs are carried with the trace. So I am open to something like SetBaggage/GetBaggage; it's a non-standard name, but it's also a non-standard idea and would maybe help to get users to actual RTFComments (a particularly good thing in this case). I would like to keep them totally disjoint from "span tags", though, especially since they are "beta" compared with the rest of the OT API. |
I am not opposed to "baggage". |
I like "baggage" as well. "Trace attribute" is probably one of the more confusing terminology issues right now. This would make it better differentiated from tags. |
Remove Span.get_trace_attribute
References: