Skip to content

Commit 6df756e

Browse files
chore: update
1 parent 09bd905 commit 6df756e

2 files changed

Lines changed: 10 additions & 8 deletions

File tree

packages/core/src/config/index.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ const { validateStackTraceMode, validateStackTraceLength } = require('./configVa
7373
/** @type {String[]} */
7474
const allowedSecretMatchers = ['equals', 'equals-ignore-case', 'contains', 'contains-ignore-case', 'regex', 'none'];
7575

76+
const transmissionDelayMaxValue = 5000;
77+
7678
/**
7779
* @typedef {Object} InstanaConfig
7880
* @property {string} [serviceName]
@@ -223,12 +225,12 @@ function normalizeMetricsConfig(config) {
223225
'INSTANA_METRICS_TRANSMISSION_DELAY'
224226
);
225227

226-
// Validate max value of 5000 for transmissionDelay
227-
if (config.metrics.transmissionDelay > 5000) {
228+
// Validate max value for transmissionDelay
229+
if (config.metrics.transmissionDelay > transmissionDelayMaxValue) {
228230
logger.warn(
229-
`The value of config.metrics.transmissionDelay (or INSTANA_METRICS_TRANSMISSION_DELAY) (${config.metrics.transmissionDelay}) exceeds the maximum allowed value of 5000. Assuming the default value ${defaults.metrics.transmissionDelay}.`
231+
`The value of config.metrics.transmissionDelay (or INSTANA_METRICS_TRANSMISSION_DELAY) (${config.metrics.transmissionDelay}) exceeds the maximum allowed value of ${transmissionDelayMaxValue}. Assuming the max value ${transmissionDelayMaxValue}.`
230232
);
231-
config.metrics.transmissionDelay = defaults.metrics.transmissionDelay;
233+
config.metrics.transmissionDelay = transmissionDelayMaxValue;
232234
}
233235

234236
config.metrics.timeBetweenHealthcheckCalls =

packages/core/test/config/normalizeConfig_test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,10 @@ describe('config.normalizeConfig', () => {
8888
expect(config.metrics.transmissionDelay).to.equal(1000);
8989
});
9090

91-
it('should use default metrics transmission settings when value exceeds max of 5000', () => {
91+
it('should use max metrics transmission settings when value exceeds max of 5000', () => {
9292
process.env.INSTANA_METRICS_TRANSMISSION_DELAY = '6000';
9393
const normalizedConfig = coreConfig.normalize();
94-
expect(normalizedConfig.metrics.transmissionDelay).to.equal(1000);
94+
expect(normalizedConfig.metrics.transmissionDelay).to.equal(5000);
9595
});
9696

9797
it('should accept metrics transmission delay at max value of 5000', () => {
@@ -100,13 +100,13 @@ describe('config.normalizeConfig', () => {
100100
expect(normalizedConfig.metrics.transmissionDelay).to.equal(5000);
101101
});
102102

103-
it('should use default metrics transmission settings when value exceeds max 5000', () => {
103+
it('should use max metrics transmission settings when value exceeds max 5000', () => {
104104
const config = coreConfig.normalize({
105105
metrics: {
106106
transmissionDelay: 9753
107107
}
108108
});
109-
expect(config.metrics.transmissionDelay).to.equal(1000);
109+
expect(config.metrics.transmissionDelay).to.equal(5000);
110110
});
111111

112112
it('should use custom config.metrics.timeBetweenHealthcheckCalls', () => {

0 commit comments

Comments
 (0)