Emit env var names in telemetry config#3783
Merged
Conversation
Use the canonical environment variable name (e.g. DD_TRACE_GENERATE_ROOT_SPAN) directly from cfg->names[0] instead of stripping the "datadog." prefix from the PHP INI name (e.g. trace.generate_root_span). This is more correct as it uses the original source-of-truth name without any lossy round-trip transformation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
✨ Fix all issues with BitsAI or with Cursor
|
Benchmarks [ tracer ]Benchmark execution time: 2026-04-13 23:47:17 Comparing candidate commit fca7105 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 192 metrics, 2 unstable metrics. |
The SCA tests expected the old INI-derived name "appsec.sca_enabled" but the telemetry now emits the env var name "DD_APPSEC_SCA_ENABLED". Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The sca_test.inc helper uses strpos() to find "sca_enabled" in the config name, but the env var name DD_APPSEC_SCA_ENABLED is uppercase. Switch to stripos() for case-insensitive matching. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
DD_APPSEC_SCA_ENABLED is 21 characters, not 22. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
DD_TRACE_GENERATE_ROOT_SPAN) instead of the INI-derived dot notation (e.g.trace.generate_root_span)cfg->names[0]directly from the memoized config entry, which is the original env var name from theCONFIG()macro definitionsnames[0]is a stack-allocated buffer already in memoryMotivation
The backend automatically opens PRs that map config telemetry based on the config registry. Previously, PHP emitted INI-derived names like
trace.generate_root_spanwhich don't match the env var names in the registry, so those auto-generated PRs couldn't map PHP configs correctly. By emitting the standard env var name (e.g.DD_TRACE_GENERATE_ROOT_SPAN), the auto-generated backend PRs can map PHP configs without issues.Companion PR
Test plan
tests/ext/telemetry/config.phpt— verifies telemetry config names are emitted as env var namestests/ext/library_config/fleet_config.phpt— verifies fleet stable config telemetry namestests/ext/library_config/local_config.phpt— verifies local stable config telemetry namestests/ext/appsec/sca_flag_is_sent_*.phpt(5 tests) — verifies SCA config telemetry namesphp-8.3_bookworm-6, debug build)🤖 Generated with Claude Code