Skip to content

Commit 6e5d2e8

Browse files
authored
[DI] Add namespace to all DI related config options (#5077)
This affects all DI related config options, where the `experimental` namespace is removed and, and a `dynamicInstrumentation` namespace is introduced. Changes: - `experimental.dynamicInstrumentationEnabled` -> `dynamicInstrumentation.enabled` - `experimental.dynamicInstrumentationRedactedIdentifiers` -> `dynamicInstrumentation.redactedIdentifiers` - `experimental.dynamicInstrumentationRedactionExcludedIdentifiers` -> `dynamicInstrumentation.redactionExcludedIdentifiers`
1 parent 98e733f commit 6e5d2e8

8 files changed

Lines changed: 55 additions & 45 deletions

File tree

packages/dd-trace/src/config.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -472,9 +472,9 @@ class Config {
472472
this._setValue(defaults, 'dogstatsd.hostname', '127.0.0.1')
473473
this._setValue(defaults, 'dogstatsd.port', '8125')
474474
this._setValue(defaults, 'dsmEnabled', false)
475-
this._setValue(defaults, 'dynamicInstrumentationEnabled', false)
476-
this._setValue(defaults, 'dynamicInstrumentationRedactedIdentifiers', [])
477-
this._setValue(defaults, 'dynamicInstrumentationRedactionExcludedIdentifiers', [])
475+
this._setValue(defaults, 'dynamicInstrumentation.enabled', false)
476+
this._setValue(defaults, 'dynamicInstrumentation.redactedIdentifiers', [])
477+
this._setValue(defaults, 'dynamicInstrumentation.redactionExcludedIdentifiers', [])
478478
this._setValue(defaults, 'env', undefined)
479479
this._setValue(defaults, 'experimental.enableGetRumData', false)
480480
this._setValue(defaults, 'experimental.exporter', undefined)
@@ -750,11 +750,11 @@ class Config {
750750
this._setString(env, 'dogstatsd.hostname', DD_DOGSTATSD_HOST || DD_DOGSTATSD_HOSTNAME)
751751
this._setString(env, 'dogstatsd.port', DD_DOGSTATSD_PORT)
752752
this._setBoolean(env, 'dsmEnabled', DD_DATA_STREAMS_ENABLED)
753-
this._setBoolean(env, 'dynamicInstrumentationEnabled', DD_DYNAMIC_INSTRUMENTATION_ENABLED)
754-
this._setArray(env, 'dynamicInstrumentationRedactedIdentifiers', DD_DYNAMIC_INSTRUMENTATION_REDACTED_IDENTIFIERS)
753+
this._setBoolean(env, 'dynamicInstrumentation.enabled', DD_DYNAMIC_INSTRUMENTATION_ENABLED)
754+
this._setArray(env, 'dynamicInstrumentation.redactedIdentifiers', DD_DYNAMIC_INSTRUMENTATION_REDACTED_IDENTIFIERS)
755755
this._setArray(
756756
env,
757-
'dynamicInstrumentationRedactionExcludedIdentifiers',
757+
'dynamicInstrumentation.redactionExcludedIdentifiers',
758758
DD_DYNAMIC_INSTRUMENTATION_REDACTION_EXCLUDED_IDENTIFIERS
759759
)
760760
this._setString(env, 'env', DD_ENV || tags.env)
@@ -936,16 +936,16 @@ class Config {
936936
this._setString(opts, 'dogstatsd.port', options.dogstatsd.port)
937937
}
938938
this._setBoolean(opts, 'dsmEnabled', options.dsmEnabled)
939-
this._setBoolean(opts, 'dynamicInstrumentationEnabled', options.experimental?.dynamicInstrumentationEnabled)
939+
this._setBoolean(opts, 'dynamicInstrumentation.enabled', options.dynamicInstrumentation?.enabled)
940940
this._setArray(
941941
opts,
942-
'dynamicInstrumentationRedactedIdentifiers',
943-
options.experimental?.dynamicInstrumentationRedactedIdentifiers
942+
'dynamicInstrumentation.redactedIdentifiers',
943+
options.dynamicInstrumentation?.redactedIdentifiers
944944
)
945945
this._setArray(
946946
opts,
947-
'dynamicInstrumentationRedactionExcludedIdentifiers',
948-
options.experimental?.dynamicInstrumentationRedactionExcludedIdentifiers
947+
'dynamicInstrumentation.redactionExcludedIdentifiers',
948+
options.dynamicInstrumentation?.redactionExcludedIdentifiers
949949
)
950950
this._setString(opts, 'env', options.env || tags.env)
951951
this._setBoolean(opts, 'experimental.enableGetRumData', options.experimental?.enableGetRumData)

packages/dd-trace/src/debugger/devtools_client/config.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ const { format } = require('node:url')
55
const log = require('../../log')
66

77
const config = module.exports = {
8-
dynamicInstrumentationRedactedIdentifiers: parentConfig.dynamicInstrumentationRedactedIdentifiers,
9-
dynamicInstrumentationRedactionExcludedIdentifiers: parentConfig.dynamicInstrumentationRedactionExcludedIdentifiers,
8+
dynamicInstrumentation: parentConfig.dynamicInstrumentation,
109
runtimeId: parentConfig.tags['runtime-id'],
1110
service: parentConfig.service,
1211
commitSHA: parentConfig.commitSHA,

packages/dd-trace/src/debugger/devtools_client/snapshot/redaction.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
const config = require('../config')
44

5-
const excludedIdentifiers = config.dynamicInstrumentationRedactionExcludedIdentifiers.map((name) => normalizeName(name))
5+
const excludedIdentifiers = config.dynamicInstrumentation.redactionExcludedIdentifiers
6+
.map((name) => normalizeName(name))
67

78
const REDACTED_IDENTIFIERS = new Set(
89
[
@@ -99,7 +100,7 @@ const REDACTED_IDENTIFIERS = new Set(
99100
'x_forwarded_for',
100101
'x_real_ip',
101102
'XSRF-TOKEN',
102-
...config.dynamicInstrumentationRedactedIdentifiers
103+
...config.dynamicInstrumentation.redactedIdentifiers
103104
]
104105
.map((name) => normalizeName(name))
105106
.filter((name) => excludedIdentifiers.includes(name) === false)

packages/dd-trace/src/proxy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ class Tracer extends NoopProxy {
119119
this._flare.module.send(conf.args)
120120
})
121121

122-
if (config.dynamicInstrumentationEnabled) {
122+
if (config.dynamicInstrumentation.enabled) {
123123
DynamicInstrumentation.start(config, rc)
124124
}
125125
}

packages/dd-trace/test/config.spec.js

Lines changed: 31 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -231,9 +231,9 @@ describe('Config', () => {
231231
expect(config).to.have.property('scope', undefined)
232232
expect(config).to.have.property('logLevel', 'debug')
233233
expect(config).to.have.nested.property('codeOriginForSpans.enabled', false)
234-
expect(config).to.have.property('dynamicInstrumentationEnabled', false)
235-
expect(config).to.have.deep.property('dynamicInstrumentationRedactedIdentifiers', [])
236-
expect(config).to.have.deep.property('dynamicInstrumentationRedactionExcludedIdentifiers', [])
234+
expect(config).to.have.nested.property('dynamicInstrumentation.enabled', false)
235+
expect(config).to.have.nested.deep.property('dynamicInstrumentation.redactedIdentifiers', [])
236+
expect(config).to.have.nested.deep.property('dynamicInstrumentation.redactionExcludedIdentifiers', [])
237237
expect(config).to.have.property('traceId128BitGenerationEnabled', true)
238238
expect(config).to.have.property('traceId128BitLoggingEnabled', false)
239239
expect(config).to.have.property('spanAttributeSchema', 'v0')
@@ -315,9 +315,9 @@ describe('Config', () => {
315315
{ name: 'dogstatsd.hostname', value: '127.0.0.1', origin: 'calculated' },
316316
{ name: 'dogstatsd.port', value: '8125', origin: 'default' },
317317
{ name: 'dsmEnabled', value: false, origin: 'default' },
318-
{ name: 'dynamicInstrumentationEnabled', value: false, origin: 'default' },
319-
{ name: 'dynamicInstrumentationRedactedIdentifiers', value: [], origin: 'default' },
320-
{ name: 'dynamicInstrumentationRedactionExcludedIdentifiers', value: [], origin: 'default' },
318+
{ name: 'dynamicInstrumentation.enabled', value: false, origin: 'default' },
319+
{ name: 'dynamicInstrumentation.redactedIdentifiers', value: [], origin: 'default' },
320+
{ name: 'dynamicInstrumentation.redactionExcludedIdentifiers', value: [], origin: 'default' },
321321
{ name: 'env', value: undefined, origin: 'default' },
322322
{ name: 'experimental.enableGetRumData', value: false, origin: 'default' },
323323
{ name: 'experimental.exporter', value: undefined, origin: 'default' },
@@ -557,9 +557,9 @@ describe('Config', () => {
557557
expect(config).to.have.property('runtimeMetrics', true)
558558
expect(config).to.have.property('reportHostname', true)
559559
expect(config).to.have.nested.property('codeOriginForSpans.enabled', true)
560-
expect(config).to.have.property('dynamicInstrumentationEnabled', true)
561-
expect(config).to.have.deep.property('dynamicInstrumentationRedactedIdentifiers', ['foo', 'bar'])
562-
expect(config).to.have.deep.property('dynamicInstrumentationRedactionExcludedIdentifiers', ['a', 'b', 'c'])
560+
expect(config).to.have.nested.property('dynamicInstrumentation.enabled', true)
561+
expect(config).to.have.nested.deep.property('dynamicInstrumentation.redactedIdentifiers', ['foo', 'bar'])
562+
expect(config).to.have.nested.deep.property('dynamicInstrumentation.redactionExcludedIdentifiers', ['a', 'b', 'c'])
563563
expect(config).to.have.property('env', 'test')
564564
expect(config).to.have.property('sampleRate', 0.5)
565565
expect(config).to.have.property('traceEnabled', true)
@@ -663,9 +663,9 @@ describe('Config', () => {
663663
{ name: 'codeOriginForSpans.enabled', value: true, origin: 'env_var' },
664664
{ name: 'dogstatsd.hostname', value: 'dsd-agent', origin: 'env_var' },
665665
{ name: 'dogstatsd.port', value: '5218', origin: 'env_var' },
666-
{ name: 'dynamicInstrumentationEnabled', value: true, origin: 'env_var' },
667-
{ name: 'dynamicInstrumentationRedactedIdentifiers', value: ['foo', 'bar'], origin: 'env_var' },
668-
{ name: 'dynamicInstrumentationRedactionExcludedIdentifiers', value: ['a', 'b', 'c'], origin: 'env_var' },
666+
{ name: 'dynamicInstrumentation.enabled', value: true, origin: 'env_var' },
667+
{ name: 'dynamicInstrumentation.redactedIdentifiers', value: ['foo', 'bar'], origin: 'env_var' },
668+
{ name: 'dynamicInstrumentation.redactionExcludedIdentifiers', value: ['a', 'b', 'c'], origin: 'env_var' },
669669
{ name: 'env', value: 'test', origin: 'env_var' },
670670
{ name: 'experimental.enableGetRumData', value: true, origin: 'env_var' },
671671
{ name: 'experimental.exporter', value: 'log', origin: 'env_var' },
@@ -858,11 +858,13 @@ describe('Config', () => {
858858
inject: ['datadog'],
859859
extract: ['datadog']
860860
},
861+
dynamicInstrumentation: {
862+
enabled: true,
863+
redactedIdentifiers: ['foo', 'bar'],
864+
redactionExcludedIdentifiers: ['a', 'b', 'c']
865+
},
861866
experimental: {
862867
b3: true,
863-
dynamicInstrumentationEnabled: true,
864-
dynamicInstrumentationRedactedIdentifiers: ['foo', 'bar'],
865-
dynamicInstrumentationRedactionExcludedIdentifiers: ['a', 'b', 'c'],
866868
traceparent: true,
867869
runtimeId: true,
868870
exporter: 'log',
@@ -907,9 +909,9 @@ describe('Config', () => {
907909
expect(config).to.have.nested.property('dogstatsd.port', '5218')
908910
expect(config).to.have.property('service', 'service')
909911
expect(config).to.have.property('version', '0.1.0')
910-
expect(config).to.have.property('dynamicInstrumentationEnabled', true)
911-
expect(config).to.have.deep.property('dynamicInstrumentationRedactedIdentifiers', ['foo', 'bar'])
912-
expect(config).to.have.deep.property('dynamicInstrumentationRedactionExcludedIdentifiers', ['a', 'b', 'c'])
912+
expect(config).to.have.nested.property('dynamicInstrumentation.enabled', true)
913+
expect(config).to.have.nested.deep.property('dynamicInstrumentation.redactedIdentifiers', ['foo', 'bar'])
914+
expect(config).to.have.nested.deep.property('dynamicInstrumentation.redactionExcludedIdentifiers', ['a', 'b', 'c'])
913915
expect(config).to.have.property('env', 'test')
914916
expect(config).to.have.property('sampleRate', 0.5)
915917
expect(config).to.have.property('logger', logger)
@@ -987,9 +989,9 @@ describe('Config', () => {
987989
{ name: 'codeOriginForSpans.enabled', value: false, origin: 'code' },
988990
{ name: 'dogstatsd.hostname', value: 'agent-dsd', origin: 'code' },
989991
{ name: 'dogstatsd.port', value: '5218', origin: 'code' },
990-
{ name: 'dynamicInstrumentationEnabled', value: true, origin: 'code' },
991-
{ name: 'dynamicInstrumentationRedactedIdentifiers', value: ['foo', 'bar'], origin: 'code' },
992-
{ name: 'dynamicInstrumentationRedactionExcludedIdentifiers', value: ['a', 'b', 'c'], origin: 'code' },
992+
{ name: 'dynamicInstrumentation.enabled', value: true, origin: 'code' },
993+
{ name: 'dynamicInstrumentation.redactedIdentifiers', value: ['foo', 'bar'], origin: 'code' },
994+
{ name: 'dynamicInstrumentation.redactionExcludedIdentifiers', value: ['a', 'b', 'c'], origin: 'code' },
993995
{ name: 'env', value: 'test', origin: 'code' },
994996
{ name: 'experimental.enableGetRumData', value: true, origin: 'code' },
995997
{ name: 'experimental.exporter', value: 'log', origin: 'code' },
@@ -1268,11 +1270,13 @@ describe('Config', () => {
12681270
inject: [],
12691271
extract: []
12701272
},
1273+
dynamicInstrumentation: {
1274+
enabled: false,
1275+
redactedIdentifiers: ['foo2', 'bar2'],
1276+
redactionExcludedIdentifiers: ['a2', 'b2']
1277+
},
12711278
experimental: {
12721279
b3: false,
1273-
dynamicInstrumentationEnabled: false,
1274-
dynamicInstrumentationRedactedIdentifiers: ['foo2', 'bar2'],
1275-
dynamicInstrumentationRedactionExcludedIdentifiers: ['a2', 'b2'],
12761280
traceparent: false,
12771281
runtimeId: false,
12781282
exporter: 'agent',
@@ -1337,9 +1341,9 @@ describe('Config', () => {
13371341
expect(config).to.have.property('service', 'test')
13381342
expect(config).to.have.property('version', '1.0.0')
13391343
expect(config).to.have.nested.property('codeOriginForSpans.enabled', false)
1340-
expect(config).to.have.property('dynamicInstrumentationEnabled', false)
1341-
expect(config).to.have.deep.property('dynamicInstrumentationRedactedIdentifiers', ['foo2', 'bar2'])
1342-
expect(config).to.have.deep.property('dynamicInstrumentationRedactionExcludedIdentifiers', ['a2', 'b2'])
1344+
expect(config).to.have.nested.property('dynamicInstrumentation.enabled', false)
1345+
expect(config).to.have.nested.deep.property('dynamicInstrumentation.redactedIdentifiers', ['foo2', 'bar2'])
1346+
expect(config).to.have.nested.deep.property('dynamicInstrumentation.redactionExcludedIdentifiers', ['a2', 'b2'])
13431347
expect(config).to.have.property('env', 'development')
13441348
expect(config).to.have.property('clientIpEnabled', true)
13451349
expect(config).to.have.property('clientIpHeader', 'x-true-client-ip')

packages/dd-trace/test/debugger/devtools_client/snapshot/utils.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@ proxyquire('../src/debugger/devtools_client/snapshot/collector', {
1212
})
1313
proxyquire('../src/debugger/devtools_client/snapshot/redaction', {
1414
'../config': {
15-
dynamicInstrumentationRedactedIdentifiers: [],
16-
dynamicInstrumentationRedactionExcludedIdentifiers: [],
15+
dynamicInstrumentation: {
16+
redactedIdentifiers: [],
17+
redactionExcludedIdentifiers: []
18+
},
1719
'@noCallThru': true
1820
}
1921
})

packages/dd-trace/test/fixtures/telemetry/config_norm_rules.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,9 @@
456456
"dynamicInstrumentationEnabled": "dynamic_instrumentation_enabled",
457457
"dynamicInstrumentationRedactedIdentifiers": "dynamic_instrumentation_redacted_identifiers",
458458
"dynamicInstrumentationRedactionExcludedIdentifiers": "dynamic_instrumentation_redaction_excluded_indentifiers",
459+
"dynamicInstrumentation.enabled": "dynamic_instrumentation_enabled",
460+
"dynamicInstrumentation.redactedIdentifiers": "dynamic_instrumentation_redacted_identifiers",
461+
"dynamicInstrumentation.redactionExcludedIdentifiers": "dynamic_instrumentation_redaction_excluded_indentifiers",
459462
"dynamic_instrumentation.enabled": "dynamic_instrumentation_enabled",
460463
"dynamic_instrumentation.redacted_identifiers": "dynamic_instrumentation_redacted_identifiers",
461464
"dynamic_instrumentation.redacted_types": "dynamic_instrumentation_redacted_types",

packages/dd-trace/test/proxy.spec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ describe('TracerProxy', () => {
129129
appsec: {},
130130
iast: {},
131131
crashtracking: {},
132+
dynamicInstrumentation: {},
132133
remoteConfig: {
133134
enabled: true
134135
},

0 commit comments

Comments
 (0)