Skip to content

fix(collector): optimized metrics timeout handling#2084

Merged
kirrg001 merged 5 commits intomainfrom
fix-metrics-timeout
Oct 21, 2025
Merged

fix(collector): optimized metrics timeout handling#2084
kirrg001 merged 5 commits intomainfrom
fix-metrics-timeout

Conversation

@kirrg001
Copy link
Copy Markdown
Contributor

);

req.setTimeout(agentOpts.requestTimeout, function onTimeout() {
if (req.destroyed) {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This resolves the warning

{"level":20,"time":"2025-10-13T15:58:45.423Z","threadId":0,"name":"@instana/collector","msg":"Function callback for sendData: /com.instana.plugin.nodejs.41842 was called 2 times. This time with the following arguments: {"args":[{}]}"}

' This will not affect monitoring or tracing.'
);
if (typeof error.message === 'string' && error.message.indexOf('Got status code 404')) {
if (typeof error.message === 'string' && error.message.indexOf('Got status code 404') !== -1) {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The good old classic bug.

error.message.indexOf('Got status code 404')

Thats why

Apparently the version of the Instana host agent on this host does not support the POST /tracermetrics endpoint, will stop sending tracing metrics.

Appeared in the logs. But that was wrong. We do not receive a 404 on timeout error.

} else if (originalTracingMetricsDelay !== null) {
// on success, restore original delay
tracingMetricsDelay = originalTracingMetricsDelay;
originalTracingMetricsDelay = null;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a tiny logic to increase the retry time for sending tracer metrics to /tracermetrics endpoint on error. Please review carefully.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SInce this is metrics only, I think this should be fine

@kirrg001 kirrg001 marked this pull request as ready for review October 21, 2025 09:42
@kirrg001 kirrg001 requested a review from a team as a code owner October 21, 2025 09:42
Comment thread packages/collector/test/tracing/misc/tracing_metrics/test.js Outdated
@instana instana deleted a comment from sonarqubecloud Bot Oct 21, 2025
@sonarqubecloud
Copy link
Copy Markdown

@kirrg001 kirrg001 merged commit 6eb2fda into main Oct 21, 2025
3 checks passed
@instanacd instanacd deleted the fix-metrics-timeout branch December 22, 2025 00:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants