Skip to content

Commit a58f500

Browse files
authored
fix: removed deprecated config options for disabling tracing (#2145)
BREAKING CHANGE: The following environment variables and configuration options, previously used to disable tracing, have been removed: - INSTANA_DISABLED_TRACERS - INSTANA_DISABLE_TRACING - tracing.disabledTracers Migration Recommendations: Replace INSTANA_DISABLED_TRACERS and INSTANA_DISABLE_TRACING with INSTANA_TRACING_DISABLE. Replace tracing.disabledTracers with tracing.disable.
1 parent d50a76f commit a58f500

File tree

6 files changed

+2
-253
lines changed

6 files changed

+2
-253
lines changed

packages/aws-lambda/test/integration_test/test_definition.js

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1039,42 +1039,6 @@ function registerTests(handlerDefinitionPath, reduced) {
10391039
});
10401040
});
10411041

1042-
describeOrSkipIfReduced()('when deprecated INSTANA_DISABLE_TRACING is set', function () {
1043-
// - INSTANA_ENDPOINT_URL is missing
1044-
// - lambda function ends with success
1045-
const env = prelude.bind(this)({
1046-
handlerDefinitionPath,
1047-
instanaAgentKey,
1048-
instanaTracingDisabled: true
1049-
});
1050-
1051-
let control;
1052-
1053-
before(async () => {
1054-
control = new Control({
1055-
faasRuntimePath: path.join(__dirname, '../runtime_mock'),
1056-
handlerDefinitionPath,
1057-
startBackend: true,
1058-
env
1059-
});
1060-
1061-
await control.start();
1062-
});
1063-
1064-
beforeEach(async () => {
1065-
await control.reset();
1066-
await control.resetBackendSpansAndMetrics();
1067-
});
1068-
1069-
after(async () => {
1070-
await control.stop();
1071-
});
1072-
1073-
it('expect no tracing data', () => {
1074-
return verify(control, { error: false, expectMetrics: false, expectSpans: false });
1075-
});
1076-
});
1077-
10781042
describeOrSkipIfReduced()('when INSTANA_TRACING_DISABLE is set', function () {
10791043
// - INSTANA_ENDPOINT_URL is missing
10801044
// - lambda function ends with success

packages/core/src/config/configNormalizers/disable.js

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,11 @@ exports.init = function init(_config) {
1616
};
1717

1818
/**
19-
* Handles deprecated properties, environment variables, and array inputs.
19+
* Handles environment variables, and array inputs.
2020
*
2121
* Precedence order (highest to lowest):
2222
* 1. `tracing.disable`
23-
* 2. `tracing.disabledTracers` (deprecated)
24-
* 3. Environment variables (`INSTANA_TRACING_DISABLE*`)
23+
* 2. Environment variables (`INSTANA_TRACING_DISABLE*`)
2524
*
2625
* @param {import('../../config').InstanaConfig} config
2726
*/
@@ -40,17 +39,6 @@ exports.normalize = function normalize(config) {
4039
`Tracing selectively disabled as per "tracing.disable" configuration: ${JSON.stringify(config.tracing.disable)}`
4140
);
4241
}
43-
// Handle deprecated `disabledTracers` config
44-
if (config.tracing.disabledTracers) {
45-
logger?.warn(
46-
'The configuration property "tracing.disabledTracers" is deprecated and will be removed in the next ' +
47-
'major release. Please use "tracing.disable" instead.'
48-
);
49-
if (!hasDisableConfig) {
50-
config.tracing.disable = { instrumentations: config.tracing.disabledTracers };
51-
}
52-
delete config.tracing.disabledTracers;
53-
}
5442

5543
// Fallback to environment variables if `disable` is not explicitly configured
5644
const disableConfig = isDisableConfigNonEmpty(config) ? config.tracing.disable : getDisableFromEnv();
@@ -102,22 +90,12 @@ exports.normalizeExternalConfig = function normalizeExternalConfig(config) {
10290
* 1. INSTANA_TRACING_DISABLE=true/false
10391
* 2. INSTANA_TRACING_DISABLE_INSTRUMENTATIONS / INSTANA_TRACING_DISABLE_GROUPS
10492
* 3. INSTANA_TRACING_DISABLE=list
105-
* 4. INSTANA_DISABLED_TRACERS (deprecated)
10693
*
10794
* @returns {import('../../config/types').Disable}
10895
*/
10996
function getDisableFromEnv() {
11097
const disable = {};
11198

112-
// @deprecated
113-
if (process.env.INSTANA_DISABLED_TRACERS) {
114-
logger?.warn(
115-
'The environment variable "INSTANA_DISABLED_TRACERS" is deprecated and will be removed in the next ' +
116-
'major release. Use "INSTANA_TRACING_DISABLE" instead.'
117-
);
118-
disable.instrumentations = parseEnvVar(process.env.INSTANA_DISABLED_TRACERS);
119-
}
120-
12199
// This env var may contains true/false and also both groups and instrumentations
122100
if (process.env.INSTANA_TRACING_DISABLE) {
123101
const envVarValue = process.env.INSTANA_TRACING_DISABLE;

packages/core/src/config/index.js

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ const deepMerge = require('../util/deepMerge');
2424
* @property {number} [stackTraceLength]
2525
* @property {HTTPTracingOptions} [http]
2626
* @property {import('../config/types').Disable} [disable]
27-
* @property {Array<string>} [disabledTracers]
2827
* @property {boolean} [spanBatchingEnabled]
2928
* @property {boolean} [disableW3cTraceCorrelation]
3029
* @property {KafkaTracingOptions} [kafka]
@@ -250,17 +249,6 @@ function normalizeTracingEnabled(config) {
250249
return;
251250
}
252251

253-
// @deprecated
254-
if (process.env['INSTANA_DISABLE_TRACING'] === 'true') {
255-
logger.info('Not enabling tracing as it is explicitly disabled via environment variable INSTANA_DISABLE_TRACING.');
256-
logger.warn(
257-
'The environment variable INSTANA_DISABLE_TRACING is deprecated and will be removed in the next major release. ' +
258-
'Please use INSTANA_TRACING_DISABLE="true" instead.'
259-
);
260-
config.tracing.enabled = false;
261-
return;
262-
}
263-
264252
config.tracing.enabled = defaults.tracing.enabled;
265253
}
266254

packages/core/test/config/configNormalizers/disable_test.js

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ const { expect } = require('chai');
1010
const { normalize, normalizeExternalConfig } = require('../../../src/config/configNormalizers/disable');
1111

1212
function resetEnv() {
13-
delete process.env.INSTANA_DISABLED_TRACERS;
1413
delete process.env.INSTANA_TRACING_DISABLE;
1514
delete process.env.INSTANA_TRACING_DISABLE_INSTRUMENTATIONS;
1615
delete process.env.INSTANA_TRACING_DISABLE_GROUPS;
@@ -34,35 +33,6 @@ describe('util.configNormalizers.disable', () => {
3433
expect(config.tracing).to.exist;
3534
});
3635

37-
it('should handle deprecated "disabledTracers" to "disable.instrumentations"', () => {
38-
const config = {
39-
tracing: {
40-
disabledTracers: ['AWS-SDK', 'mongodb']
41-
}
42-
};
43-
44-
const result = normalize(config);
45-
46-
expect(result).to.deep.equal({
47-
instrumentations: ['aws-sdk', 'mongodb']
48-
});
49-
expect(config.tracing.disabledTracers).to.be.undefined;
50-
});
51-
52-
it('should prioritize "disable" when both "disabledTracers" and "disable" are defined', () => {
53-
const config = {
54-
tracing: {
55-
disabledTracers: ['AWS-SDK'],
56-
disable: {
57-
instrumentations: ['redis']
58-
}
59-
}
60-
};
61-
62-
const result = normalize(config);
63-
expect(result.instrumentations).to.deep.equal(['redis']);
64-
});
65-
6636
it('should normalize instrumentation names: lowercase and trim whitespace', () => {
6737
const config = {
6838
tracing: {
@@ -245,25 +215,6 @@ describe('util.configNormalizers.disable', () => {
245215
expect(result.groups).to.deep.equal(['logging', 'databases']);
246216
});
247217

248-
it('should fallback to deprected "INSTANA_DISABLED_TRACERS"', () => {
249-
process.env.INSTANA_DISABLED_TRACERS = 'redis, mysql';
250-
251-
const config = {};
252-
const result = normalize(config);
253-
254-
expect(result.instrumentations).to.deep.equal(['redis', 'mysql']);
255-
});
256-
257-
it('should prioritize "INSTANA_TRACING_DISABLE_INSTRUMENTATIONS" over "INSTANA_DISABLED_TRACERS"', () => {
258-
process.env.INSTANA_TRACING_DISABLE_INSTRUMENTATIONS = 'aws-sdk';
259-
process.env.INSTANA_DISABLED_TRACERS = 'redis';
260-
261-
const config = {};
262-
const result = normalize(config);
263-
264-
expect(result.instrumentations).to.deep.equal(['aws-sdk']);
265-
});
266-
267218
it('should support semicolon-separated values in environment variable', () => {
268219
process.env.INSTANA_TRACING_DISABLE_INSTRUMENTATIONS = 'aws-sdk;mongodb;postgres';
269220

packages/core/test/config/normalizeConfig_test.js

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,6 @@ describe('config.normalizeConfig', () => {
2020
afterEach(resetEnv);
2121

2222
function resetEnv() {
23-
// deprecated
24-
delete process.env.INSTANA_DISABLED_TRACERS;
25-
delete process.env.INSTANA_DISABLE_TRACING;
26-
2723
delete process.env.INSTANA_TRACING_DISABLE_INSTRUMENTATIONS;
2824
delete process.env.INSTANA_TRACING_DISABLE_GROUPS;
2925
delete process.env.INSTANA_TRACING_DISABLE_EOL_EVENTS;
@@ -112,13 +108,6 @@ describe('config.normalizeConfig', () => {
112108
expect(config.tracing.automaticTracingEnabled).to.be.false;
113109
});
114110

115-
it('should disable tracing via deprecated INSTANA_DISABLE_TRACING', () => {
116-
process.env.INSTANA_DISABLE_TRACING = true;
117-
const config = coreConfig.normalize();
118-
expect(config.tracing.enabled).to.be.false;
119-
expect(config.tracing.automaticTracingEnabled).to.be.false;
120-
});
121-
122111
it('should disable automatic tracing', () => {
123112
const config = coreConfig.normalize({ tracing: { automaticTracingEnabled: false } });
124113
expect(config.tracing.enabled).to.be.true;
@@ -275,34 +264,6 @@ describe('config.normalizeConfig', () => {
275264
expect(config.tracing.disable).to.deep.equal({});
276265
});
277266

278-
it('should disable individual instrumentations via config', () => {
279-
const config = coreConfig.normalize({
280-
tracing: {
281-
disabledTracers: ['graphQL', 'GRPC']
282-
}
283-
});
284-
// values will be normalized to lower case
285-
expect(config.tracing.disable.instrumentations).to.deep.equal(['graphql', 'grpc']);
286-
});
287-
288-
it('should disable individual instrumentations via env var', () => {
289-
process.env.INSTANA_DISABLED_TRACERS = 'graphQL , GRPC';
290-
const config = coreConfig.normalize();
291-
// values will be normalized to lower case
292-
expect(config.tracing.disable.instrumentations).to.deep.equal(['graphql', 'grpc']);
293-
});
294-
295-
it('config should take precedence over env vars when disabling individual tracers', () => {
296-
process.env.INSTANA_DISABLED_TRACERS = 'foo, bar';
297-
const config = coreConfig.normalize({
298-
tracing: {
299-
disabledTracers: ['baz', 'fizz']
300-
}
301-
});
302-
// values will be normalized to lower case
303-
expect(config.tracing.disable.instrumentations).to.deep.equal(['baz', 'fizz']);
304-
});
305-
306267
it('should disable individual instrumentations via disable config', () => {
307268
const config = coreConfig.normalize({
308269
tracing: {
@@ -349,13 +310,6 @@ describe('config.normalizeConfig', () => {
349310
expect(config.tracing.disable.instrumentations).to.deep.equal(['graphql', 'grpc']);
350311
});
351312

352-
it('should prefer INSTANA_TRACING_DISABLE_INSTRUMENTATIONS over INSTANA_DISABLED_TRACERS', () => {
353-
process.env.INSTANA_TRACING_DISABLE_INSTRUMENTATIONS = 'redis';
354-
process.env.INSTANA_DISABLED_TRACERS = 'postgres';
355-
const config = coreConfig.normalize();
356-
expect(config.tracing.disable.instrumentations).to.deep.equal(['redis']);
357-
});
358-
359313
it('should disable individual groups via disable config', () => {
360314
const config = coreConfig.normalize({
361315
tracing: {

packages/core/test/tracing/index_test.js

Lines changed: 0 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,6 @@ mochaSuiteFn('[UNIT] tracing/index', function () {
7676
initAwsSdkv2.reset();
7777
initAwsSdkv3.reset();
7878

79-
// @deprecated
80-
delete process.env.INSTANA_DISABLED_TRACERS;
81-
8279
delete process.env.INSTANA_TRACING_DISABLE;
8380
delete process.env.INSTANA_TRACING_DISABLE_INSTRUMENTATIONS;
8481
delete process.env.INSTANA_TRACING_DISABLE_GROUPS;
@@ -271,89 +268,6 @@ mochaSuiteFn('[UNIT] tracing/index', function () {
271268
expect(activateAwsSdkv2).to.have.been.called;
272269
});
273270
});
274-
275-
describe('[deprecated] when using disabledTracers config', () => {
276-
it('should deactivate tracers as specified', () => {
277-
initAndActivate({ tracing: { disabledTracers: ['grpc', 'kafkajs', 'aws-sdk/v2'] } });
278-
279-
// grpcJs instrumentation has not been disabled, make sure its init and activate are called
280-
expect(initStubGrpcJs).to.have.been.called;
281-
expect(activateStubGrpcJs).to.have.been.called;
282-
283-
// kafkajs has been disabled...
284-
expect(initStubKafkaJs).to.not.have.been.called;
285-
expect(activateStubKafkaJs).to.not.have.been.called;
286-
287-
// ...but rdkafka has not been disabled
288-
expect(initStubRdKafka).to.have.been.called;
289-
expect(activateStubRdKafka).to.have.been.called;
290-
291-
// aws-sdk/v2 has been disabled (via aws-sdk/v2)
292-
expect(initAwsSdkv2).not.to.have.been.called;
293-
expect(activateAwsSdkv2).not.to.have.been.called;
294-
295-
// aws-sdk/v3 has not been disabled
296-
expect(initAwsSdkv3).to.have.been.called;
297-
expect(activateAwsSdkv3).to.have.been.called;
298-
});
299-
300-
it('should respect INSTANA_DISABLED_TRACERS environment variable', () => {
301-
process.env.INSTANA_DISABLED_TRACERS = 'kafkajs';
302-
initAndActivate({});
303-
304-
expect(initStubKafkaJs).not.to.have.been.called;
305-
expect(activateStubKafkaJs).not.to.have.been.called;
306-
});
307-
308-
it('should handle empty disabledTracers array', () => {
309-
initAndActivate({ tracing: { disabledTracers: [] } });
310-
311-
expect(initStubGrpcJs).to.have.been.called;
312-
expect(initStubKafkaJs).to.have.been.called;
313-
expect(initStubRdKafka).to.have.been.called;
314-
});
315-
316-
it('should trim whitespace in environment variable values', () => {
317-
process.env.INSTANA_DISABLED_TRACERS = ' grpc , kafkajs ';
318-
initAndActivate({});
319-
320-
expect(initStubGrpcJs).to.have.been.called;
321-
expect(activateStubGrpcJs).to.have.been.called;
322-
323-
expect(initStubKafkaJs).not.to.have.been.called;
324-
expect(activateStubKafkaJs).not.to.have.been.called;
325-
});
326-
327-
it('should prefer disable over disabledTracers when both exist', () => {
328-
initAndActivate({
329-
tracing: {
330-
disabledTracers: ['grpc', 'kafkajs'],
331-
disable: { instrumentations: ['aws-sdk/v2'] }
332-
}
333-
});
334-
335-
expect(initAwsSdkv2).not.to.have.been.called;
336-
expect(activateAwsSdkv2).not.to.have.been.called;
337-
338-
expect(initStubGrpcJs).to.have.been.called;
339-
expect(activateStubGrpcJs).to.have.been.called;
340-
341-
expect(initStubKafkaJs).to.have.been.called;
342-
expect(activateStubKafkaJs).to.have.been.called;
343-
});
344-
345-
it('should prefer INSTANA_TRACING_DISABLE_INSTRUMENTATIONS over INSTANA_DISABLED_TRACERS', () => {
346-
process.env.INSTANA_TRACING_DISABLE_INSTRUMENTATIONS = 'aws-sdk/v2';
347-
process.env.INSTANA_DISABLED_TRACERS = 'kafkajs';
348-
initAndActivate({});
349-
350-
expect(initAwsSdkv2).not.to.have.been.called;
351-
expect(activateAwsSdkv2).not.to.have.been.called;
352-
353-
expect(initStubKafkaJs).to.have.been.called;
354-
expect(activateStubKafkaJs).to.have.been.called;
355-
});
356-
});
357271
});
358272

359273
function initAndActivate(initConfig, extraConfigForActivate) {

0 commit comments

Comments
 (0)