Create sync resource with some attributes that resolve asynchronously#3460
Merged
legendecas merged 98 commits intoopen-telemetry:mainfrom Feb 13, 2023
Merged
Conversation
… into feat/sync-resource-detectors � Conflicts: � experimental/packages/opentelemetry-sdk-node/test/sdk.test.ts � packages/opentelemetry-resources/src/platform/node/detect-resources.ts � packages/opentelemetry-sdk-trace-base/src/export/SimpleSpanProcessor.ts � packages/sdk-metrics/src/export/PeriodicExportingMetricReader.ts
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #3460 +/- ##
==========================================
+ Coverage 92.32% 94.04% +1.71%
==========================================
Files 153 268 +115
Lines 3608 7920 +4312
Branches 727 1641 +914
==========================================
+ Hits 3331 7448 +4117
- Misses 277 472 +195
|
vmarchaud
reviewed
Dec 4, 2022
dyladan
reviewed
Dec 5, 2022
packages/opentelemetry-resources/src/platform/node/detect-resources.ts
Outdated
Show resolved
Hide resolved
vmarchaud
approved these changes
Dec 7, 2022
osherv
approved these changes
Dec 7, 2022
legendecas
requested changes
Dec 12, 2022
Member
legendecas
left a comment
There was a problem hiding this comment.
Sorry for the late review. This can be a very nice addition. Thank you for working on this!
Just a few comments I'd like to address before merging.
packages/sdk-metrics/src/export/PeriodicExportingMetricReader.ts
Outdated
Show resolved
Hide resolved
packages/opentelemetry-resources/src/platform/browser/detect-resources.ts
Outdated
Show resolved
Hide resolved
packages/opentelemetry-resources/src/platform/node/detect-resources.ts
Outdated
Show resolved
Hide resolved
legendecas
reviewed
Dec 12, 2022
removed unnecessary await Co-authored-by: Chengzhong Wu <legendecas@gmail.com>
blumamir
requested changes
Dec 12, 2022
packages/opentelemetry-sdk-trace-base/src/export/BatchSpanProcessorBase.ts
Outdated
Show resolved
Hide resolved
blumamir
reviewed
Dec 13, 2022
…with .then to always return an object even on rejection
…rns promise that is never rejected
pichlermarc
added a commit
to dynatrace-oss-contrib/opentelemetry-js
that referenced
this pull request
Mar 15, 2023
…t resolve asynchronously (open-telemetry#3460)" This reverts commit 47444f2.
waitingsong
added a commit
to waitingsong/midway
that referenced
this pull request
Mar 27, 2023
`NodeSDK.start()` become `synchronous` ref: open-telemetry/opentelemetry-js#3460
czy88840616
pushed a commit
to midwayjs/midway
that referenced
this pull request
Mar 27, 2023
`NodeSDK.start()` become `synchronous` ref: open-telemetry/opentelemetry-js#3460
czy88840616
pushed a commit
to midwayjs/midway
that referenced
this pull request
Mar 31, 2023
`NodeSDK.start()` become `synchronous` ref: open-telemetry/opentelemetry-js#3460
1 task
kirrg001
added a commit
to instana/opentelemetry-js-contrib
that referenced
this pull request
Apr 6, 2023
…node@0.37.0 - open-telemetry/opentelemetry-js#3460 - Deprecated detectResources() in favor of a new method detectResourcesSync() which defers promises into the resource to be resolved later - introduced await resource.waitForAsyncAttributes?.();
kirrg001
added a commit
to instana/opentelemetry-js-contrib
that referenced
this pull request
Apr 11, 2023
…node@0.37.0 - open-telemetry/opentelemetry-js#3460 - Deprecated detectResources() in favor of a new method detectResourcesSync() which defers promises into the resource to be resolved later - introduced await resource.waitForAsyncAttributes?.();
kirrg001
added a commit
to instana/opentelemetry-js-contrib
that referenced
this pull request
Apr 11, 2023
…node@0.37.0 - open-telemetry/opentelemetry-js#3460 - Deprecated detectResources() in favor of a new method detectResourcesSync() which defers promises into the resource to be resolved later - introduced await resource.waitForAsyncAttributes?.();
kirrg001
added a commit
to instana/opentelemetry-js-contrib
that referenced
this pull request
Apr 12, 2023
…node@0.37.0 - open-telemetry/opentelemetry-js#3460 - Deprecated detectResources() in favor of a new method detectResourcesSync() which defers promises into the resource to be resolved later - introduced await resource.waitForAsyncAttributes?.();
Flarna
pushed a commit
to open-telemetry/opentelemetry-js-contrib
that referenced
this pull request
Apr 12, 2023
…node@0.37.0 (#1462) - Refs: open-telemetry/opentelemetry-js#3460 - Deprecated detectResources() in favor of a new method detectResourcesSync() which defers promises into the resource to be resolved later - introduced await resource.waitForAsyncAttributes?.();
2 tasks
4 tasks
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which problem is this PR solving?
Fixes #2912
Short description of the changes
I spoke to @aabmass and agreed on taking on this issue and reopening his PR #2933 and build on it, as I think he has one of the best solutions for this issue.
@opentelemetry/sdk-nodedetectResources()in favor of a new methoddetectResourcesSync()which defers promises into the resource to be resolved laterDetector.detect()signature to allow it to be synchronous and updated documentation that the synchronous variant should be used@opentelemetry/sdk-nodeNodeSDK.start()and its dependencies to now be synchronous (doesn't return a promise). This is a breaking change, but that package is experimental.BatchSpanProcessorBaseandSimpleSpanProcessorto await the resource promise before calling exporters, if the resource has asynchronous attributes AND they have not already resolved. I.e. if there is no promise in the Resource (the case for existing detectors and code), the behavior is unchanged.Type of change
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Checklist: