opentelemetry-resource-detector-deployment
v0.30.0
Published
open telemetry resource detector for deployment
Downloads
5,224
Readme
OpenTelemetry Deployment Resource Detector for Node.js
This module provides automatic resource detector for Deployment
Installation
npm install --save opentelemetry-resource-detector-deployment
Usage
Synchronous SDK Initialization
import { detectSyncResources } from 'opentelemetry-resource-detector-sync-api';
import { deploymentSyncDetector } from 'opentelemetry-resource-detector-deployment';
const resource = detectSyncResources({
detectors: [deploymentSyncDetector, /* add other sync detectors here */],
});
const tracerProvider = new NodeTracerProvider({ resource });
Asynchronous SDK Initialization
import { detectResources } from '@opentelemetry/resources';
import { deploymentDetector } from 'opentelemetry-resource-detector-deployment';
( async () => {
const resource = await detectResources({
detectors: [deploymentDetector, /* add other async detectors here */],
});
const tracerProvider = new NodeTracerProvider({ resource });
// Initialize auto instrumentation plugins and register provider.
// Make sure you don't 'require' instrumented packages elsewhere
// before they are registered here
})();
Attributes
| Attribute | Type | Source |
| --- | --- | --- |
| deployment.environment
| string | process.env.NODE_ENV
|