-
Notifications
You must be signed in to change notification settings - Fork 821
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
Resource auto detection logging #1211
Resource auto detection logging #1211
Conversation
Signed-off-by: Adam Egyed <[email protected]>
Signed-off-by: Adam Egyed <[email protected]>
Codecov Report
@@ Coverage Diff @@
## master #1211 +/- ##
==========================================
+ Coverage 92.71% 93.01% +0.30%
==========================================
Files 129 131 +2
Lines 3471 3696 +225
Branches 712 747 +35
==========================================
+ Hits 3218 3438 +220
- Misses 253 258 +5
|
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.
I have one comment if we stick with the approach that is currently being taken.
An alternative approach that we might consider, is passing the ResourceDetectionConfig (with the logger) into each detector where they can make use it and add more detailed logging around events encountered internally. I'll let others weigh in on the merits of the different approaches.
packages/opentelemetry-resources/src/platform/node/detect-resources.ts
Outdated
Show resolved
Hide resolved
Signed-off-by: Adam Egyed <[email protected]>
e81575b
to
4372c80
Compare
Signed-off-by: Adam Egyed <[email protected]>
@mwear I've modified the Detector interface to optionally take in the ResourceDetectionConfig, but I'm not familiar with what information is valuable from each detector. Perhaps another contributor could make use of the logger within the detectors. |
Signed-off-by: Adam Egyed <[email protected]>
Signed-off-by: Adam Egyed <[email protected]>
packages/opentelemetry-resources/src/platform/node/detect-resources.ts
Outdated
Show resolved
Hide resolved
packages/opentelemetry-resources/src/platform/node/detect-resources.ts
Outdated
Show resolved
Hide resolved
packages/opentelemetry-resources/src/platform/node/detect-resources.ts
Outdated
Show resolved
Hide resolved
packages/opentelemetry-resources/src/platform/node/detect-resources.ts
Outdated
Show resolved
Hide resolved
Signed-off-by: Adam Egyed <[email protected]>
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.
Thank you for the changes, they looks good with one thing only you don't need to create a new NoopLogger in each detector as the logger will already be on config then - I added comment to each of this case otherwise you will always have NoopLogger instead of user logger.
The last thing is adding a tsdoc for all exported items
packages/opentelemetry-resources/src/platform/node/detectors/EnvDetector.ts
Outdated
Show resolved
Hide resolved
packages/opentelemetry-resources/src/platform/node/detectors/AwsEc2Detector.ts
Outdated
Show resolved
Hide resolved
packages/opentelemetry-resources/src/platform/node/detectors/GcpDetector.ts
Outdated
Show resolved
Hide resolved
Signed-off-by: Adam Egyed <[email protected]>
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.
In addition to the typo below, @obecny was asking for tsdoc updates. I think he's looking for documentation about the config
parameter added to the detect
methods.
packages/opentelemetry-resources/src/platform/node/detectors/EnvDetector.ts
Outdated
Show resolved
Hide resolved
Signed-off-by: Adam Egyed <[email protected]>
Signed-off-by: Adam Egyed <[email protected]>
Signed-off-by: Adam Egyed <[email protected]>
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.
lgtm, thx for all the changes :)
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.
Nice work! Thanks @adamegyed!
Which problem is this PR solving?
Short description of the changes
Added ResourceDetectionConfig interface to be optionally taken in by the detectResources function. Currently only configurable field is the logger, which must adhere to the logging interface specified in opentelemetry-api
Added unit tests for logger functionality