Skip to content

feat: add config DD_TRACE_RUNTIME_ID_ENABLED / remove experimental #5865

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

Merged
merged 6 commits into from
Jun 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions packages/dd-trace/src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,6 @@ class Config {
this._setValue(defaults, 'env')
this._setValue(defaults, 'experimental.enableGetRumData', false)
this._setValue(defaults, 'experimental.exporter')
this._setValue(defaults, 'experimental.runtimeId', false)
this._setValue(defaults, 'flushInterval', 2000)
this._setValue(defaults, 'flushMinSpans', 1000)
this._setValue(defaults, 'gitMetadataEnabled', true)
Expand Down Expand Up @@ -554,6 +553,7 @@ class Config {
this._setValue(defaults, 'remoteConfig.pollInterval', 5) // seconds
this._setValue(defaults, 'reportHostname', false)
this._setValue(defaults, 'runtimeMetrics', false)
this._setValue(defaults, 'runtimeMetricsRuntimeId', false)
this._setValue(defaults, 'sampleRate')
this._setValue(defaults, 'sampler.rateLimit', 100)
this._setValue(defaults, 'sampler.rules', [])
Expand Down Expand Up @@ -730,7 +730,7 @@ class Config {
DD_TRACE_ENABLED,
DD_TRACE_EXPERIMENTAL_EXPORTER,
DD_TRACE_EXPERIMENTAL_GET_RUM_DATA_ENABLED,
DD_TRACE_EXPERIMENTAL_RUNTIME_ID_ENABLED,
DD_RUNTIME_METRICS_RUNTIME_ID_ENABLED,
DD_TRACE_GIT_METADATA_ENABLED,
DD_TRACE_GLOBAL_TAGS,
DD_TRACE_GRAPHQL_ERROR_EXTENSIONS,
Expand Down Expand Up @@ -847,7 +847,6 @@ class Config {
this._setBoolean(env, 'traceEnabled', DD_TRACE_ENABLED)
this._setBoolean(env, 'experimental.enableGetRumData', DD_TRACE_EXPERIMENTAL_GET_RUM_DATA_ENABLED)
this._setString(env, 'experimental.exporter', DD_TRACE_EXPERIMENTAL_EXPORTER)
this._setBoolean(env, 'experimental.runtimeId', DD_TRACE_EXPERIMENTAL_RUNTIME_ID_ENABLED)
if (AWS_LAMBDA_FUNCTION_NAME) this._setValue(env, 'flushInterval', 0)
this._setValue(env, 'flushMinSpans', maybeInt(DD_TRACE_PARTIAL_FLUSH_MIN_SPANS))
this._envUnprocessed.flushMinSpans = DD_TRACE_PARTIAL_FLUSH_MIN_SPANS
Expand Down Expand Up @@ -928,6 +927,7 @@ class Config {
: undefined
this._setBoolean(env, 'runtimeMetrics', DD_RUNTIME_METRICS_ENABLED ||
otelSetRuntimeMetrics)
this._setBoolean(env, 'runtimeMetricsRuntimeId', DD_RUNTIME_METRICS_RUNTIME_ID_ENABLED)
this._setArray(env, 'sampler.spanSamplingRules', reformatSpanSamplingRules(coalesce(
safeJsonParse(maybeFile(DD_SPAN_SAMPLING_RULES_FILE)),
safeJsonParse(DD_SPAN_SAMPLING_RULES)
Expand Down Expand Up @@ -1075,7 +1075,7 @@ class Config {
this._setString(opts, 'env', options.env || tags.env)
this._setBoolean(opts, 'experimental.enableGetRumData', options.experimental?.enableGetRumData)
this._setString(opts, 'experimental.exporter', options.experimental?.exporter)
this._setBoolean(opts, 'experimental.runtimeId', options.experimental?.runtimeId)
this._setBoolean(opts, 'runtimeMetricsRuntimeId', options.runtimeMetricsRuntimeId)
this._setValue(opts, 'flushInterval', maybeInt(options.flushInterval))
this._optsUnprocessed.flushInterval = options.flushInterval
this._setValue(opts, 'flushMinSpans', maybeInt(options.flushMinSpans))
Expand Down Expand Up @@ -1124,6 +1124,7 @@ class Config {
}
this._setBoolean(opts, 'reportHostname', options.reportHostname)
this._setBoolean(opts, 'runtimeMetrics', options.runtimeMetrics)
this._setBoolean(opts, 'runtimeMetricsRuntimeId', options.runtimeMetricsRuntimeId)
this._setArray(opts, 'sampler.spanSamplingRules', reformatSpanSamplingRules(options.spanSamplingRules))
this._setUnit(opts, 'sampleRate', coalesce(options.sampleRate, options.ingestion.sampleRate))
const ingestion = options.ingestion || {}
Expand Down
2 changes: 1 addition & 1 deletion packages/dd-trace/src/dogstatsd.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ class DogStatsDClient {
.filter(key => {
// Skip runtime-id unless enabled as cardinality may be too high
if (key !== 'runtime-id') return true
return (config.experimental && config.experimental.runtimeId)
return config.runtimeMetricsRuntimeId
})
.forEach(key => {
// https://docs.datadoghq.com/tagging/#defining-tags
Expand Down
6 changes: 4 additions & 2 deletions packages/dd-trace/src/supported-configurations.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@
"DD_REMOTE_CONFIGURATION_ENABLED": ["A"],
"DD_RUNTIME_METRICS_ENABLED": ["A"],
"DD_RUNTIME_METRICS_FLUSH_INTERVAL": ["A"],
"DD_RUNTIME_METRICS_RUNTIME_ID_ENABLED": ["A"],
"DD_SERVICE_MAPPING": ["A"],
"DD_SERVICE": ["A"],
"DD_SITE": ["A"],
Expand Down Expand Up @@ -237,7 +238,6 @@
"DD_TRACE_EXPERIMENTAL_B3_ENABLED": ["A"],
"DD_TRACE_EXPERIMENTAL_EXPORTER": ["A"],
"DD_TRACE_EXPERIMENTAL_GET_RUM_DATA_ENABLED": ["A"],
"DD_TRACE_EXPERIMENTAL_RUNTIME_ID_ENABLED": ["A"],
"DD_TRACE_EXPERIMENTAL_SPAN_COUNTS": ["A"],
"DD_TRACE_EXPERIMENTAL_STATE_TRACKING": ["A"],
"DD_TRACE_EXPRESS_ENABLED": ["A"],
Expand Down Expand Up @@ -426,6 +426,7 @@
"DD_PROFILING_ENDPOINT_COLLECTION_ENABLED": ["DD_PROFILING_EXPERIMENTAL_ENDPOINT_COLLECTION_ENABLED"],
"DD_PROFILING_TIMELINE_ENABLED": ["DD_PROFILING_EXPERIMENTAL_TIMELINE_ENABLED"],
"DD_REMOTE_CONFIGURATION_ENABLED": ["DD_REMOTE_CONFIG_ENABLED" ],
"DD_RUNTIME_METRICS_RUNTIME_ID_ENABLED": ["DD_TRACE_EXPERIMENTAL_RUNTIME_ID_ENABLED"],
"DD_SERVICE": ["DD_SERVICE_NAME"],
"DD_TRACE_AGENT_URL": ["DD_TRACE_URL"]
},
Expand All @@ -434,6 +435,7 @@
"DD_PROFILING_EXPERIMENTAL_CPU_ENABLED": "DD_PROFILING_CPU_ENABLED",
"DD_EXPERIMENTAL_PROFILING_ENABLED": "DD_PROFILING_ENABLED",
"DD_PROFILING_EXPERIMENTAL_CODEHOTSPOTS_ENABLED": "DD_PROFILING_CODEHOTSPOTS_ENABLED",
"DD_PROFILING_EXPERIMENTAL_TIMELINE_ENABLED": "DD_PROFILING_TIMELINE_ENABLED"
"DD_PROFILING_EXPERIMENTAL_TIMELINE_ENABLED": "DD_PROFILING_TIMELINE_ENABLED",
"DD_TRACE_EXPERIMENTAL_RUNTIME_ID_ENABLED": "DD_RUNTIME_METRICS_RUNTIME_ID_ENABLED"
}
}
38 changes: 27 additions & 11 deletions packages/dd-trace/test/config.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,22 @@ describe('Config', () => {
assert.strictEqual(warning.code, 'DATADOG_DD_PROFILING_EXPERIMENTAL_ENDPOINT_COLLECTION_ENABLED')
})

it('should set new runtimeMetricsRuntimeId from deprecated DD_TRACE_EXPERIMENTAL_RUNTIME_ID_ENABLED', async () => {
process.env.DD_TRACE_EXPERIMENTAL_RUNTIME_ID_ENABLED = 'true'
assert.strictEqual(process.env.DD_RUNTIME_METRICS_RUNTIME_ID_ENABLED, undefined)
const config = new Config()
expect(config).to.have.property('runtimeMetricsRuntimeId', true)
assert.strictEqual(getEnvironmentVariable('DD_RUNTIME_METRICS_RUNTIME_ID_ENABLED'), 'true')
delete process.env.DD_TRACE_EXPERIMENTAL_RUNTIME_ID_ENABLED

const [warning] = await once(process, 'warning')
assert.strictEqual(warning.name, 'DeprecationWarning')
assert.match(
warning.message,
/variable DD_TRACE_EXPERIMENTAL_RUNTIME_ID_ENABLED .+ DD_RUNTIME_METRICS_RUNTIME_ID_ENABLED instead/
)
})

it('should pass through random envs', async () => {
process.env.FOOBAR = 'true'
const { FOOBAR } = getEnvironmentVariables()
Expand Down Expand Up @@ -261,6 +277,7 @@ describe('Config', () => {
expect(config).to.have.nested.property('crashtracking.enabled', true)
expect(config).to.have.property('sampleRate', undefined)
expect(config).to.have.property('runtimeMetrics', false)
expect(config).to.have.property('runtimeMetricsRuntimeId', false)
expect(config.tags).to.have.property('service', 'node')
expect(config).to.have.property('plugins', true)
expect(config).to.have.property('traceEnabled', true)
Expand All @@ -285,7 +302,6 @@ describe('Config', () => {
expect(config).to.have.nested.deep.property('tracePropagationStyle.inject', ['datadog', 'tracecontext', 'baggage'])
expect(config).to.have.nested.deep.property('tracePropagationStyle.extract', ['datadog', 'tracecontext', 'baggage'])
expect(config).to.have.nested.property('tracePropagationBehaviorExtract', 'continue')
expect(config).to.have.nested.property('experimental.runtimeId', false)
expect(config).to.have.nested.property('experimental.exporter', undefined)
expect(config).to.have.nested.property('experimental.enableGetRumData', false)
expect(config).to.have.nested.property('apmTracingEnabled', true)
Expand Down Expand Up @@ -371,7 +387,6 @@ describe('Config', () => {
{ name: 'env', value: undefined, origin: 'default' },
{ name: 'experimental.enableGetRumData', value: false, origin: 'default' },
{ name: 'experimental.exporter', value: undefined, origin: 'default' },
{ name: 'experimental.runtimeId', value: false, origin: 'default' },
{ name: 'flushInterval', value: 2000, origin: 'default' },
{ name: 'flushMinSpans', value: 1000, origin: 'default' },
{ name: 'gitMetadataEnabled', value: true, origin: 'default' },
Expand Down Expand Up @@ -428,6 +443,7 @@ describe('Config', () => {
{ name: 'reportHostname', value: false, origin: 'default' },
{ name: 'reportHostname', value: false, origin: 'default' },
{ name: 'runtimeMetrics', value: false, origin: 'default' },
{ name: 'runtimeMetricsRuntimeId', value: false, origin: 'default' },
{ name: 'sampleRate', value: undefined, origin: 'default' },
{ name: 'sampler.rateLimit', value: 100, origin: 'default' },
{ name: 'traceEnabled', value: true, origin: 'default' },
Expand Down Expand Up @@ -536,7 +552,7 @@ describe('Config', () => {
process.env.DD_TRACE_PROPAGATION_STYLE_INJECT = 'b3,tracecontext'
process.env.DD_TRACE_PROPAGATION_STYLE_EXTRACT = 'b3,tracecontext'
process.env.DD_TRACE_PROPAGATION_BEHAVIOR_EXTRACT = 'restart'
process.env.DD_TRACE_EXPERIMENTAL_RUNTIME_ID_ENABLED = 'true'
process.env.DD_RUNTIME_METRICS_RUNTIME_ID_ENABLED = 'true'
process.env.DD_TRACE_EXPERIMENTAL_EXPORTER = 'log'
process.env.DD_TRACE_EXPERIMENTAL_GET_RUM_DATA_ENABLED = 'true'
process.env.DD_TRACE_EXPERIMENTAL_INTERNAL_ERRORS_ENABLED = 'true'
Expand Down Expand Up @@ -619,6 +635,7 @@ describe('Config', () => {
expect(config.grpc.server.error.statuses).to.deep.equal([3, 13, 400, 401, 402, 403])
expect(config).to.have.property('middlewareTracingEnabled', false)
expect(config).to.have.property('runtimeMetrics', true)
expect(config).to.have.property('runtimeMetricsRuntimeId', true)
expect(config).to.have.property('reportHostname', true)
expect(config).to.have.nested.property('codeOriginForSpans.enabled', false)
expect(config).to.have.nested.property('codeOriginForSpans.experimental.exit_spans.enabled', true)
Expand Down Expand Up @@ -663,7 +680,6 @@ describe('Config', () => {
expect(config).to.have.nested.deep.property('tracePropagationStyle.inject', ['b3', 'tracecontext'])
expect(config).to.have.nested.deep.property('tracePropagationStyle.extract', ['b3', 'tracecontext'])
expect(config).to.have.nested.property('tracePropagationBehaviorExtract', 'restart')
expect(config).to.have.nested.property('experimental.runtimeId', true)
expect(config).to.have.nested.property('experimental.exporter', 'log')
expect(config).to.have.nested.property('experimental.enableGetRumData', true)
expect(config).to.have.nested.property('apmTracingEnabled', false)
Expand Down Expand Up @@ -746,7 +762,7 @@ describe('Config', () => {
{ name: 'env', value: 'test', origin: 'env_var' },
{ name: 'experimental.enableGetRumData', value: true, origin: 'env_var' },
{ name: 'experimental.exporter', value: 'log', origin: 'env_var' },
{ name: 'experimental.runtimeId', value: true, origin: 'env_var' },
{ name: 'runtimeMetricsRuntimeId', value: true, origin: 'env_var' },
{ name: 'hostname', value: 'agent', origin: 'env_var' },
{ name: 'iast.dbRowsToTaint', value: 2, origin: 'env_var' },
{ name: 'iast.deduplicationEnabled', value: false, origin: 'env_var' },
Expand Down Expand Up @@ -987,6 +1003,7 @@ describe('Config', () => {
flushMinSpans: 500,
middlewareTracingEnabled: false,
runtimeMetrics: true,
runtimeMetricsRuntimeId: true,
reportHostname: true,
plugins: false,
logLevel,
Expand All @@ -1002,7 +1019,6 @@ describe('Config', () => {
experimental: {
b3: true,
traceparent: true,
runtimeId: true,
exporter: 'log',
enableGetRumData: true,
iast: {
Expand Down Expand Up @@ -1059,6 +1075,7 @@ describe('Config', () => {
expect(config).to.have.property('flushMinSpans', 500)
expect(config).to.have.property('middlewareTracingEnabled', false)
expect(config).to.have.property('runtimeMetrics', true)
expect(config).to.have.property('runtimeMetricsRuntimeId', true)
expect(config).to.have.property('reportHostname', true)
expect(config).to.have.property('plugins', false)
expect(config).to.have.property('logLevel', logLevel)
Expand All @@ -1075,7 +1092,6 @@ describe('Config', () => {
expect(config.tags['runtime-id']).to.match(/^[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}$/)
expect(config).to.have.nested.deep.property('tracePropagationStyle.inject', ['datadog'])
expect(config).to.have.nested.deep.property('tracePropagationStyle.extract', ['datadog'])
expect(config).to.have.nested.property('experimental.runtimeId', true)
expect(config).to.have.nested.property('experimental.exporter', 'log')
expect(config).to.have.nested.property('experimental.enableGetRumData', true)
expect(config).to.have.nested.property('appsec.enabled', false)
Expand Down Expand Up @@ -1132,7 +1148,7 @@ describe('Config', () => {
{ name: 'env', value: 'test', origin: 'code' },
{ name: 'experimental.enableGetRumData', value: true, origin: 'code' },
{ name: 'experimental.exporter', value: 'log', origin: 'code' },
{ name: 'experimental.runtimeId', value: true, origin: 'code' },
{ name: 'runtimeMetricsRuntimeId', value: true, origin: 'code' },
{ name: 'flushInterval', value: 5000, origin: 'code' },
{ name: 'flushMinSpans', value: 500, origin: 'code' },
{ name: 'hostname', value: 'agent', origin: 'code' },
Expand Down Expand Up @@ -1351,7 +1367,7 @@ describe('Config', () => {
process.env.DD_TRACE_PROPAGATION_STYLE_INJECT = 'datadog'
process.env.DD_TRACE_PROPAGATION_STYLE_EXTRACT = 'datadog'
process.env.DD_TRACE_PROPAGATION_BEHAVIOR_EXTRACT = 'restart'
process.env.DD_TRACE_EXPERIMENTAL_RUNTIME_ID_ENABLED = 'true'
process.env.DD_RUNTIME_METRICS_RUNTIME_ID_ENABLED = 'true'
process.env.DD_TRACE_EXPERIMENTAL_EXPORTER = 'log'
process.env.DD_TRACE_EXPERIMENTAL_GET_RUM_DATA_ENABLED = 'true'
process.env.DD_TRACE_MIDDLEWARE_TRACING_ENABLED = 'false'
Expand Down Expand Up @@ -1398,6 +1414,7 @@ describe('Config', () => {
port: 8888
},
runtimeMetrics: false,
runtimeMetricsRuntimeId: false,
reportHostname: false,
flushMinSpans: 500,
service: 'test',
Expand Down Expand Up @@ -1430,7 +1447,6 @@ describe('Config', () => {
experimental: {
b3: false,
traceparent: false,
runtimeId: false,
exporter: 'agent',
enableGetRumData: false
},
Expand Down Expand Up @@ -1504,6 +1520,7 @@ describe('Config', () => {
expect(config).to.have.property('site', 'datadoghq.com')
expect(config).to.have.property('middlewareTracingEnabled', true)
expect(config).to.have.property('runtimeMetrics', false)
expect(config).to.have.property('runtimeMetricsRuntimeId', false)
expect(config).to.have.property('reportHostname', false)
expect(config).to.have.property('flushMinSpans', 500)
expect(config).to.have.property('service', 'test')
Expand All @@ -1527,7 +1544,6 @@ describe('Config', () => {
expect(config).to.have.deep.property('peerServiceMapping', { d: 'dd' })
expect(config).to.have.nested.deep.property('tracePropagationStyle.inject', [])
expect(config).to.have.nested.deep.property('tracePropagationStyle.extract', [])
expect(config).to.have.nested.property('experimental.runtimeId', false)
expect(config).to.have.nested.property('experimental.exporter', 'agent')
expect(config).to.have.nested.property('experimental.enableGetRumData', false)
expect(config).to.have.nested.property('apmTracingEnabled', true)
Expand Down