-
Notifications
You must be signed in to change notification settings - Fork 765
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
Discussion: Support .NET Activities #128
Discussion: Support .NET Activities #128
Conversation
4593d69
to
1de189e
Compare
Great!
You can still create a Span without setting
So there may be a case when
Can Activity be created only when |
I glanced over files - there are so many needed changes! |
Note that in .NET Core 3.0, the entire HTTP stack will natively support w3c tracing standards + their automatic propagation, see https://twitter.com/davidfowl/status/1144127100997128197?s=21 |
Yes, and it's done with Activities |
@SergeyKanzhelev thanks for the feedback, I'll think more if we can create Activity on-demand only. On one side this is default OpenTelemetry behavior, on the other side - .NET philosophy is Activity everywhere all the time. Also users won't do explicit WithActivity and it will lead to problems like if they create spans manually, it will break all autocollectors (that work over Activity if you want it or not). I'm going to close it and split into multiple smaller PRs. #133: aligning SpanBuilder and Tracer with spec |
[Important] You don't really need to review 83 files - let's discuss it first! PR is only proof of concept.
.NET defines Activity API specifically for distributed tracing.
.NET libraries such as ASP.NET Core, ASP.NET, HTTP Client, SQL client (planned), EventHubs SDK, ServiceBus SDK, and in future all Azure client SDKs will be instrumented with Activities natively.
This is the best choice for them as it allows them to implement tracing without taking a dependency on anything else except .NET BCL.
OpenTelemtery must nicely work with it to leverage it and avoid extra perf costs.
This PR is for discussion on how to achieve it (and it's not easy). It is not full implementation and not even final - internal APIs probably need to change more. Please review public API area changes first and here they are.
Things that change drastically: PLEASE REVIEW THIS!
WithSpan
on tracer), Activity will be there (it always flows - you can explicitly prevent it only). In this case, if users keep using Spans without scopes and will propagate SpanContext explicitly - everything will still be working for them, they will simply ignore Activites.So how it is going to be used
Example 1:
tracer.SpanBuilderFromActivity(path, SpanKind.Server, Activity.Current)
and put it on the contexttracer.SpanBuilder(...).StartSpan()
and by default, if becomes a child of current Span and current ActivityExample 2: