You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Ending an activity will not restore the previously active one for explicit parents #46721
Activity.Current becomes null whenever any Activity with explicit parent is ended. I would instead have expected that the previously active activity would be restored, independent of whether it was the parent or not.
Following shows how to repro this with OpenTelemetry, but this can be reproed by setting up any Activitylistener.
Span creation MUST NOT set the newly created Span as the currently active Span by default, but this functionality MAY be offered additionally as a separate operation.
End MUST NOT inactivate the Span in any Context it is active in. It MUST still be possible to use an ended span as parent via a Context it is contained in. Also, any mechanisms for putting the Span into a Context MUST still work after the Span was ended.
Which the activity API also does not conform to.
As per the spec for End, Tracer.Context would be the "disposed" span, if I understand you correctly.
The API MUST provide an operation for wrapping a SpanContext with an object implementing the Span interface. This is done in order to expose a SpanContext as a Span in operations such as in-process Span propagation.
I'm happy to explore what we can do to improve things, but I do want to be up-front that spec conformance is not the only consideration which drives .NET's design in this space. The Activity API long pre-dated OpenTelemetry's spec and there is a huge ecosystem of .NET apps that our customers depend on us not to break when they upgrade. Re-defining the behavior of existing APIs is always an area we are going to proceed cautiously.
Activity
tarekgh commentedon Jan 8, 2021
@cijothomas I am wondering how this suppose to work from the OTel specification point of view? I mean:
what value you'll get?
CC @noahfalk
Oberon00 commentedon Jan 8, 2021
The Activity API is not conformant to the spec at all, see https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/trace/api.md#span-creation:
Which the activity API violates. It also says in https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/trace/api.md#end:
Which the activity API also does not conform to.
As per the spec for End,
Tracer.Contextwould be the "disposed" span, if I understand you correctly.Oberon00 commentedon Jan 8, 2021
Also note that the spec requires a concept of a "wrapped" SpanContext, i.e. a SpanContext can be wrapped in a non-recording Span so that it can be active in a context: https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/trace/api.md#wrapping-a-spancontext-in-a-span
noahfalk commentedon Jan 8, 2021
I'm happy to explore what we can do to improve things, but I do want to be up-front that spec conformance is not the only consideration which drives .NET's design in this space. The Activity API long pre-dated OpenTelemetry's spec and there is a huge ecosystem of .NET apps that our customers depend on us not to break when they upgrade. Re-defining the behavior of existing APIs is always an area we are going to proceed cautiously.
Oberon00 commentedon Jan 8, 2021
I understand. That's why I suggested in open-telemetry/opentelemetry-dotnet#1677 (and copied here) that
This may also break any use cases that rely on the activity being null when it is not after that change, but that would be a much smaller change.