-
Notifications
You must be signed in to change notification settings - Fork 894
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
Merge SpanContext into Span #1033
Conversation
…n and propagating using Context.
A few points came up at the maintainers meeting which I'll comment on here proactively
At least in Java, the only logs injection techniques we know of, logging context in log4j and MDC in logback / slf4j, only accept Strings. While other techniques like custom message rendering, or other libraries, may support objects, we expect these to continue to be String as the lowest common denominator.
We don't currently have a concrete idea here - removing |
1ad915a
to
8315375
Compare
8315375
to
c350104
Compare
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.
Although I still support the idea of demoting/removing SpanContext as a separate entity/object, reading this PR made me wonder... Maybe we still need SpanContext as an aggregate of span identification. Just to be a convenient handle
specification/trace/api.md
Outdated
@@ -371,8 +367,8 @@ When a new `Span` is created from a `Context`, the `Context` may contain a `Span | |||
representing the currently active instance, and will be used as parent. | |||
If there is no `Span` in the `Context`, the newly created `Span` will be a root span. | |||
|
|||
A `SpanContext` cannot be set as active in a `Context` directly, but through the use | |||
of a [Propagated Span](#propagated-span-creation) wrapping it. | |||
A remote span's [span identifiers](#span-identifiers) can be set as active in a `Context`, |
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 feels especially clumsy. How can span identifiers be set anywhere?
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.
I think there is some clumsiness inherited from the previous wording too, one confusion I had is that since we make spans active, it's a bit mysterious to also have spancontexts that are active.
What do you think of just "A remote span can be set as active in a Context
"?
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.
I actually think we can remove this sentence now without replacement.
Co-authored-by: Nikita Salnikov-Tarnovski <gnikem@gmail.com>
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.
I would actually like that proposal, I am not sure how practical it is though yet. And a class like SpanContext may be useful at least in the implementation.
specification/trace/api.md
Outdated
non-zero TraceID and a non-zero SpanID, MUST be provided. | ||
|
||
### IsRemote | ||
|
||
An API called `IsRemote`, that returns a boolean value, which is `true` if the SpanContext was | ||
An API called `IsRemote`, that returns a boolean value, which is `true` if the Span was | ||
propagated from a remote parent, MUST be provided. |
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.
A span cannot be propagated from a remote parent unless it's a "Propagated span". We should clarify this. E.g. "A remote span is never recording", otherwise we re-open the discussion at #359.
specification/trace/api.md
Outdated
@@ -385,7 +381,7 @@ description](../overview.md#links-between-spans). | |||
|
|||
A `Link` is defined by the following properties: | |||
|
|||
- (Required) `SpanContext` of the `Span` to link to. | |||
- (Required) the `Span` to link to or its [span identifiers](#span-identifiers). |
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 changes the meaning. SpanContext also contains TraceState (which might be considered part of the identifier for proprietary systems) and TraceFlags (which are definitely not part of the identifier).
specification/trace/api.md
Outdated
@@ -166,14 +165,12 @@ The `Tracer` MAY provide functions to: | |||
|
|||
These functions MUST delegate to the `Tracing Context Utilities`. | |||
|
|||
## SpanContext | |||
## Span Identifiers |
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.
I wouldn't call the TraceId part of the identity.
specification/trace/api.md
Outdated
These parts of the span serve to identify it, both in-process and remotely. They are immutable | ||
pieces of the `Span`, as opposed to the data collecting [span operations](#span-operations). | ||
These identifiers conform to the [W3C TraceContext specification](https://www.w3.org/TR/trace-context/). | ||
It contains two identifiers - a `TraceId` and a `SpanId` - along with a set of common |
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 is confusing -- it says that identifiers contains identifiers (and more stuff). So now we have two different definitions for "identifiers".
specification/trace/api.md
Outdated
The OpenTelemetry `SpanContext` representation conforms to the [W3C TraceContext | ||
specification](https://www.w3.org/TR/trace-context/). It contains two | ||
identifiers - a `TraceId` and a `SpanId` - along with a set of common | ||
These parts of the span serve to identify it, both in-process and remotely. They are immutable |
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.
They do more than just identify it. This information is what is required to connect a parent span to a child span. For just identifying trace+span ID are usually enough (though some vendors might require a part of the tracestate).
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.
I took advantage of this line in the previous spec referring to SpanContext
as an identifier
"An immutable SpanContext that uniquely identifies the Span"
But I agree the name isn't so great, just couldn't come up with a better one. It may be a reason to keep SpanContext
as a concept indeed though ideally not implementation requirement as in #999.
I'll hold off on significant edits to this one until getting some more ideas on which to go with.
…y-specification into remove-spancontext
Log4j 2 has this capability already https://logging.apache.org/log4j/2.x/log4j-api/apidocs/org/apache/logging/log4j/util/StringMap.html
You can check open-census views + exemplar for that |
Thanks, we only use a version of the contextdataprovider that returns a As a general point, the key one is in #1033 (comment) where we may find a need to bring There are definitely naming issues, like whether "Span Identifiers" makes sense for this that I need help with 😅 If there's general interest in removing the extra type, hope to tweak the naming / explanations. |
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.
I am +1 on the overall idea. I think we can remove this concept for the moment.
…ification into remove-spancontext
I have removed the concept of "span identifiers" completely, it seems ok to reorder and inline definition of the traceid, tracestate, etc. @Oberon00 What do you think? |
context for the newly created `Span`. This means that a `SpanContext` that has been provided by a configured `Propagator` | ||
will be propagated through to any child span, but that no new `SpanContext`s will be created. | ||
* No valid `SpanContext` is specified as the parent of the new `Span`: The API MUST create an non-valid | ||
* A valid `Span` is specified as the parent of the new `Span`: The API MUST treat this parent context as the |
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.
Related #1023
Co-authored-by: Christian Neumüller <christian+github@neumueller.me>
…y-specification into remove-spancontext
Prototype PR in Python: open-telemetry/opentelemetry-python#1191 Bringing (some of) the comments I left there:
In general, because of the fact that this doesn't really improve the Python API, and because of feedback I heard regarding the fact we have been rushed things lately, my opinion is a NO regarding going forward with this (and thus keep the original decision of having it as "After-GA"), given a) the apparent lack of interest/need of other people picking up these in other languages and b) the fact we considered this in the past and decided not to go with it at the time. |
I think the simplification coming from the reduction of concepts that aren't really providing functionality is being understated. It seems like for a user, having less concepts to understand allows the API to be a more user-friendly one. The feedback I've gotten on the Java side has been quite positive. If a spec change can cause different reactions per language, maybe it's related to the idioms of the languages. In that case, it seems overspec'd and #1022 could be a middle-ground to allow languages to decide the API they want to present.
Things have changed hugely -
We can add APIs after GA but can't remove them, so there isn't any "After-GA" decision possible here. One of the main reasons for discussing this now is because we can add But I do understand the concern about it being too close to release - so I thought #1022 with optionally merging the APIS could be more practical, but there seemed to be more interest in this version that isn't optional. |
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.
I think removing this unnecessary concept is a really nice win for new users, simplifying their mental model, and eliminating confusion between the similarly named "SpanContext" and "Context".
As @anuraaga mentions, we can't remove things after GA, so we either do it now or never.
However,
This point has been applied to many items in the past. Rushing a new change when we are about to go GA is not something I'd like to have. As I said, there's no interest, and it's only helpful, so far, in the Java world. This is a mistake we commit a few times back in Open Tracing (rushing features because it helped a specific case/language), and I really don't think this is worth the risk.
As I said, I think the notion of |
Only OpenCensus had both
The similar PR optionally removing it has an approval from a TC member and there have been lots of folks suggesting this seems like a good idea - that doesn't seem like at least some interest.
I understand the worry about the timing, hence the simpler #1022 option. But if there is a language that is being unable to present a simplified API to users because of the spec, then it seems like a case of over spec. We're not adding a feature here, we're reducing the scope of the spec, something that can only happen now. @jmacd Do you have any suggestion on how to proceed? |
@yurishkuro Let me go ahead and copy in your comment here where the brunt of the discussion is happening.
I feel as if we've already jumped the fence with regards to "Pretending that a Span is what's being propagated over the wire" - all of our propagators are provided a span inside a context. The span's only readable field is the SpanContext, but I guess logically there's no real difference between this and the span's only readable fields being its trace ID, etc. I definitely agree with your choice. @jmacd has also talked about this. But if even removing |
This was discussed at the TC meeting today. The consensus was that #969 has opened up the specification enough to address the technical problems faced by Java auto-instrumentation. The feeling is that #1022 and #1033 are both minor rearrangements that offer conceptual improvements at the cost of taking away a very familiar concept. We observed that it could be just the name "SpanContext" that now leads us to confusion, and that perhaps if we could simply rename "SpanContext" to "SpanIdentifiers" that this problem would be solved.
I think I take issue with "active, writable object". That is not how I see a Span. I see Span as an "interface object" with methods that convey semantic information, they do not write to an object. I would not "rely on runtime behavior of the span to ignore write methods", because methods on a propagated span convey semantic information. I believe we are trying to say that the default SDK will treat methods on propagated spans as no-ops, but an alternative SDK with a different data model could decide to do something with these events. |
The propagated span is not intended as customization point for SDKs. It is meant to be fully implemented in the API only:
|
@Oberon00 Thank you for correcting me. Well, these propagation spans, if they could be given an implementation other than no-op, would address the request in #1007. To actually support writing such spans would require something new in the data model, but as an API-level question I'd be in favor of defining these propagation spans as meaningful continuations of their parent span where the default implementation is a no-op (because the standard data model does not have this support). |
@jmacd Thanks for the update - is the recommendation to consider just renaming |
I don't think this is a good idea. That would add a dependency of instrumentation code on implementation-defined behavior of the API implementation. E.g. I have a "normal" web server instrumentation now, but if I want a B3 webserver instrumentation I have to change the instrumentation code to operate on the extracted span instead of creating a child span? That seems like suboptimal API design. Also, what would happen if there is no parent to be extracted, so you would get an empty propagated span? I would much prefer to have this handled transparently, e.g. something in StartSpan (the sampler, the ID generator) should decide to not generate a new span ID for the child span. See #1007 (comment) |
I think the name SpanReference may be better. As there will be more information contained than required for identifying the span (traceflags and potentially parts of tracestate), but it is the minimum required information to reference the span as parent, or in a link. |
I believe @bogdandrutu volunteered to write this rename proposal in more detail. I support |
Closing this since no interest. Thanks for the reviews! |
Fixes #999
Changes
This removes
SpanContext
from the API. Reasoning can be found in #999 and #1022. This PR is a more strict version of #1022 by removingSpanContext
completely instead of making it optional - this was recommended to me as a better alternative at the maintainers meeting (which I heard about via @trask, thanks!).Prototype PR in Java open-telemetry/opentelemetry-java#1712