Skip to content

Commit d9bf5c5

Browse files
stanistanrochdev
authored andcommitted
feat(telemetry): adding instrumentation_config_id (#4283)
* feat(telemetry): adding instrumentation_config_id Similar to DataDog/dd-trace-py#8783
1 parent fd47727 commit d9bf5c5

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

packages/dd-trace/src/config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,7 @@ class Config {
517517
this._setValue(defaults, 'tracing', true)
518518
this._setValue(defaults, 'url', undefined)
519519
this._setValue(defaults, 'version', pkg.version)
520+
this._setValue(defaults, 'instrumentation_config_id', undefined)
520521
}
521522

522523
_applyEnvironment () {
@@ -549,6 +550,7 @@ class Config {
549550
DD_IAST_REQUEST_SAMPLING,
550551
DD_IAST_TELEMETRY_VERBOSITY,
551552
DD_INSTRUMENTATION_TELEMETRY_ENABLED,
553+
DD_INSTRUMENTATION_CONFIG_ID,
552554
DD_LOGS_INJECTION,
553555
DD_OPENAI_LOGS_ENABLED,
554556
DD_OPENAI_SPAN_CHAR_LIMIT,
@@ -699,6 +701,7 @@ class Config {
699701
DD_INSTRUMENTATION_TELEMETRY_ENABLED, // to comply with instrumentation telemetry specs
700702
!(this._isInServerlessEnvironment() || JEST_WORKER_ID)
701703
))
704+
this._setString(env, 'instrumentation_config_id', DD_INSTRUMENTATION_CONFIG_ID)
702705
this._setBoolean(env, 'telemetry.debug', DD_TELEMETRY_DEBUG)
703706
this._setBoolean(env, 'telemetry.dependencyCollection', DD_TELEMETRY_DEPENDENCY_COLLECTION_ENABLED)
704707
this._setValue(env, 'telemetry.heartbeatInterval', maybeInt(Math.floor(DD_TELEMETRY_HEARTBEAT_INTERVAL * 1000)))

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ describe('Config', () => {
199199
expect(config).to.have.property('spanAttributeSchema', 'v0')
200200
expect(config).to.have.property('spanComputePeerService', false)
201201
expect(config).to.have.property('spanRemoveIntegrationFromService', false)
202+
expect(config).to.have.property('instrumentation_config_id', undefined)
202203
expect(config).to.have.deep.property('serviceMapping', {})
203204
expect(config).to.have.nested.deep.property('tracePropagationStyle.inject', ['datadog', 'tracecontext'])
204205
expect(config).to.have.nested.deep.property('tracePropagationStyle.extract', ['datadog', 'tracecontext'])
@@ -439,6 +440,7 @@ describe('Config', () => {
439440
process.env.DD_INSTRUMENTATION_INSTALL_ID = '68e75c48-57ca-4a12-adfc-575c4b05fcbe'
440441
process.env.DD_INSTRUMENTATION_INSTALL_TYPE = 'k8s_single_step'
441442
process.env.DD_INSTRUMENTATION_INSTALL_TIME = '1703188212'
443+
process.env.DD_INSTRUMENTATION_CONFIG_ID = 'abcdef123'
442444

443445
const config = new Config()
444446

@@ -462,6 +464,7 @@ describe('Config', () => {
462464
expect(config).to.have.property('spanAttributeSchema', 'v1')
463465
expect(config).to.have.property('spanRemoveIntegrationFromService', true)
464466
expect(config).to.have.property('spanComputePeerService', true)
467+
expect(config).to.have.property('instrumentation_config_id', 'abcdef123')
465468
expect(config.tags).to.include({ foo: 'bar', baz: 'qux' })
466469
expect(config.tags).to.include({ service: 'service', version: '1.0.0', env: 'test' })
467470
expect(config).to.have.deep.nested.property('sampler', {
@@ -554,6 +557,7 @@ describe('Config', () => {
554557
{ name: 'iast.redactionValuePattern', value: 'REDACTION_VALUE_PATTERN', origin: 'env_var' },
555558
{ name: 'iast.requestSampling', value: 40, origin: 'env_var' },
556559
{ name: 'iast.telemetryVerbosity', value: 'DEBUG', origin: 'env_var' },
560+
{ name: 'instrumentation_config_id', value: 'abcdef123', origin: 'env_var' },
557561
{ name: 'isGCPFunction', value: false, origin: 'env_var' },
558562
{ name: 'peerServiceMapping', value: { c: 'cc', d: 'dd' }, origin: 'env_var' },
559563
{ name: 'port', value: '6218', origin: 'env_var' },

0 commit comments

Comments
 (0)