Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
3251a46
chore: recorded config source
aryamohanan Apr 14, 2026
840c27e
chore: added comment
aryamohanan Apr 14, 2026
cc388d0
test: test
aryamohanan Apr 16, 2026
49d75cd
test: test
aryamohanan Apr 16, 2026
f44f9d6
test: test
aryamohanan Apr 16, 2026
f569124
chore: test
aryamohanan Apr 16, 2026
accf5ef
chore: test
aryamohanan Apr 16, 2026
2c76f6f
chore: test
aryamohanan Apr 16, 2026
8e172ea
chore: test
aryamohanan Apr 16, 2026
0660bf3
chore: test
aryamohanan Apr 16, 2026
efedd88
chore: test
aryamohanan Apr 16, 2026
10ee49c
chore: updated
aryamohanan Apr 16, 2026
099e3b1
chore: updated
aryamohanan Apr 16, 2026
de22244
chore: updated
aryamohanan Apr 16, 2026
426bbde
chore: updated
aryamohanan Apr 16, 2026
ed26920
chore: updated
aryamohanan Apr 16, 2026
0718c75
chore: updated
aryamohanan Apr 16, 2026
32f86c0
chore: updated
aryamohanan Apr 16, 2026
ac1b0d6
chore: update
aryamohanan Apr 17, 2026
a735296
chore: update
aryamohanan Apr 17, 2026
840dfa5
chore: update
aryamohanan Apr 17, 2026
28a061a
chore: update
aryamohanan Apr 17, 2026
bf724b0
chore: review
aryamohanan Apr 17, 2026
6890c01
chore: update
aryamohanan Apr 17, 2026
94ba163
chore: review
aryamohanan Apr 17, 2026
94577bb
chore: update
aryamohanan Apr 17, 2026
fdc10ef
chore: update
aryamohanan Apr 17, 2026
433436b
chore: update
aryamohanan Apr 17, 2026
a878e80
chore: update
aryamohanan Apr 17, 2026
cb0aff0
chore: update
aryamohanan Apr 17, 2026
60ed66b
chore: test
aryamohanan Apr 20, 2026
7559877
chore: review
aryamohanan Apr 20, 2026
f6e5ea5
chore: review
aryamohanan Apr 20, 2026
be0a85c
chore: review
aryamohanan Apr 20, 2026
cdb2662
chore: review
aryamohanan Apr 20, 2026
45bf86e
chore: update
aryamohanan Apr 20, 2026
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
5 changes: 3 additions & 2 deletions packages/collector/src/announceCycle/agentready.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ try {
// Worker threads are not available, so we know that this is the main thread.
}

const { tracing } = require('@instana/core');
const { tracing, coreConfig, util } = require('@instana/core');
const agentConnection = require('../agentConnection');
const agentOpts = require('../agent/opts');
const initializedTooLate = require('../util/initializedTooLate');
Expand Down Expand Up @@ -130,7 +130,8 @@ function enter(_ctx) {
}
}

tracing.activate(agentOpts.config);
const updatedConfig = coreConfig.update(agentOpts.config, util.constants.CONFIG_SOURCES.AGENT);
tracing.activate(updatedConfig);

if (agentOpts.autoProfile && autoprofile) {
profiler = autoprofile.start();
Expand Down
70 changes: 45 additions & 25 deletions packages/collector/src/util/normalizeConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
'use strict';

const util = require('@instana/core/src/config/util');
const validate = require('@instana/core/src/config/validator');

const defaults = {
agentHost: '127.0.0.1',
Expand Down Expand Up @@ -42,12 +43,15 @@ module.exports = function normalizeConfig(userConfig = {}) {
* @returns {string}
*/
function normalizeAgentHost(userConfig, defaultConfig) {
return util.resolveStringConfig({
envVar: 'INSTANA_AGENT_HOST',
configValue: userConfig.agentHost,
defaultValue: defaultConfig.agentHost,
configPath: 'config.agentHost'
});
const { value } = util.resolve(
{
envValue: 'INSTANA_AGENT_HOST',
inCodeValue: userConfig.agentHost,
defaultValue: defaultConfig.agentHost
},
[validate.stringValidator]
);
return value;
}

/**
Expand All @@ -56,12 +60,15 @@ function normalizeAgentHost(userConfig, defaultConfig) {
* @returns {number}
*/
function normalizeAgentPort(userConfig, defaultConfig) {
return util.resolveNumericConfig({
envVar: 'INSTANA_AGENT_PORT',
configValue: userConfig.agentPort,
defaultValue: defaultConfig.agentPort,
configPath: 'config.agentPort'
});
const { value } = util.resolve(
{
envValue: 'INSTANA_AGENT_PORT',
inCodeValue: userConfig.agentPort,
defaultValue: defaultConfig.agentPort
},
[validate.numberValidator]
);
return value;
}

/**
Expand All @@ -70,12 +77,15 @@ function normalizeAgentPort(userConfig, defaultConfig) {
* @returns {number}
*/
function normalizeAgentRequestTimeout(userConfig, defaultConfig) {
return util.resolveNumericConfig({
envVar: 'INSTANA_AGENT_REQUEST_TIMEOUT',
configValue: userConfig.agentRequestTimeout,
defaultValue: defaultConfig.agentRequestTimeout,
configPath: 'config.agentRequestTimeout'
});
const { value } = util.resolve(
{
envValue: 'INSTANA_AGENT_REQUEST_TIMEOUT',
inCodeValue: userConfig.agentRequestTimeout,
defaultValue: defaultConfig.agentRequestTimeout
},
[validate.numberValidator]
);
return value;
}

/**
Expand All @@ -84,18 +94,28 @@ function normalizeAgentRequestTimeout(userConfig, defaultConfig) {
* @returns {boolean}
*/
function normalizeAutoProfile(userConfig, defaultConfig) {
return util.resolveBooleanConfig({
envVar: 'INSTANA_AUTO_PROFILE',
configValue: userConfig.autoProfile,
defaultValue: defaultConfig.autoProfile,
configPath: 'config.autoProfile'
});
const { value } = util.resolve(
{
envValue: 'INSTANA_AUTO_PROFILE',
inCodeValue: userConfig.autoProfile,
defaultValue: defaultConfig.autoProfile
},
[validate.booleanValidator]
);
return value;
}

/**
* @param {import('../types/collector').CollectorConfig} userConfig
* @returns {boolean}
*/
function normalizeUnhandledRejections(userConfig) {
return userConfig.reportUnhandledPromiseRejections ?? false;
const { value } = util.resolve(
{
inCodeValue: userConfig.reportUnhandledPromiseRejections,
defaultValue: false
},
[validate.booleanValidator]
);
return value;
}
Loading