Skip to content
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

fix(resources): wait for async attributes for detecting resources #4687

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

ziolekjj
Copy link

@ziolekjj ziolekjj commented May 8, 2024

Which problem is this PR solving?

Recently, HostDetector was added as default for detectors in NodeSDK, this produces the error message: Accessing resource attributes before async attributes settled, as detectResourcesSync is not waiting for async attributes to be resolved for HostDetector, what causes the lack of machine_id passed to it.

Fixes #4638

Short description of the changes

I've updated the test case for the issue and added an await statement to wait for async attributes to be resolved for the detectResourcesSync function.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

I've added unit tests, the configuration for reproducing is described in the linked issue #4638

  • Updated a test to detect-resources.test.ts to reflect the behavior of the HostDetector with async attributes

Copy link

linux-foundation-easycla bot commented May 8, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

@ziolekjj ziolekjj changed the title fix(opentelemetry-resources): wait for async attributes for detecting resources fix(resources): wait for async attributes for detecting resources May 8, 2024
@ziolekjj ziolekjj marked this pull request as ready for review May 8, 2024 17:23
@ziolekjj ziolekjj requested a review from a team as a code owner May 8, 2024 17:23
Copy link

@MichalZalecki MichalZalecki left a comment

Choose a reason for hiding this comment

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

I've tested the change locally. It solved the issue, the message is not logged and host.id is present on spans 👌

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.

How to handle "Accessing resource attributes before async attributes settled" errors
2 participants