diff --git a/packages/dd-trace/src/config.js b/packages/dd-trace/src/config.js index 3ede7741405..198f546afd3 100644 --- a/packages/dd-trace/src/config.js +++ b/packages/dd-trace/src/config.js @@ -517,6 +517,7 @@ class Config { this._setValue(defaults, 'tracing', true) this._setValue(defaults, 'url', undefined) this._setValue(defaults, 'version', pkg.version) + this._setValue(defaults, 'instrumentation_config_id', undefined) } _applyEnvironment () { @@ -549,6 +550,7 @@ class Config { DD_IAST_REQUEST_SAMPLING, DD_IAST_TELEMETRY_VERBOSITY, DD_INSTRUMENTATION_TELEMETRY_ENABLED, + DD_INSTRUMENTATION_CONFIG_ID, DD_LOGS_INJECTION, DD_OPENAI_LOGS_ENABLED, DD_OPENAI_SPAN_CHAR_LIMIT, @@ -699,6 +701,7 @@ class Config { DD_INSTRUMENTATION_TELEMETRY_ENABLED, // to comply with instrumentation telemetry specs !(this._isInServerlessEnvironment() || JEST_WORKER_ID) )) + this._setString(env, 'instrumentation_config_id', DD_INSTRUMENTATION_CONFIG_ID) this._setBoolean(env, 'telemetry.debug', DD_TELEMETRY_DEBUG) this._setBoolean(env, 'telemetry.dependencyCollection', DD_TELEMETRY_DEPENDENCY_COLLECTION_ENABLED) this._setValue(env, 'telemetry.heartbeatInterval', maybeInt(Math.floor(DD_TELEMETRY_HEARTBEAT_INTERVAL * 1000))) diff --git a/packages/dd-trace/test/config.spec.js b/packages/dd-trace/test/config.spec.js index cfc50ca7cb8..69bae6a4ec5 100644 --- a/packages/dd-trace/test/config.spec.js +++ b/packages/dd-trace/test/config.spec.js @@ -199,6 +199,7 @@ describe('Config', () => { expect(config).to.have.property('spanAttributeSchema', 'v0') expect(config).to.have.property('spanComputePeerService', false) expect(config).to.have.property('spanRemoveIntegrationFromService', false) + expect(config).to.have.property('instrumentation_config_id', undefined) expect(config).to.have.deep.property('serviceMapping', {}) expect(config).to.have.nested.deep.property('tracePropagationStyle.inject', ['datadog', 'tracecontext']) expect(config).to.have.nested.deep.property('tracePropagationStyle.extract', ['datadog', 'tracecontext']) @@ -439,6 +440,7 @@ describe('Config', () => { process.env.DD_INSTRUMENTATION_INSTALL_ID = '68e75c48-57ca-4a12-adfc-575c4b05fcbe' process.env.DD_INSTRUMENTATION_INSTALL_TYPE = 'k8s_single_step' process.env.DD_INSTRUMENTATION_INSTALL_TIME = '1703188212' + process.env.DD_INSTRUMENTATION_CONFIG_ID = 'abcdef123' const config = new Config() @@ -462,6 +464,7 @@ describe('Config', () => { expect(config).to.have.property('spanAttributeSchema', 'v1') expect(config).to.have.property('spanRemoveIntegrationFromService', true) expect(config).to.have.property('spanComputePeerService', true) + expect(config).to.have.property('instrumentation_config_id', 'abcdef123') expect(config.tags).to.include({ foo: 'bar', baz: 'qux' }) expect(config.tags).to.include({ service: 'service', version: '1.0.0', env: 'test' }) expect(config).to.have.deep.nested.property('sampler', { @@ -554,6 +557,7 @@ describe('Config', () => { { name: 'iast.redactionValuePattern', value: 'REDACTION_VALUE_PATTERN', origin: 'env_var' }, { name: 'iast.requestSampling', value: 40, origin: 'env_var' }, { name: 'iast.telemetryVerbosity', value: 'DEBUG', origin: 'env_var' }, + { name: 'instrumentation_config_id', value: 'abcdef123', origin: 'env_var' }, { name: 'isGCPFunction', value: false, origin: 'env_var' }, { name: 'peerServiceMapping', value: { c: 'cc', d: 'dd' }, origin: 'env_var' }, { name: 'port', value: '6218', origin: 'env_var' },