refactor(config): generate runtime config from supported metadata#7916
refactor(config): generate runtime config from supported metadata#7916
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #7916 +/- ##
==========================================
- Coverage 74.25% 74.16% -0.09%
==========================================
Files 769 772 +3
Lines 36068 35749 -319
==========================================
- Hits 26783 26515 -268
+ Misses 9285 9234 -51
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Overall package sizeSelf size: 5.43 MB Dependency sizes| name | version | self size | total size | |------|---------|-----------|------------| | import-in-the-middle | 3.0.1 | 82.56 kB | 817.39 kB | | dc-polyfill | 0.1.10 | 26.73 kB | 26.73 kB |🤖 This report was automatically generated by heaviest-objects-in-the-universe |
|
✨ Fix all issues with BitsAI or with Cursor
|
fb9b1fb to
8aeef8d
Compare
| }) | ||
|
|
||
| if (this.constructor.isPayloadReporter && this.cloudTaggingConfig.requestsEnabled) { | ||
| if (this.constructor.isPayloadReporter && this.cloudTaggingConfig.request) { |
There was a problem hiding this comment.
Let's explain (broadly/generally, not specifically for each such change) that this is a simplification, etc.
There was a problem hiding this comment.
After looking in the code again, the usage of it now seems very straight forward. Before, two properties were used to check one thing. Now if the property exists, it is enabled. Thus, it should hopefully be understandable without a comment?
| { name: 'DD_LOG_INJECTION', value: false, origin: 'code' }, | ||
| { name: 'DD_LOGS_INJECTION', value: true, origin: 'default' }, | ||
| { name: 'DD_LOGS_INJECTION', value: true, origin: 'env_var' }, | ||
| { name: 'DD_LOGS_INJECTION', value: false, origin: 'code' }, |
| transformer (object) { | ||
| if (typeof object === 'object' && | ||
| object !== null && | ||
| Object.values(object).some(value => typeof value === 'function')) { |
There was a problem hiding this comment.
Add a TODO to check for specific function names.
There was a problem hiding this comment.
I implemented a validation that checks for known names instead
8aeef8d to
bf6cdaf
Compare
BenchmarksBenchmark execution time: 2026-04-07 21:14:18 Comparing candidate commit 22b7138 in PR branch Found 0 performance improvements and 17 performance regressions! Performance is the same for 211 metrics, 32 unstable metrics. scenario:appsec-iast-no-vulnerability-iast-enabled-always-active-18
scenario:appsec-iast-no-vulnerability-iast-enabled-always-active-20
scenario:appsec-iast-no-vulnerability-iast-enabled-always-active-22
scenario:appsec-iast-no-vulnerability-iast-enabled-always-active-24
scenario:appsec-iast-no-vulnerability-iast-enabled-default-config-18
scenario:appsec-iast-no-vulnerability-iast-enabled-default-config-20
scenario:appsec-iast-no-vulnerability-iast-enabled-default-config-22
scenario:appsec-iast-no-vulnerability-iast-enabled-default-config-24
scenario:net-with-tracer-22
|
| } | ||
|
|
||
| const transformers = { | ||
| setIntegerRangeSet (value) { |
There was a problem hiding this comment.
Comment that this is only for grpc
There was a problem hiding this comment.
Renamed the method to setGRPCRange
Config model: Build the tracer runtime config from `supported-configurations.json`. The metadata now defines defaults, aliases, transforms, allowed values, and internal property mapping. Env vars, stable config, code options, remote config, and telemetry now go through the same parsing and normalization path instead of separate logic. Remote config and fallback: Normalize remote config into the same local option names before apply. When a remote value is removed, restore the earlier code value or the default for that one option, instead of keeping an old remote value. This also keeps config source tracking correct when remote config changes over time. Telemetry: Report the same normalized config view that the tracer really uses. Telemetry now keeps the source of each value, sends standard config names such as `DD_*` and `OTEL_*`, and serializes URLs, arrays, objects, functions, and rule sets in one consistent format for config change events and extended heartbeats. DD and OTEL precedence: Use one precedence model for Datadog and OpenTelemetry settings. Datadog config still wins when both are set. Generic `OTEL_EXPORTER_OTLP_*` endpoint, header, protocol, and timeout values now fill in logs and metrics config when the specific setting is not set. `b3` extraction keeps Datadog multi-header behavior when it comes from `DD_TRACE_PROPAGATION_STYLE`, and keeps single-header behavior when it comes from `OTEL_PROPAGATORS`. Config-specific updates: Parse and validate more individual settings through shared parsers. This now covers sample rates, propagation styles and behavior, `OTEL_RESOURCE_ATTRIBUTES`, `DD_TRACE_HEADER_TAGS` spacing, JSON sampling rules, AppSec blocked template file paths, and `DD_GRPC_CLIENT_ERROR_STATUSES` / `DD_GRPC_SERVER_ERROR_STATUSES` range values. Invalid values now warn the same way and fall back more predictably. Calculated behavior: Recalculate derived settings from the remembered source of each value. This keeps service and tag inference, socket and DogStatsD defaults, OTEL logs vs log injection, runtime metrics vs `OTEL_METRICS_EXPORTER=none`, AppSec-driven resource renaming, CI and serverless toggles, Lambda flush behavior, and agentless tracing overrides consistent when inputs change. Runtime consumers: Move profiling, logging, agent URL selection, session propagation, and other runtime code to read the resolved config instead of reparsing env vars. This also keeps proxy startup working when tracing is off but dynamic instrumentation or AppSec standalone still need runtime hooks, and makes profiling exporter and profiler settings follow the same config resolution path.
DD_LOG_INJECTION was corrected to DD_LOGS_INJECTION, how it is named in all other tracers. This is an internal only property, so changing this seems fine.
bf6cdaf to
22b7138
Compare
Config model:
Build the tracer runtime config from
supported-configurations.json.The metadata now defines defaults, aliases, transforms, allowed values,
and internal property mapping. Env vars, stable config, code options,
remote config, and telemetry now go through the same parsing and
normalization path instead of separate logic.
Remote config and fallback:
Normalize remote config into the same local option names before apply.
When a remote value is removed, restore the earlier code value or the
default for that one option, instead of keeping an old remote value.
This also keeps config source tracking correct when remote config
changes over time.
Telemetry:
Report the same normalized config view that the tracer really uses.
Telemetry now keeps the source of each value, sends standard config
names such as
DD_*andOTEL_*, and serializes URLs, arrays,objects, functions, and rule sets in one consistent format for config
change events and extended heartbeats.
DD and OTEL precedence:
Use one precedence model for Datadog and OpenTelemetry settings.
Datadog config still wins when both are set. Generic
OTEL_EXPORTER_OTLP_*endpoint, header, protocol, and timeout valuesnow fill in logs and metrics config when the specific setting is not
set.
b3extraction keeps Datadog multi-header behavior when it comesfrom
DD_TRACE_PROPAGATION_STYLE, and keeps single-header behaviorwhen it comes from
OTEL_PROPAGATORS.Config-specific updates:
Parse and validate more individual settings through shared parsers.
This now covers sample rates, propagation styles and behavior,
OTEL_RESOURCE_ATTRIBUTES,DD_TRACE_HEADER_TAGSspacing,JSON sampling rules, AppSec blocked template file paths, and
DD_GRPC_CLIENT_ERROR_STATUSES/DD_GRPC_SERVER_ERROR_STATUSESrange values. Invalid values now warn the same way and fall back more
predictably.
Calculated behavior:
Recalculate derived settings from the remembered source of each value.
This keeps service and tag inference, socket and DogStatsD defaults,
OTEL logs vs log injection, runtime metrics vs
OTEL_METRICS_EXPORTER=none, AppSec-driven resource renaming, CI andserverless toggles, Lambda flush behavior, and agentless tracing
overrides consistent when inputs change.
Runtime consumers:
Move profiling, logging, agent URL selection, session propagation, and
other runtime code to read the resolved config instead of reparsing env
vars. This also keeps proxy startup working when tracing is off but
dynamic instrumentation or AppSec standalone still need runtime hooks,
and makes profiling exporter and profiler settings follow the same
config resolution path.