Skip to content
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

Merged
merged 6 commits into from
Jul 15, 2020

Conversation

tarekgh
Copy link
Member

@tarekgh tarekgh commented Jul 10, 2020

Fixes #38419

@Dotnet-GitSync-Bot
Copy link
Collaborator

Note regarding the new-api-needs-documentation label:

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.

@ghost
Copy link

ghost commented Jul 10, 2020

Tagging subscribers to this area: @tarekgh, @safern, @krwq
Notify danmosemsft if you want to be subscribed.

@ghost
Copy link

ghost commented Jul 10, 2020

Tagging subscribers to this area: @tarekgh, @tommcdon, @pjanotti
Notify danmosemsft if you want to be subscribed.

@tarekgh tarekgh added this to the 5.0.0 milestone Jul 10, 2020
@tarekgh
Copy link
Member Author

tarekgh commented Jul 10, 2020

dotnet/designs#134

@tarekgh
Copy link
Member Author

tarekgh commented Jul 10, 2020

CC @cijothomas @reyang

Copy link
Member

@noahfalk noahfalk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Contributor

@cijothomas cijothomas left a 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.

@@ -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.
Copy link
Contributor

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?

@tarekgh
Copy link
Member Author

tarekgh commented Jul 14, 2020

runtime (Libraries Build Windows_NT allConfigurations x64 Debug) failure is not related and @joperezr is working to take care with this one.

@Anipik is this the one you are fixing in https://github.com/dotnet/runtime/pull/39298/files?

@safern
Copy link
Member

safern commented Jul 14, 2020

Yeah, the PR that fixes the all configurations failure in master is: #39291

@tarekgh
Copy link
Member Author

tarekgh commented Jul 14, 2020

@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.

@MattGal
Copy link
Member

MattGal commented Jul 14, 2020

@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 :)

@MattGal
Copy link
Member

MattGal commented Jul 14, 2020

@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.

@tarekgh
Copy link
Member Author

tarekgh commented Jul 14, 2020

Thanks @MattGal.

@tarekgh tarekgh merged commit b895666 into dotnet:master Jul 15, 2020
@tarekgh tarekgh deleted the ActivityApisPart2 branch July 15, 2020 05:07
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; }
Copy link
Contributor

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?

Copy link
Contributor

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?

Copy link
Member Author

@tarekgh tarekgh Jul 15, 2020

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.

CC @cijothomas @reyang

Copy link
Contributor

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.

Copy link
Contributor

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.

@ghost ghost locked as resolved and limited conversation to collaborators Dec 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve Activity API usability and OpenTelemetry integration (Part 2)
7 participants