-
Notifications
You must be signed in to change notification settings - Fork 804
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
How to handle "Accessing resource attributes before async attributes settled" errors #4638
Comments
I'm also seeing this message. My otel config is here: https://gist.github.com/tmokmss/b6b0d639658161cd28519a65992866f9 packages versions are same as the OP. |
Encountered the same issue and wrote a simple workaround while awaiting the actual fix to land: import {
Detector,
DetectorSync,
IResource,
ResourceDetectionConfig,
envDetectorSync,
hostDetectorSync,
processDetectorSync,
} from "@opentelemetry/resources"
function awaitAttributes(detector: DetectorSync): Detector {
return {
async detect(config?: ResourceDetectionConfig): Promise<IResource> {
const resource = detector.detect(config)
await resource.waitForAsyncAttributes?.()
return resource
},
}
}
const sdk = new opentelemetry.NodeSDK({
// ...
resourceDetectors: [
awaitAttributes(envDetectorSync),
awaitAttributes(processDetectorSync),
awaitAttributes(hostDetectorSync),
],
}) |
@timosaikkonen Your solution was really helpful! |
- see more for details @ open-telemetry/opentelemetry-js#4638
I too faced same issue in my application , when I removed the below environment definition , the error is NO more appears . My application is built in nodejs
Anyone know the significance of this parameter and why error appear when I enable this on deployment ? Thanks |
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 14 days. |
Not stale. |
It would be helpful if someone can share a stack trace of what is triggering the log message. OTel SDK components should already be awaiting If this is happening in your own code, just |
In the logs of one of our applications I see the following error from time to time:
Accessing resource attributes before async attributes settled
I took a look into https://github.com/open-telemetry/opentelemetry-js/blob/main/packages/opentelemetry-resources/src/Resource.ts#L98 which I assume is the code line that writes this error.
I'm not sure what to do with this error. Is is necessary to take an action or can this error be ignored? There isn't really much information about the origin of this error so I'm not sure how to find the root problem/how to debug this.
We are using the following packages:
In our instrumentation create a new SDK using the following resource:
Maybe someone has an idea how to handle this.
The text was updated successfully, but these errors were encountered: