-
Notifications
You must be signed in to change notification settings - Fork 147
WIP: Baggage Span Tags #7020
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
base: master
Are you sure you want to change the base?
WIP: Baggage Span Tags #7020
Conversation
} | ||
|
||
// add only specified baggage items as tags | ||
var allowedKeys = baggageTagKeys.Split(',', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries); |
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.
try not to do any heap allocations (don't do Split) --> go around this
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.
If we change settings.BaggageTagKeys
to a string[]
and do the split when we read the config (see my other comment in TracerSettings.cs
), then we don't need to split here anymore.
You can remove this line and change the foreach
below to something like:
foreach (var key in baggageTagKeys)
Datadog ReportBranch report: ✅ 0 Failed, 53 Passed, 0 Skipped, 32m 26.97s Total Time |
@@ -125,6 +140,7 @@ public Scope StartAspNetCorePipelineScope(Tracer tracer, Security security, Http | |||
var scope = tracer.StartActiveInternal(_requestInOperationName, extractedContext.SpanContext, tags: tags, links: extractedContext.Links); | |||
scope.Span.DecorateWebServerSpan(resourceName, httpMethod, host, url, userAgent, tags); | |||
AddHeaderTagsToSpan(scope.Span, request, tracer); | |||
AddBaggageTagsToSpan(scope.Span, extractedContext.Baggage, tracer); |
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.
You'll want to do this for other web server spans as well.
BaggageTagKeys = config | ||
.WithKeys(ConfigurationKeys.BaggageTagKeys) | ||
.AsString(defaultValue: "user.id,session.id,account.id"); |
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.
Try making BaggageTagKeys
a string[]
and splitting here so we only do it once and not when we try to apply this setting in each incoming http request. See disabledIntegrationNames
around line 331 above as an example. Probably just need to add Split()
, like:
BaggageTagKeys = config | |
.WithKeys(ConfigurationKeys.BaggageTagKeys) | |
.AsString(defaultValue: "user.id,session.id,account.id"); | |
BaggageTagKeys = config | |
.WithKeys(ConfigurationKeys.BaggageTagKeys) | |
.AsString(defaultValue: "user.id,session.id,account.id") | |
.Split([','], StringSplitOptions.RemoveEmptyEntries); |
You'll have to change the property in line 1067 below, too:
- internal string BaggageTagKeys { get; }
+ internal string[] BaggageTagKeys { get; }
Summary of changes
Reason for change
Implementation details
Test coverage
Other details