-
Notifications
You must be signed in to change notification settings - Fork 437
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
ddtrace/tracer: support default origin on dynamic config to support Active Tracing telemetry spec #2623
Conversation
…ctive Tracing telemetry spec (re: AIT-8580)
ddtrace/tracer/option.go
Outdated
@@ -334,7 +334,9 @@ func newConfig(opts ...StartOption) *config { | |||
} | |||
c.headerAsTags = newDynamicConfig("trace_header_tags", nil, setHeaderTags, equalSlice[string]) | |||
if v := os.Getenv("DD_TRACE_HEADER_TAGS"); v != "" { | |||
WithHeaderTags(strings.Split(v, ","))(c) | |||
c.headerAsTags.update(strings.Split(v, ","), originEnvVar) |
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.
This just made me wonder whether the other settings that are available through RC should also get origin: originEnvVar
on their dynamicConfig when enabled via env var, e.g, DD_TRACE_ENABLED
Maybe newDynamicConfig() should accept a value for origin, or maybe these we should also call dynamicConfig.update(val, originEnvVar)
for these other options
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.
@mtoffl01 You are right. I left this one as example and reminder to add more in a separate PR. Thanks!
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 agree with this. Ideally the constructor should set the origin.
If for some reason we can't use the constructor to do so, the generic dynamicConfig
type should provide a method to update the startup and current values and their origins instead of manipulating the fields directly in ddtrace/tracer/option.go
.
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 did leave one comment about potential changes, but those changes could be applied to a separate PR (since the title of this one explicitly states "support default origin" and my comment is for env_var origin)
@avivenzio-dd Before merging this one, what do you think it's the best course to ensure it's implementing right the spec? |
@darccio good call Can we start up a small service and send some traces using the changes in this branch to a staging org? or is there a way to run the system tests based on this branch? I'm assuming sending some traces is probably easier. We can verify the telemetry events are correct using their debug logs. |
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.
Looks good!
For future reference, I believe the dynamicConfig
structure should be encapsulated in a separate package.
I saw we already bypass its method and access some field (e.g 25d3eb5) which is not the intended behavior (not thread-safe, error-prone and leaks the implementation details)
ddtrace/tracer/option.go
Outdated
@@ -334,7 +334,9 @@ func newConfig(opts ...StartOption) *config { | |||
} | |||
c.headerAsTags = newDynamicConfig("trace_header_tags", nil, setHeaderTags, equalSlice[string]) | |||
if v := os.Getenv("DD_TRACE_HEADER_TAGS"); v != "" { | |||
WithHeaderTags(strings.Split(v, ","))(c) | |||
c.headerAsTags.update(strings.Split(v, ","), originEnvVar) |
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 agree with this. Ideally the constructor should set the origin.
If for some reason we can't use the constructor to do so, the generic dynamicConfig
type should provide a method to update the startup and current values and their origins instead of manipulating the fields directly in ddtrace/tracer/option.go
.
BenchmarksBenchmark execution time: 2024-05-29 10:45:39 Comparing candidate commit aaae6a7 in PR branch Found 0 performance improvements and 2 performance regressions! Performance is the same for 45 metrics, 0 unstable metrics. scenario:BenchmarkHttpServeTrace-24
scenario:BenchmarkStartSpanConcurrent-24
|
@avivenzio-dd The best way I found is to temporarily modify the GitHub CI config to run the parametric tests from DataDog/system-tests#2063. This week is heavy on ER thus reducing our capacity to do anything more sophisticated. A first run shows that it's correctly running from the linked PR in system tests, combined with this PR. It failed anyway because we are returning Edit: a second run seems to fail too but no longer due to the |
This PR is stale because it has been open 20 days with no activity. Remove stale label or comment or this will be closed in 10 days. |
@darccio is there something pending from my side on this? I think the tests should be all updated now. |
@avivenzio-dd No, it's on my roof. Let me try to give it a try tomorrow. |
@avivenzio-dd I did another try but it fails. I'm having availability issues as I've been reassigned to a R&D project for one or two months. How do you want to proceed? |
This PR is stale because it has been open 20 days with no activity. Remove stale label or comment or this will be closed in 10 days. |
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.
Approved for appsec code 👍
…taDog/dd-trace-go into dario.castane/AIT-9990-default-origin
…guration literal Our telemetry expects trace_enabled for config, but config#enabled uses tracing_enabled because it's expected in lib_config key.
@@ -33,7 +33,7 @@ jobs: | |||
uses: actions/checkout@v3 | |||
with: | |||
repository: 'DataDog/system-tests' | |||
ref: ${{ inputs.ref }} | |||
ref: kylev/enable-config-tests |
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.
looks like the tests from this branch are passing! I would just make sure to revert this before merging.
…taDog/dd-trace-go into dario.castane/AIT-9990-default-origin
What does this PR do?
Defaults dynamic config origin to
default
when created.It also sets specific cases to
env_var
according to the telemetry API spec (more detail in AIT-8580).Motivation
Fix failing telemetry system-tests in DataDog/system-tests#2063.
Reviewer's Checklist
For Datadog employees:
@DataDog/security-design-and-guidance
.Unsure? Have a question? Request a review!