Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(auto-instrumentations-node): Expose getting resource detectors (#…
…1772) * feat(auto-instrumentations-node): Expose getting resource detectors The auto instrumentation package provides users with a very easy way to instrument their application, either from the commandline or programatically. Users wishing the configure these instrumentations can also call `getNodeAutoInstrumentations`. This commit also exposes `getResourceDetectorsFromEnv`, so that users configuring or somehow wishing to change the easy to use autoinstrumentation entrypoint can also use the preconfigured resource detectors. Since the autoinstrumentation package sets its exports, this function was previously inaccessible. Usage can look like this: ```js const { getNodeAutoInstrumentations, getResourceDetectorsFromEnv } = require('@opentelemetry/auto-instrumentations-node'); const opentelemetry = require('@opentelemetry/sdk-node'); const sdk = new opentelemetry.NodeSDK({ instrumentations: getNodeAutoInstrumentations({ '@opentelemetry/instrumentation-fs': { enabled: false }, }), resourceDetectors: getResourceDetectorsFromEnv(), }); // use the sdk ``` Workarounds can be found [elsewhere in the opentelemetry repos](https://github.com/open-telemetry/opentelemetry-demo/blob/855bde3588b0fe85e500bec185dc2f311b15f98a/src/paymentservice/opentelemetry.js#L28-L38). These can be fixed once a release is made. Resolves #1531. * style: Align indentation --------- Co-authored-by: Amir Blum <amirgiraffe@gmail.com>
- Loading branch information