-
Notifications
You must be signed in to change notification settings - Fork 2.7k
[processor/datadogsemantics] Make defaults explicit and add test #39596
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: main
Are you sure you want to change the base?
[processor/datadogsemantics] Make defaults explicit and add test #39596
Conversation
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 would prefer if each attribute followed the same pattern as much as possible. If there is a way you can either set service variable explicitly prior to calling GetOTelService, or leave a comment above those lines explaining what service gets set to by default, that would be appreciated
if err = tp.insertAttrIfMissingOrShouldOverride(rattr, "datadog.service", service); err != nil { | ||
return ptrace.Traces{}, err | ||
} | ||
if err = tp.insertAttrIfMissingOrShouldOverride(rattr, "datadog.service", traceutil.GetOTelService(otelres, true)); err != nil { |
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.
am I understanding correctly that this change, if otelres is blank, then traceutil.GetOTelService will return "otlpresourcenoservicename" and that's what datadog.service
will be set to?
https://github.com/DataDog/datadog-agent/blob/0d44e61fa623ef2572ba8d7fbe30e2632540d8aa/pkg/trace/traceutil/otel_util.go#L276
Worth adding a link to the function or noting the default setting in the comments here?
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.
alternatively, you could always make that an exportable constant in pkg/trace/traceutil and set service equal to the value before calling GetOTelService.
I just think we should try to have the pattern for each attribute follow a similar pattern to the maximum extent practical, so the code is easy to understand later
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.
Agreed, I added a comment explaining the default
Description
Explicitly set defaults for each field - whatever the Datadog backend would populate if you send the field as blank; e.g., if we send a blank env, it would show up in the UI as the string
default
, so we should surface that to the user with this processor. Also, populatedatadog.*
fields even if they would be blank (this includes overriding them even if the result would be blank if theoverrideIncomingDatadogFields
option is set, for consistency)Link to tracking issue
Fixes
Testing
Documentation