-
Notifications
You must be signed in to change notification settings - Fork 857
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Log detected resources without triggering unresolved check #5545
Log detected resources without triggering unresolved check #5545
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #5545 +/- ##
=======================================
Coverage 94.95% 94.95%
=======================================
Files 308 308
Lines 7927 7932 +5
Branches 1604 1605 +1
=======================================
+ Hits 7527 7532 +5
Misses 400 400
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This solves the issue, so I'm approving.
However, from offline discussion, I'd vote for just dropping the logResources
call.
- I cannot imagine there is a spec requirement or breaking concern over
diag.verbose()
output. - Side note: You commented on the
logResources()
(for a different reason) in the PR where this was added: Create sync resource with some attributes that resolve asynchronously #3460 (comment) - There is already a
diag.debug
that dumps the raw Resource:
% cd metapackages/auto-instrumentation-node
% OTEL_LOG_LEVEL=debug node -r ./build/src/register.js test/test-app/app.js
...
ContainerDetector found resource. ResourceImpl {
_rawAttributes: [ [ 'container.id', [Promise] ] ],
_asyncAttributesPending: true,
_memoizedAttributes: undefined
}
EnvDetector found resource. ResourceImpl {
_rawAttributes: [],
_asyncAttributesPending: false,
_memoizedAttributes: undefined
}
HostDetector found resource. ResourceImpl {
_rawAttributes: [
[ 'host.name', 'peach.local' ],
[ 'host.arch', 'arm64' ],
[ 'host.id', [Promise] ]
],
_asyncAttributesPending: true,
_memoizedAttributes: undefined
}
...
Setting to OTEL_LOG_LEVEL=verbose
then adds a second diag output for the detectors:
Trace: {
"os.type": "darwin",
"os.version": "24.3.0"
}
at DiagConsoleLogger.verbose (/Users/trentm/src/opentelemetry-js-contrib/node_modules/@opentelemetry/api/build/src/diag/consoleLogger.js:46:40)
at DiagAPI.verbose (/Users/trentm/src/opentelemetry-js-contrib/node_modules/@opentelemetry/api/build/src/api/diag.js:40:40)
at /Users/trentm/src/opentelemetry-js-contrib/node_modules/@opentelemetry/resources/build/src/detect-resources.js:53:24
at Array.forEach (<anonymous>)
at logResources (/Users/trentm/src/opentelemetry-js-contrib/node_modules/@opentelemetry/resources/build/src/detect-resources.js:49:15)
at detectResources (/Users/trentm/src/opentelemetry-js-contrib/node_modules/@opentelemetry/resources/build/src/detect-resources.js:39:5)
at NodeSDK.start (/Users/trentm/src/opentelemetry-js-contrib/node_modules/@opentelemetry/sdk-node/build/src/sdk.js:225:83)
at Object.<anonymous> (/Users/trentm/src/opentelemetry-js-contrib/metapackages/auto-instrumentations-node/build/src/register.js:27:9)
at Module._compile (node:internal/modules/cjs/loader:1364:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1422:10)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for putting the details here. I've approved both PRs as I think either one is fine. If we're still getting the main debug output then that's the important bit.
Created alternative #5546 |
closing in favor of #5546 |
Fixes an issue where logging the detected resources triggered a warning that unresolved attributes have been accessed:
opentelemetry-js/packages/opentelemetry-resources/src/detect-resources.ts
Line 42 in 7fde940