refactor(config): migrate spanAttributeSchemaVersion#4711
Conversation
Move the spanAttributeSchemaVersion field from the legacy tracer config struct to internal/config.Config. The field is already declared and initialised by loadConfig; this change exposes a public getter and rewires the two readers (startTelemetry and the StartSpan hot path) to use it. The getter avoids defer since it is read once per local-root span, matching the README's hot-path guidance. namingschema.LoadFromEnv() is preserved because contrib packages still consume the namingschema global via GetVersion(). Refs: APMAPI-1887 (EPIC APMAPI-1881)
Codecov Report❌ Patch coverage is
Additional details and impacted files
🚀 New features to boost your workflow:
|
🎉 All green!❄️ No new flaky tests detected 🎯 Code Coverage (details) 🔗 Commit SHA: 89c5a54 | Docs | Datadog PR Page | Give us feedback! |
BenchmarksBenchmark execution time: 2026-05-04 11:50:14 Comparing candidate commit 89c5a54 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 209 metrics, 9 unstable metrics.
|
mtoffl01
left a comment
There was a problem hiding this comment.
one nit, otherwise LGTM!
| {Name: "debug_stack_enabled", Value: c.internalConfig.DebugStack()}, | ||
| {Name: "profiling_hotspots_enabled", Value: c.internalConfig.ProfilerHotspotsEnabled()}, | ||
| {Name: "trace_span_attribute_schema", Value: c.spanAttributeSchemaVersion}, | ||
| {Name: "trace_span_attribute_schema", Value: c.internalConfig.SpanAttributeSchemaVersion()}, |
There was a problem hiding this comment.
let's delete this entirely; SpanAttributeSchemaVersion is now automatically reported to telemetry at startup via the config provider's telemetry implementation.
If existing tests fail as a result , you can probably just modify their expectations
…y entry
The config provider auto-reports DD_TRACE_SPAN_ATTRIBUTE_SCHEMA via its
telemetry implementation when loadConfig calls p.GetString, so the legacy
explicit entry in startTelemetry is duplicate. Update the test expectation
to match the auto-reported default ("") instead of the legacy int (0).
| } | ||
|
|
||
| // SpanAttributeSchemaVersion returns the configured DD_TRACE_SPAN_ATTRIBUTE_SCHEMA version. | ||
| // Read on the span-creation hot path; avoids defer to minimise lock cost. |
|
/merge |
|
View all feedbacks in Devflow UI.
This pull request is not mergeable according to GitHub. Common reasons include pending required checks, missing approvals, or merge conflicts — but it could also be blocked by other repository rules or settings.
The expected merge time in
|
### What does this PR do? - Adds a public `Config.MaxTagsHeaderLen()` getter on `internal/config.Config`. - Initializes the field in `loadConfig` from `DD_TRACE_X_DATADOG_TAGS_MAX_LENGTH`, preserving the existing clamping semantics (negative → 0; > `MaxPropagatedTagsLength` → clamped down to that value). - Adds `DefaultMaxTagsHeaderLen` and `MaxPropagatedTagsLength` exported constants in `internal/config`. - Removes the duplicate env resolution from `tracer/option.go` and the `defaultMaxTagsHeaderLen` / `maxPropagatedTagsLength` constants there. - The propagator is now constructed using `c.internalConfig.MaxTagsHeaderLen()` instead of locally re-reading the env var. ### Motivation Continued config-migration work: move env resolution of `DD_TRACE_X_DATADOG_TAGS_MAX_LENGTH` into `internal/config` to match the pattern established by recent migrations (e.g. #4711, #4653). --------- Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
Summary
Config.SpanAttributeSchemaVersion()getter oninternal/config.Config. The field itself was already declared and initialised byloadConfig; this just exposes a public accessor.spanAttributeSchemaVersionfield from the legacy tracerconfigstruct and thec.spanAttributeSchemaVersion = int(namingschema.GetVersion())assignment innewConfig.telemetry.gostartup config andtracer.goStartSpanhot path) to read through the new getter.deferbecause it is read once per local-root span — matches the hot-path pattern from the peer-service migration (refactor(config): peer service revamp #4653) and the README guidance.namingschema.LoadFromEnv()is preserved: contrib packages still consume the namingschema global viaGetVersion().Jira: APMAPI-1887
EPIC: APMAPI-1881 — Go Config Revamp: Migrate tracer
Test plan
go build ./...go vet ./ddtrace/tracer/... ./internal/config/...go test ./internal/config/...go test ./ddtrace/tracer/...(full suite)attribute_schema_is_set_v0/v1/wrong_value(tracer_test.go) anddefaults-with-schema-v1(option_test.go) pass without modification.