Skip to content

chore: added proper logging for config module#2514

Open
aryamohanan wants to merge 1 commit intofix-config-precedencefrom
fix-log-config
Open

chore: added proper logging for config module#2514
aryamohanan wants to merge 1 commit intofix-config-precedencefrom
fix-log-config

Conversation

@aryamohanan
Copy link
Copy Markdown
Contributor

No description provided.

@aryamohanan aryamohanan marked this pull request as ready for review May 4, 2026 08:47
@aryamohanan aryamohanan requested a review from a team as a code owner May 4, 2026 08:47
Copy link
Copy Markdown
Contributor

@abhilash-sivan abhilash-sivan left a comment

Choose a reason for hiding this comment

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

I could see a duplicate log:

{"level":20,"time":"2026-05-04T10:42:49.871Z","threadId":0,"name":"@instana/collector","msg":"[config] env:config.tracing.useOpentelemetry: true"}
The App is using the following preload flags: --require ./instana-collector-5.4.1/src/immediate.js
{"level":30,"time":"Mon, 04 May 2026 10:42:49 GMT","pid":29873,"hostname":"Abhis-MacBook-Pro.local","msg":"Server is running on http://localhost:3000"}
{"level":20,"time":"2026-05-04T10:42:49.872Z","threadId":0,"name":"@instana/collector","msg":"[config] env:config.tracing.useOpentelemetry: true"}
{"level":30,"time":"2026-05-04T10:42:49.874Z","threadId":0,"name":"@instana/collector","msg":"PID Store starting with pid 29873"}

here [config] env:config.tracing.useOpentelemetry: true is logged twice. Please check

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 4, 2026

@abhilash-sivan
Copy link
Copy Markdown
Contributor

I have

I could see a duplicate log:

{"level":20,"time":"2026-05-04T10:42:49.871Z","threadId":0,"name":"@instana/collector","msg":"[config] env:config.tracing.useOpentelemetry: true"}
The App is using the following preload flags: --require ./instana-collector-5.4.1/src/immediate.js
{"level":30,"time":"Mon, 04 May 2026 10:42:49 GMT","pid":29873,"hostname":"Abhis-MacBook-Pro.local","msg":"Server is running on http://localhost:3000"}
{"level":20,"time":"2026-05-04T10:42:49.872Z","threadId":0,"name":"@instana/collector","msg":"[config] env:config.tracing.useOpentelemetry: true"}
{"level":30,"time":"2026-05-04T10:42:49.874Z","threadId":0,"name":"@instana/collector","msg":"PID Store starting with pid 29873"}

here [config] env:config.tracing.useOpentelemetry: true is logged twice. Please check

I tested the same on main as well.

Currently, we don’t have logging for this in main, but I added a log and verified it locally. The log appears twice because the entry file invokes this twice, and the normalisation runs in both. That’s why the log is printed twice.

We should look into a more graceful way to handle this.

{"level":20,"time":"2026-05-04T15:06:05.250Z","threadId":0,"name":"@instana/collector","msg":"INSTANA_DISABLE_USE_OPENTELEMETRY is set to "true", disabling OpenTelemetry integration."}
The App is using the following preload flags: noFlags
{"level":30,"time":"Mon, 04 May 2026 15:06:05 GMT","pid":32652,"hostname":"Abhis-MacBook-Pro.local","msg":"Server is running on http://localhost:3000"}
{"level":20,"time":"2026-05-04T15:06:05.252Z","threadId":0,"name":"@instana/collector","msg":"INSTANA_DISABLE_USE_OPENTELEMETRY is set to "true", disabling OpenTelemetry integration."}

@aryamohanan
Copy link
Copy Markdown
Contributor Author

I have

I could see a duplicate log:

{"level":20,"time":"2026-05-04T10:42:49.871Z","threadId":0,"name":"@instana/collector","msg":"[config] env:config.tracing.useOpentelemetry: true"}
The App is using the following preload flags: --require ./instana-collector-5.4.1/src/immediate.js
{"level":30,"time":"Mon, 04 May 2026 10:42:49 GMT","pid":29873,"hostname":"Abhis-MacBook-Pro.local","msg":"Server is running on http://localhost:3000"}
{"level":20,"time":"2026-05-04T10:42:49.872Z","threadId":0,"name":"@instana/collector","msg":"[config] env:config.tracing.useOpentelemetry: true"}
{"level":30,"time":"2026-05-04T10:42:49.874Z","threadId":0,"name":"@instana/collector","msg":"PID Store starting with pid 29873"}

here [config] env:config.tracing.useOpentelemetry: true is logged twice. Please check

I tested the same on main as well.

Currently, we don’t have logging for this in main, but I added a log and verified it locally. The log appears twice because the entry file invokes this twice, and the normalisation runs in both. That’s why the log is printed twice.

We should look into a more graceful way to handle this.

{"level":20,"time":"2026-05-04T15:06:05.250Z","threadId":0,"name":"@instana/collector","msg":"INSTANA_DISABLE_USE_OPENTELEMETRY is set to "true", disabling OpenTelemetry integration."}
The App is using the following preload flags: noFlags
{"level":30,"time":"Mon, 04 May 2026 15:06:05 GMT","pid":32652,"hostname":"Abhis-MacBook-Pro.local","msg":"Server is running on http://localhost:3000"}
{"level":20,"time":"2026-05-04T15:06:05.252Z","threadId":0,"name":"@instana/collector","msg":"INSTANA_DISABLE_USE_OPENTELEMETRY is set to "true", disabling OpenTelemetry integration."}

I have

I could see a duplicate log:

{"level":20,"time":"2026-05-04T10:42:49.871Z","threadId":0,"name":"@instana/collector","msg":"[config] env:config.tracing.useOpentelemetry: true"}
The App is using the following preload flags: --require ./instana-collector-5.4.1/src/immediate.js
{"level":30,"time":"Mon, 04 May 2026 10:42:49 GMT","pid":29873,"hostname":"Abhis-MacBook-Pro.local","msg":"Server is running on http://localhost:3000"}
{"level":20,"time":"2026-05-04T10:42:49.872Z","threadId":0,"name":"@instana/collector","msg":"[config] env:config.tracing.useOpentelemetry: true"}
{"level":30,"time":"2026-05-04T10:42:49.874Z","threadId":0,"name":"@instana/collector","msg":"PID Store starting with pid 29873"}

here [config] env:config.tracing.useOpentelemetry: true is logged twice. Please check

I tested the same on main as well.

Currently, we don’t have logging for this in main, but I added a log and verified it locally. The log appears twice because the entry file invokes this twice, and the normalisation runs in both. That’s why the log is printed twice.

We should look into a more graceful way to handle this.

{"level":20,"time":"2026-05-04T15:06:05.250Z","threadId":0,"name":"@instana/collector","msg":"INSTANA_DISABLE_USE_OPENTELEMETRY is set to "true", disabling OpenTelemetry integration."}
The App is using the following preload flags: noFlags
{"level":30,"time":"Mon, 04 May 2026 15:06:05 GMT","pid":32652,"hostname":"Abhis-MacBook-Pro.local","msg":"Server is running on http://localhost:3000"}
{"level":20,"time":"2026-05-04T15:06:05.252Z","threadId":0,"name":"@instana/collector","msg":"INSTANA_DISABLE_USE_OPENTELEMETRY is set to "true", disabling OpenTelemetry integration."}

I have

I could see a duplicate log:

{"level":20,"time":"2026-05-04T10:42:49.871Z","threadId":0,"name":"@instana/collector","msg":"[config] env:config.tracing.useOpentelemetry: true"}
The App is using the following preload flags: --require ./instana-collector-5.4.1/src/immediate.js
{"level":30,"time":"Mon, 04 May 2026 10:42:49 GMT","pid":29873,"hostname":"Abhis-MacBook-Pro.local","msg":"Server is running on http://localhost:3000"}
{"level":20,"time":"2026-05-04T10:42:49.872Z","threadId":0,"name":"@instana/collector","msg":"[config] env:config.tracing.useOpentelemetry: true"}
{"level":30,"time":"2026-05-04T10:42:49.874Z","threadId":0,"name":"@instana/collector","msg":"PID Store starting with pid 29873"}

here [config] env:config.tracing.useOpentelemetry: true is logged twice. Please check

I tested the same on main as well.

Currently, we don’t have logging for this in main, but I added a log and verified it locally. The log appears twice because the entry file invokes this twice, and the normalisation runs in both. That’s why the log is printed twice.

We should look into a more graceful way to handle this.

{"level":20,"time":"2026-05-04T15:06:05.250Z","threadId":0,"name":"@instana/collector","msg":"INSTANA_DISABLE_USE_OPENTELEMETRY is set to "true", disabling OpenTelemetry integration."}
The App is using the following preload flags: noFlags
{"level":30,"time":"Mon, 04 May 2026 15:06:05 GMT","pid":32652,"hostname":"Abhis-MacBook-Pro.local","msg":"Server is running on http://localhost:3000"}
{"level":20,"time":"2026-05-04T15:06:05.252Z","threadId":0,"name":"@instana/collector","msg":"INSTANA_DISABLE_USE_OPENTELEMETRY is set to "true", disabling OpenTelemetry integration."}

I think we can proceed with the current logging approach. Some configuration options in the main setup already result in duplicate logs—for example, INSTANA_TRACING_DISABLE=true. When debug mode is enabled, logs may appear twice.

This happens because coreConfig.normalize() is invoked twice during collector initialization. If any configuration value changes between those calls, it may be logged again as a separate update. This behavior is intentional for now and can be revisited later if necessary.

Overall, these configuration logs are quite required, especially when troubleshooting or diagnosing issues.

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