This module provides automatic resource detector for Deployment
npm install --save opentelemetry-resource-detector-deployment
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 });
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
})();
Attribute | Type | Source |
---|---|---|
deployment.environment |
string | process.env.NODE_ENV |