-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Improve Activity API usability and OpenTelemetry integration (Part 2) #39087
Conversation
Note regarding the This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, to please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change. |
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.
LGTM!
src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Activity.cs
Show resolved
Hide resolved
src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/ActivityListener.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/ActivityContext.cs
Show resolved
Hide resolved
...braries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/ActivityTagsCollection.cs
Outdated
Show resolved
Hide resolved
...braries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/ActivityTagsCollection.cs
Outdated
Show resolved
Hide resolved
...braries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/ActivityTagsCollection.cs
Show resolved
Hide resolved
src/libraries/System.Diagnostics.DiagnosticSource/tests/ActivitySourceTests.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Diagnostics.DiagnosticSource/tests/ActivityTests.cs
Show resolved
Hide resolved
src/libraries/System.Diagnostics.DiagnosticSource/tests/ActivitySourceTests.cs
Show resolved
Hide resolved
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.
Looks good - added small comments/questions. Would love to see response before marking approval.
src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Activity.cs
Outdated
Show resolved
Hide resolved
...braries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/ActivityTagsCollection.cs
Outdated
Show resolved
Hide resolved
...braries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/ActivityTagsCollection.cs
Outdated
Show resolved
Hide resolved
...aries/System.Diagnostics.DiagnosticSource/ref/System.Diagnostics.DiagnosticSourceActivity.cs
Show resolved
Hide resolved
...braries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/ActivityTagsCollection.cs
Show resolved
Hide resolved
@@ -47,6 +47,11 @@ public ActivityListener() | |||
/// </summary> | |||
public GetRequestedData<ActivityContext>? GetRequestedDataUsingContext { get; set; } | |||
|
|||
/// <summary> | |||
/// Determine if the listener automatically generates a new trace Id before sampling when there is no parent 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.
Could you make it explicit that this traceid will be used by the Activity, should we chose to create it?
@Anipik is this the one you are fixing in https://github.com/dotnet/runtime/pull/39298/files? |
Yeah, the PR that fixes the all configurations failure in master is: #39291 |
@dotnet/dnceng I am seeing some weird things here. could you please double check if there is anything wrong? basically the PR showing the legs which not completed as "in progress" but when I view it in AzDo I am seeing them queued and not started. I am experiencing some problems with these legs and I had to restart them hoping behave nicely. Thanks for your help. |
Sure, I'll take a look :) |
@tarekgh nothing's in that state now, but I think I know what you mean. Basically what you're seeing is that Github / Azure Devops have called our pool provider which said "sure! I can do this work!" but behind the scenes it's sticking work items into a private Helix queue. So, when you see messages in the build that it's queued but not started, that build queue is just a bit backed up (and/or waiting for the helix agent to clean up its workspace, reboot, and take more work). If this does end up taking > 90 minutes it will fail (https://github.com/dotnet/core-eng/issues/10136 tracks bringing this up to 120). Mostly we have ~2000 fewer cores than before the pandemic and builds are a place where the pain is commonly felt. |
Thanks @MattGal. |
public System.Diagnostics.Activity? StartActivity(string name, System.Diagnostics.ActivityKind kind, System.Diagnostics.ActivityContext parentContext, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string, string?>>? tags = null, System.Collections.Generic.IEnumerable<System.Diagnostics.ActivityLink>? links = null, System.DateTimeOffset startTime = default) { throw null; } | ||
public System.Diagnostics.Activity? StartActivity(string name, System.Diagnostics.ActivityKind kind, string parentId, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string, string?>>? tags = null, System.Collections.Generic.IEnumerable<System.Diagnostics.ActivityLink>? links = null, System.DateTimeOffset startTime = default) { throw null; } | ||
public System.Diagnostics.Activity? StartActivity(string name, System.Diagnostics.ActivityKind kind, System.Diagnostics.ActivityContext parentContext, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string, object?>>? tags = null, System.Collections.Generic.IEnumerable<System.Diagnostics.ActivityLink>? links = null, System.DateTimeOffset startTime = default) { throw null; } | ||
public System.Diagnostics.Activity? StartActivity(string name, System.Diagnostics.ActivityKind kind, string parentId, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string, object?>>? tags = null, System.Collections.Generic.IEnumerable<System.Diagnostics.ActivityLink>? links = null, System.DateTimeOffset startTime = default) { throw null; } |
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.
@tarekgh Hey I just noticed working on some code in OTel that you can't specify events in the StartActivity call. You can specify pretty much everything else. Should we add events too?
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 there is no AddLink method. Links you have to specify at creation?
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 just noticed working on some code in OTel that you can't specify events in the StartActivity call. You can specify pretty much everything else. Should we add events too?
StartActivity arguments mainly the things needed for sampling decision to decide if want to create the activity or just avoid that and sample it out. If you look at the OT sampling specs, you'll find events are not needed there https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/trace/sdk.md#sampling. But anyway, you can add events after creating the activity.
Also there is no AddLink method. Links you have to specify at creation?
This was proposed before and then got removed because there was a claim that shouldn't allow adding links after creating and starting the activity. OT specs saying During the Span creation user MUST have the ability to record links to other Spans. Linked Spans can be from the same or a different trace.
. so, the spec is explicit mentioning the links should be provided during the Span creation. But anyway, later if we find any scenario need to add links after starting the activity, we can consider it.
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.
What Tarek said is my understanding as well.
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.
That all makes sense. What I'm doing right now is working on a unit test. It needs the Activity created very specifically. So it's not a normal use case. I think I can make it work with reflection. The links are a bit of a challenge. I'll mention you guys on the change once I have it working so you can see what I'm up against, and then we can decide if any changes are warranted.
Fixes #38419