-
Notifications
You must be signed in to change notification settings - Fork 812
Update Grpc.Net.Client to use ActivitySource #2244
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
Changes from 5 commits
3507296
3181bfe
83d9037
d6858d3
2dd142c
de688df
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -811,9 +811,15 @@ private void SetFailedResult(Status status) | |
// 1. Diagnostic source is enabled | ||
// 2. Logging is enabled | ||
// 3. There is an existing activity (to enable activity propagation) | ||
if (diagnosticSourceEnabled || Logger.IsEnabled(LogLevel.Critical) || Activity.Current != null) | ||
// 4. ActivitySource has listeners | ||
if (diagnosticSourceEnabled || Logger.IsEnabled(LogLevel.Critical) || Activity.Current != null || GrpcDiagnostics.ActivitySource.HasListeners()) | ||
{ | ||
activity = new Activity(GrpcDiagnostics.ActivityName); | ||
activity = GrpcDiagnostics.ActivitySource.CreateActivity(GrpcDiagnostics.ActivityName, ActivityKind.Client); | ||
|
||
// ActivitySource only returns an activity if someone is listening. | ||
// We always want there to be an activity so fallback to creating the activity manually. | ||
activity ??= new Activity(GrpcDiagnostics.ActivityName); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How come this one doesn't have an ActivityKind? Is Client the default? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The default is internal, but it can't be set when using the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can consider in the future release to add a constructor that can take a |
||
|
||
activity.AddTag(GrpcDiagnostics.GrpcMethodTagName, Method.FullName); | ||
activity.Start(); | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.