-
Notifications
You must be signed in to change notification settings - Fork 309
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
Implement Config Consistency #4725
Implement Config Consistency #4725
Conversation
Overall package sizeSelf size: 7.55 MB Dependency sizes| name | version | self size | total size | |------|---------|-----------|------------| | @datadog/native-appsec | 8.1.1 | 18.67 MB | 18.68 MB | | @datadog/native-iast-taint-tracking | 3.1.0 | 12.27 MB | 12.28 MB | | @datadog/pprof | 5.3.0 | 9.85 MB | 10.22 MB | | protobufjs | 7.2.5 | 2.77 MB | 5.16 MB | | @datadog/native-iast-rewriter | 2.5.0 | 2.51 MB | 2.59 MB | | @opentelemetry/core | 1.14.0 | 872.87 kB | 1.47 MB | | @datadog/native-metrics | 2.0.0 | 898.77 kB | 1.3 MB | | @opentelemetry/api | 1.8.0 | 1.21 MB | 1.21 MB | | import-in-the-middle | 1.11.2 | 112.74 kB | 826.22 kB | | msgpack-lite | 0.1.26 | 201.16 kB | 281.59 kB | | opentracing | 0.14.7 | 194.81 kB | 194.81 kB | | pprof-format | 2.1.0 | 111.69 kB | 111.69 kB | | @datadog/sketches-js | 2.1.0 | 109.9 kB | 109.9 kB | | semver | 7.6.3 | 95.82 kB | 95.82 kB | | lodash.sortby | 4.7.0 | 75.76 kB | 75.76 kB | | lru-cache | 7.14.0 | 74.95 kB | 74.95 kB | | ignore | 5.3.1 | 51.46 kB | 51.46 kB | | int64-buffer | 0.1.10 | 49.18 kB | 49.18 kB | | shell-quote | 1.8.1 | 44.96 kB | 44.96 kB | | istanbul-lib-coverage | 3.2.0 | 29.34 kB | 29.34 kB | | rfdc | 1.3.1 | 25.21 kB | 25.21 kB | | tlhunter-sorted-set | 0.1.0 | 24.94 kB | 24.94 kB | | limiter | 1.1.5 | 23.17 kB | 23.17 kB | | dc-polyfill | 0.1.4 | 23.1 kB | 23.1 kB | | retry | 0.13.1 | 18.85 kB | 18.85 kB | | jest-docblock | 29.7.0 | 8.99 kB | 12.76 kB | | crypto-randomuuid | 1.0.0 | 11.18 kB | 11.18 kB | | koalas | 1.0.2 | 6.47 kB | 6.47 kB | | path-to-regexp | 0.1.10 | 6.38 kB | 6.38 kB | | module-details-from-path | 1.0.3 | 4.47 kB | 4.47 kB |🤖 This report was automatically generated by heaviest-objects-in-the-universe |
BenchmarksBenchmark execution time: 2024-10-18 19:50:26 Comparing candidate commit 732d9d1 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 258 metrics, 8 unstable metrics. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #4725 +/- ##
===========================================
- Coverage 91.42% 79.91% -11.51%
===========================================
Files 112 303 +191
Lines 3475 13096 +9621
Branches 33 33
===========================================
+ Hits 3177 10466 +7289
- Misses 298 2630 +2332
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
|
||
// edge case handling, if a user manually sets a service name different from the tracer's service name | ||
// then we need to ensure that the version is set to undefined | ||
// in every other scenario version should be set to the tracer's version |
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 assume by "manually" you mean when creating a custom span and passing a service name != global service name?
Does this apply to integration service names that differ from global service name (since it's not "manual" but does have the "different service name" effect)
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.
@khanayan123 the comment says that we need to do something but why do we need to do 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.
Updated the comment, the reason we need to do it is to align with the unified service tagging spec https://docs.datadoghq.com/getting_started/tagging/unified_service_tagging/?tab=kubernetes
DD_VERSION (version) Environment Variable Name: DD_VERSION Behavior: Adds version tag to all spans that have the same service name as the default service name (aka DD_SERVICE). Spans with a different service name do not get this tag.
Configure spans with DD_VERSION to add version to all spans that fall under the service that belongs to the tracer (generally DD_SERVICE). This means that if your service creates spans with the name of an external service, those spans do not receive version as a tag.
Adds version tag to all spans that have the same service name as the default service name (aka DD_SERVICE). Spans with a different service name do not get this tag.
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.
other SDKs such as golang already do this
@@ -245,6 +245,39 @@ describe('Tracer', () => { | |||
expect(span.addTags).to.have.been.calledWith(fields.tags) | |||
}) | |||
|
|||
it('If a user sets spans service name differs from the tracers, ensure the spans version is undefined.', () => { |
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.
it('If a user sets spans service name differs from the tracers, ensure the spans version is undefined.', () => { | |
it('If span is granted a service name that differs from the global service name, ensure span's `version` tag is undefined.', () => { |
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.
Since this PR changes default values, one could argue it's a breaking change and should be labeled with semver-major
. However, to be pragmatic about it, I think it should just be labeled it with semver-minor
(currently it's labeled with semver-patch
).
040d6bc
to
1d50a50
Compare
// Check for DD_TRACE_<INTEGRATION>_ENABLED environment variables | ||
for (const [key, value] of Object.entries(process.env)) { | ||
const match = key.match(/^DD_TRACE_(.+)_ENABLED$/) | ||
if (match && value.toLowerCase() === 'false') { |
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.
In practice customers use both false
and 0
packages/dd-trace/src/config.js
Outdated
@@ -1144,7 +1147,16 @@ class Config { | |||
} | |||
|
|||
if (typeof value === 'string') { | |||
value = value.split(',') | |||
// Split by commas and trim each item in header tags mapping | |||
if (name === 'headerTags') { |
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.
Is there any way to do this in a way that we don't put hyper-specific code, like this header tags check, in a common generic code path?
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 think it's fair to remove white spaces around all values in a mapping, going to remove that check for headerTags
|
||
// As per unified service tagging spec if a span is created with a service name different from the global | ||
// service name it will not inherit the global version value | ||
if (options?.tags?.service && options?.tags?.service !== this._service) { |
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 (options?.tags?.service && options?.tags?.service !== this._service) { | |
if (options?.tags?.service && options.tags.service !== this._service) { |
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.
Since at this point we already know options.tags is an object
packages/dd-trace/src/config.js
Outdated
@@ -546,7 +547,7 @@ class Config { | |||
this._setValue(defaults, 'tracePropagationStyle.otelPropagators', false) | |||
this._setValue(defaults, 'tracing', true) | |||
this._setValue(defaults, 'url', undefined) | |||
this._setValue(defaults, 'version', pkg.version) |
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.
Is this a breaking change? What implications does it come with?
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.
Depends on our definition of breaking change, this shouldn't be a breaking change in the sense that it's part of the UST definition which with this change we would be adhering more closer to, so one could also consider it a patch.
https://docs.datadoghq.com/getting_started/tagging/unified_service_tagging
The implications of this is that unless a 'version' is manually set users will not automatically have version set on their traces, the only caveat being an edge case for dsm to maintain their functionality.
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.
Revert this and I think we can land 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.
reverted
What does this PR do?
This pull request updates configuration defaults and behaviors to ensure alignment with standardized definitions across SDKs
changes:
<INTEGRATION>
_ENABLED, allowing the enablement or disablement of specific integrations based on the provided integration name.Motivation
The changes are driven by the need to meet the requirements outlined in the configuration consistency RFC
Additional Notes
This PR was tested against the system tests here