Skip to content

Commit e28f2a0

Browse files
chore: removed %s concatenations form repo
1 parent 9cd7725 commit e28f2a0

30 files changed

+80
-117
lines changed

packages/aws-fargate/src/activate.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ function init() {
3131
metrics.init(config, function onReady(err, ecsContainerPayload) {
3232
if (err) {
3333
logger.error(
34-
`Initializing @instana/aws-fargate failed. This fargate task will not be monitored. ${err.message} ${err.stack}`
34+
`Initializing @instana/aws-fargate failed. This fargate task will not be monitored.
35+
${err?.message} ${err?.stack}`
3536
);
3637
metrics.deactivate();
3738
return;
@@ -71,7 +72,7 @@ function init() {
7172
process.send && process.send('instana.aws-fargate.initialized');
7273
} catch (e) {
7374
logger.error(
74-
`Initializing @instana/aws-fargate failed. This fargate task will not be monitored. ${e.message} ${e.stack}`
75+
`Initializing @instana/aws-fargate failed. This fargate task will not be monitored. ${e?.message} ${e?.stack}`
7576
);
7677
}
7778
});

packages/aws-fargate/src/metrics/transmissionCycle.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ function onMetricsHaveBeenSent(transmittedPayloadPerProcessor, error) {
7171
transmissionTimeoutHandle.unref();
7272

7373
if (error) {
74-
logger.error(`Error received while trying to send snapshot data and metrics: ${error.message}`);
74+
logger.error(`Error received while trying to send snapshot data and metrics: ${error?.message}`);
7575
return;
7676
}
7777

packages/aws-lambda/src/metrics/npmPackageDescription.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ exports.currentPayload = undefined;
1616
exports.activate = function activate() {
1717
coreUtil.applicationUnderMonitoring.getMainPackageJsonStartingAtDirectory(rootDir.root, (err, pckg) => {
1818
if (err) {
19-
logger.warn(`Failed to determine main package json. Reason: ${err.message} ${err.stack}`);
19+
logger.warn(`Failed to determine main package json. Reason: ${err?.message} ${err?.stack}`);
2020
}
2121

2222
if (!err && pckg) {

packages/aws-lambda/src/metrics/npmPackageName.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ exports.currentPayload = undefined;
1616
exports.activate = function activate() {
1717
coreUtil.applicationUnderMonitoring.getMainPackageJsonStartingAtDirectory(rootDir.root, (err, pckg) => {
1818
if (err) {
19-
logger.warn(`Failed to determine main package json. Reason: ${err.message} ${err.stack}`);
19+
logger.warn(`Failed to determine main package json. Reason: ${err?.message} ${err?.stack}`);
2020
}
2121

2222
if (!err && pckg) {

packages/aws-lambda/src/metrics/npmPackageVersion.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ exports.currentPayload = undefined;
1616
exports.activate = function activate() {
1717
coreUtil.applicationUnderMonitoring.getMainPackageJsonStartingAtDirectory(rootDir.root, (err, pckg) => {
1818
if (err) {
19-
logger.warn(`Failed to determine main package json. Reason: ${err.message} ${err.stack}`);
19+
logger.warn(`Failed to determine main package json. Reason: ${err?.message} ${err?.stack}`);
2020
}
2121

2222
if (!err && pckg) {

packages/aws-lambda/src/ssm.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ module.exports.init = ({ logger }) => {
8888
logger.warn('AWS SDK is not available.');
8989
errorFromAWS =
9090
`Unable to fetch the Instana key from the SSM Parameter Store using "${process.env.INSTANA_SSM_PARAM_NAME}",` +
91-
` as the AWS SDK is unavailable. Reason: ${err.message}`;
91+
` as the AWS SDK is unavailable. Reason: ${err?.message}`;
9292
}
9393
};
9494

packages/azure-container-services/src/activate.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ function init() {
5353
process.send && process.send('instana.azure-app-service.initialized');
5454
} catch (e) {
5555
logger.error(
56-
'Initializing @instana/azure-container-services failed. This azure container service will not be monitored.',
57-
e
56+
'Initializing @instana/azure-container-services failed. This azure container service will not be monitored.' +
57+
`${e?.message} ${e?.stack}`
5858
);
5959
}
6060
}

packages/collector/src/actions/source.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function readFile(request, multiCb) {
3838
fs.readFile(request.args.file, { encoding: 'utf8' }, (error, content) => {
3939
if (error) {
4040
logger.debug(
41-
`Failed to retrieve source file for user request: ${request.args.file}. ${error.message} ${error.stack}`
41+
`Failed to retrieve source file for user request: ${request.args.file}. ${error?.message} ${error?.stack}`
4242
);
4343
multiCb({
4444
error: `Could not load file. Error: ${error.message}`

packages/collector/src/agent/requestHandler.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ function sendResponse(request, response) {
6363
if (error) {
6464
logger.warn(
6565
`Failed to send agent response for action ${request.action} and message ID ${request.messageId}.
66-
Error: ${error.message} ${error.stack}`
66+
Error: ${error?.message} ${error?.stack}`
6767
);
6868
}
6969
});

packages/collector/src/agentConnection.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ exports.announceNodeCollector = function announceNodeCollector(cb) {
169169
payload.inode = payload.inode.substring(linkPathPrefix.length);
170170
}
171171
} catch (e) {
172-
logger.debug('Failed to retrieve inode for file descriptor %s: %s', payload.fd, e.message);
172+
logger.debug(`Failed to retrieve inode for file descriptor ${payload.fd}: ${e.message}`);
173173
}
174174
}
175175

@@ -449,7 +449,7 @@ function getCpuSetFileContent() {
449449
return content;
450450
} catch (err) {
451451
if (err.code !== 'ENOENT') {
452-
logger.warn('cpuset file could not be read. Reason: %s', err.message);
452+
logger.warn(`cpuset file could not be read. Reason: ${err.message}`);
453453
}
454454
return null;
455455
}

packages/collector/src/announceCycle/agentHostLookup.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,6 @@ function safelyExtractErrorMessage(error) {
231231
* @param {string} host
232232
*/
233233
function setAgentHost(host) {
234-
logger.info('Found an agent on %s:%s, proceeding to announce request.', host, agentOpts.port);
234+
logger.info(`Found an agent on ${host}:${agentOpts.port}, proceeding to announce request.`);
235235
agentOpts.host = host;
236236
}

packages/collector/src/announceCycle/agentready.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,8 @@ function sendTracingMetrics() {
157157
agentConnection.sendTracingMetricsToAgent(payload, error => {
158158
if (error) {
159159
logger.info(
160-
'Error received while trying to send tracing metrics to agent: %s. This will not affect monitoring or tracing.',
161-
error.message
160+
`Error received while trying to send tracing metrics to agent: %s. This will not affect monitoring or tracing.
161+
${error?.message}`
162162
);
163163
if (typeof error.message === 'string' && error.message.indexOf('Got status code 404')) {
164164
logger.info(
@@ -188,8 +188,7 @@ function fireMonitoringEvent() {
188188
agentConnection.sendAgentMonitoringEvent('nodejs_collector_native_addon_autoprofile_missing', 'PROFILER', error => {
189189
if (error) {
190190
logger.error(
191-
'Error received while trying to send a monitoring event to the Instana host agent: %s',
192-
error.message
191+
`Error received while trying to send a monitoring event to the Instana host agent: ${error?.message}`
193192
);
194193
}
195194
});

packages/collector/src/announceCycle/announced.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,8 @@ function checkWhetherAgentIsReadyToAccept(totalNumberOfAttempts, ctx) {
3737
ctx.transitionTo('agentready');
3838
} else if (totalNumberOfAttempts > MAX_RETRIES) {
3939
logger.warn(
40-
'The Instana host agent is not yet ready to accept data after %s attempts. Restarting the cycle to establish ' +
41-
'a connection.',
42-
totalNumberOfAttempts
40+
`The Instana host agent is not yet ready to accept data after ${totalNumberOfAttempts} attempts.
41+
Restarting the cycle to establish a connection.`
4342
);
4443
ctx.transitionTo('unannounced');
4544
} else {

packages/collector/src/announceCycle/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const ctx = {
3939
* @param {string} newStateName
4040
*/
4141
transitionTo: function (newStateName) {
42-
logger.info('Transitioning from %s to %s', currentState || '<init>', newStateName);
42+
logger.info(`Transitioning from ${currentState || '<init>'} to ${newStateName}`);
4343

4444
if (currentState) {
4545
states[currentState].leave(ctx);

packages/collector/src/announceCycle/unannounced.js

+8-10
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,8 @@ function tryToAnnounce(ctx, retryDelay = initialRetryDelay) {
103103

104104
if (pidStore.pid !== agentResponse.pid) {
105105
logger.info(
106-
'Reporting data to the Instana host agent with the PID from the root namespace (%s) instead of the ' +
107-
'in-container PID (%s).',
108-
agentResponse.pid,
109-
pidStore.pid
106+
`Reporting data to the Instana host agent with the PID from the root namespace (${agentResponse.pid}) ` +
107+
`instead of the in-container PID (${pidStore.pid}).`
110108
);
111109
pidStore.pid = agentResponse.pid;
112110
}
@@ -135,18 +133,18 @@ function applySecretsConfiguration(agentResponse) {
135133
if (agentResponse.secrets) {
136134
if (!(typeof agentResponse.secrets.matcher === 'string')) {
137135
logger.warn(
138-
'Received an invalid secrets configuration from the Instana host agent, attribute matcher is not a string: $s',
139-
agentResponse.secrets.matcher
136+
'Received an invalid secrets configuration from the Instana host agent, attribute matcher is not a string: ' +
137+
`${agentResponse.secrets.matcher}`
140138
);
141139
} else if (Object.keys(secrets.matchers).indexOf(agentResponse.secrets.matcher) < 0) {
142140
logger.warn(
143-
'Received an invalid secrets configuration from the Intana agent, matcher is not supported: $s',
144-
agentResponse.secrets.matcher
141+
'Received an invalid secrets configuration from the Intana agent, matcher is not supported: ' +
142+
`${agentResponse.secrets.matcher}`
145143
);
146144
} else if (!Array.isArray(agentResponse.secrets.list)) {
147145
logger.warn(
148-
'Received an invalid secrets configuration from the Instana host agent, attribute list is not an array: $s',
149-
agentResponse.secrets.list
146+
'Received an invalid secrets configuration from the Instana host agent, attribute list is not an array: ' +
147+
`${agentResponse.secrets.list}`
150148
);
151149
} else {
152150
secrets.setMatcher(agentResponse.secrets.matcher, agentResponse.secrets.list);

packages/collector/src/cmdline.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ exports.getCmdline = function getCmdline() {
3535
}
3636
} catch (err) {
3737
if (err.code !== 'ENOENT') {
38-
logger.warn('cmdline could not be retrieved via proc file. Reason: %s', err.message);
38+
logger.warn(`cmdline could not be retrieved via proc file. Reason: ${err.message}`);
3939
}
4040
}
4141

packages/collector/src/metrics/transmissionCycle.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ function sendMetrics() {
114114
*/
115115
function onMetricsHaveBeenSent(isFullTransmission, transmittedValue, error, responsePayload) {
116116
if (error) {
117-
logger.error('Error received while trying to send snapshot data and metrics: %s', error?.message);
117+
logger.error(`Error received while trying to send snapshot data and metrics: ${error?.message}`);
118118
if (onError) {
119119
onError();
120120
}

packages/collector/src/pidStore/index.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ const eventName = 'pidChanged';
2121
const eventEmitter = new EventEmitter();
2222
exports.onPidChange = eventEmitter.on.bind(eventEmitter, eventName);
2323

24-
logger.info('PID Store starting with pid %s', internalPidStore.pid);
24+
logger.info(`PID Store starting with pid ${internalPidStore.pid}`);
2525

2626
Object.defineProperty(exports, 'pid', {
2727
get: function getPid() {
2828
return internalPidStore.pid;
2929
},
3030
set: function setPid(newPid) {
3131
if (internalPidStore.pid !== newPid) {
32-
logger.info('Changing pid to %s', newPid);
32+
logger.info(`Changing pid to ${newPid}`);
3333
internalPidStore.pid = newPid;
3434
eventEmitter.emit(eventName, internalPidStore.pid);
3535
}
@@ -52,7 +52,7 @@ if (!process.env.CONTINUOUS_INTEGRATION) {
5252
const pidInParentNamespace = getPidFromParentNamespace();
5353
if (pidInParentNamespace) {
5454
internalPidStore.pid = pidInParentNamespace;
55-
logger.info('Changing pid to %s due to successful identification of PID in parent namespace', pidInParentNamespace);
55+
logger.info(`Changing pid to ${pidInParentNamespace} due to successful identification of PID in parent namespace`);
5656
}
5757
}
5858

@@ -75,7 +75,7 @@ function getPidFromParentNamespace() {
7575
return pidInSchedFile;
7676
} catch (err) {
7777
if (err.code !== 'ENOENT') {
78-
logger.warn('PID could not be read from sched file. Reason: %s', err?.message);
78+
logger.warn(`PID could not be read from sched file. Reason: ${err?.message}`);
7979
}
8080
}
8181
}

packages/collector/src/uncaught/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ function onUnhandledRejection(reason) {
101101

102102
downstreamConnection.sendEvent(createEventForUnhandledRejection(reason), error => {
103103
if (error) {
104-
logger.error('Error received while trying to send event to agent: %s', error?.message);
104+
logger.error(`Error received while trying to send event to agent: ${error?.message}`);
105105
}
106106
});
107107
}

packages/collector/src/util/initializedTooLate.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ exports.check = function check() {
4343
function fireMonitoringEvent() {
4444
agentConnection.sendAgentMonitoringEvent('nodejs_collector_initialized_too_late', 'TRACER', error => {
4545
if (error) {
46-
logger.error('Error received while trying to send Agent Monitoring Event to agent: %s', error?.message);
46+
logger.error(`Error received while trying to send Agent Monitoring Event to agent: ${error?.message}`);
4747
}
4848
});
4949
}

packages/core/src/secrets.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,7 @@ exports.matchers = {
123123
regexes.push(new RegExp(regexString));
124124
} catch (e) {
125125
logger.warn(
126-
'Received invalid regex from agent: %s - this regex will not be used for removing secrets',
127-
regexString
126+
`Received invalid regex from agent: ${regexString} - this regex will not be used for removing secrets`
128127
);
129128
}
130129
});
@@ -166,7 +165,7 @@ function checkSecrets(configuredSecrets) {
166165
if (typeof s === 'string') {
167166
secrets.push(s);
168167
} else {
169-
logger.warn('Received invalid secret key from agent: %s - this key will not be used for removing secrets', s);
168+
logger.warn(`Received invalid secret key from agent: ${s} - this key will not be used for removing secrets`);
170169
}
171170
});
172171
return secrets;
@@ -185,7 +184,7 @@ function toLowerCase(configuredSecrets) {
185184
if (typeof s === 'string') {
186185
secrets.push(s.toLowerCase());
187186
} else {
188-
logger.warn('Received invalid secret key from agent: %s - this key will not be used for removing secrets', s);
187+
logger.warn(`Received invalid secret key from agent: ${s} - this key will not be used for removing secrets`);
189188
}
190189
});
191190
return secrets;

packages/core/src/tracing/cls.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ class InstanaPseudoSpan extends InstanaSpan {
231231
function startSpan(spanName, kind, traceId, parentSpanId, w3cTraceContext) {
232232
tracingMetrics.incrementOpened();
233233
if (!kind || (kind !== ENTRY && kind !== EXIT && kind !== INTERMEDIATE)) {
234-
logger.warn('Invalid span (%s) without kind/with invalid kind: %s, assuming EXIT.', spanName, kind);
234+
logger.warn(`Invalid span (${spanName}) without kind/with invalid kind: ${kind}, assuming EXIT.`);
235235
kind = EXIT;
236236
}
237237
const span = new InstanaSpan(spanName);
@@ -303,7 +303,7 @@ function startSpan(spanName, kind, traceId, parentSpanId, w3cTraceContext) {
303303
*/
304304
function putPseudoSpan(spanName, kind, traceId, spanId) {
305305
if (!kind || (kind !== ENTRY && kind !== EXIT && kind !== INTERMEDIATE)) {
306-
logger.warn('Invalid pseudo span (%s) without kind/with invalid kind: %s, assuming EXIT.', spanName, kind);
306+
logger.warn(`Invalid pseudo span (${spanName}) without kind/with invalid kind: ${kind}, assuming EXIT.`);
307307
kind = EXIT;
308308
}
309309
const span = new InstanaPseudoSpan(spanName);

packages/core/src/tracing/spanBuffer.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ exports.addSpan = function (span) {
199199
span = processedSpan;
200200

201201
if (span.t == null) {
202-
logger.warn('Span of type %s has no trace ID. Not transmitting this span', span.n);
202+
logger.warn(`Span of type ${span.n} has no trace ID. Not transmitting this span`);
203203
return;
204204
}
205205

0 commit comments

Comments
 (0)