aws-observability / aws-otel-js

AWS Distro for OpenTelemetry JavaScript SDK
https://aws-otel.github.io/
Apache License 2.0
36 stars 22 forks source link

Usage of @opentelemetry/resource-detector-aws #83

Closed sgracias1 closed 1 year ago

sgracias1 commented 2 years ago

Hello, I am a little confused on what the intended usage pattern for the @opentelemetry/resource-detector-aws package. npm shows this code snippet

import { detectResources } from '@opentelemetry/resources';
import { awsEc2Detector } from '@opentelemetry/resource-detector-aws'
const resource = await detectResources({
   detectors: [awsEc2Detector],
})

const tracerProvider = new NodeTracerProvider({ resource });

However the await functions means this cannot be at the top level in a js file and instead would need to be inside an async function but then we cannot guarantee this code executes before the servers require statements which is necessary for instrumentations to function

How is the module intended to be used?

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 90 days with no activity. If you want to keep this issue open, please just leave a comment below and auto-close will be canceled

github-actions[bot] commented 1 year ago

This issue was closed because it has been marked as stale for 30 days with no activity.