Skip to content
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

chore: removed disableAutomaticTracing legacy config #432

Merged
merged 1 commit into from
Dec 13, 2021
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
3 changes: 2 additions & 1 deletion packages/collector/test/tracing/open_tracing/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@
'use strict';

const instana = require('../../../');

instana({
agentPort: process.env.AGENT_PORT,
level: 'warn',
serviceName: 'theFancyServiceYouWouldntBelieveActuallyExists',
tracing: {
enabled: process.env.TRACING_ENABLED !== 'false',
forceTransmissionStartingAt: 1,
disableAutomaticTracing: process.env.DISABLE_AUTOMATIC_TRACING === 'true'
automaticTracingEnabled: process.env.DISABLE_AUTOMATIC_TRACING === 'false'
}
});

Expand Down
2 changes: 1 addition & 1 deletion packages/collector/test/tracing/open_tracing/controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ exports.registerTestHooks = opts => {
env.AGENT_PORT = agentPort;
env.APP_PORT = appPort;
env.TRACING_ENABLED = opts.enableTracing !== false;
env.DISABLE_AUTOMATIC_TRACING = opts.disableAutomaticTracing === true;
env.DISABLE_AUTOMATIC_TRACING = opts.automaticTracingEnabled === false;

expressOpentracingApp = spawn('node', [path.join(__dirname, 'app.js')], {
stdio: config.getAppStdio(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ describe('tracing/opentracing/integration', function () {
});

describe('without automatic tracing', () => {
expressOpentracingControls.registerTestHooks({ disableAutomaticTracing: true });
expressOpentracingControls.registerTestHooks({ automaticTracingEnabled: false });

beforeEach(() => agentControls.waitUntilAppIsCompletelyInitialized(expressOpentracingControls.getPid()));

Expand Down
6 changes: 1 addition & 5 deletions packages/core/src/util/normalizeConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ const supportedTracingVersion = require('../tracing/supportedVersion');
* @property {HTTPTracingOptions} [http]
* @property {Array<string>} [disabledTracers]
* @property {boolean} [spanBatchingEnabled]
* @property {boolean} [disableAutomaticTracing]
* @property {boolean} [disableW3cTraceCorrelation]
* @property {KafkaTracingOptions} [kafka]
*/
Expand Down Expand Up @@ -201,7 +200,6 @@ function normalizeTracingEnabled(config) {
if (process.env['INSTANA_DISABLE_TRACING'] === 'true') {
logger.info('Not enabling tracing as it is explicitly disabled via environment variable INSTANA_DISABLE_TRACING.');
config.tracing.enabled = false;
delete config.tracing.disableAutomaticTracing;
return;
}

Expand All @@ -218,10 +216,9 @@ function normalizeAutomaticTracingEnabled(config) {
return;
}

if (config.tracing.automaticTracingEnabled === false || config.tracing.disableAutomaticTracing) {
if (config.tracing.automaticTracingEnabled === false) {
logger.info('Not enabling automatic tracing as it is explicitly disabled via config.');
config.tracing.automaticTracingEnabled = false;
delete config.tracing.disableAutomaticTracing;
return;
}

Expand All @@ -230,7 +227,6 @@ function normalizeAutomaticTracingEnabled(config) {
'Not enabling automatic tracing as it is explicitly disabled via environment variable INSTANA_DISABLE_AUTO_INSTR.'
);
config.tracing.automaticTracingEnabled = false;
delete config.tracing.disableAutomaticTracing;
return;
}

Expand Down
12 changes: 0 additions & 12 deletions packages/core/test/util/normalizeConfig_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ describe('util.normalizeConfig', () => {
const config = normalizeConfig({ tracing: { enabled: false } });
expect(config.tracing.enabled).to.be.false;
expect(config.tracing.automaticTracingEnabled).to.be.false;
expect(config.tracing.disableAutomaticTracing).to.not.exist;
});

it('should disable tracing via INSTANA_DISABLE_TRACING', () => {
Expand All @@ -110,22 +109,13 @@ describe('util.normalizeConfig', () => {
const config = normalizeConfig({ tracing: { automaticTracingEnabled: false } });
expect(config.tracing.enabled).to.be.true;
expect(config.tracing.automaticTracingEnabled).to.be.false;
expect(config.tracing.disableAutomaticTracing).to.not.exist;
});

it('should disable automatic tracing (legacy config)', () => {
const config = normalizeConfig({ tracing: { disableAutomaticTracing: true } });
expect(config.tracing.enabled).to.be.true;
expect(config.tracing.automaticTracingEnabled).to.be.false;
expect(config.tracing.disableAutomaticTracing).to.not.exist;
});

it('should disable automatic tracing via INSTANA_DISABLE_AUTO_INSTR', () => {
process.env.INSTANA_DISABLE_AUTO_INSTR = 'true';
const config = normalizeConfig();
expect(config.tracing.enabled).to.be.true;
expect(config.tracing.automaticTracingEnabled).to.be.false;
expect(config.tracing.disableAutomaticTracing).to.not.exist;
});

it('should not enable automatic tracing when tracing is disabled in general', () => {
Expand All @@ -137,7 +127,6 @@ describe('util.normalizeConfig', () => {
});
expect(config.tracing.enabled).to.be.false;
expect(config.tracing.automaticTracingEnabled).to.be.false;
expect(config.tracing.disableAutomaticTracing).to.not.exist;
});

it('should enable immediate tracing activation', () => {
Expand Down Expand Up @@ -482,7 +471,6 @@ describe('util.normalizeConfig', () => {
expect(config.tracing).to.be.an('object');
expect(config.tracing.enabled).to.be.true;
expect(config.tracing.automaticTracingEnabled).to.be.true;
expect(config.tracing.disableAutomaticTracing).to.not.exist;
expect(config.tracing.activateImmediately).to.be.false;
expect(config.tracing.transmissionDelay).to.equal(1000);
expect(config.tracing.forceTransmissionStartingAt).to.equal(500);
Expand Down