Skip to content

Commit

Permalink
feat: add container resource detector by default
Browse files Browse the repository at this point in the history
  • Loading branch information
basti1302 committed Jun 10, 2024
1 parent a544e24 commit 708888f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
7 changes: 4 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"@opentelemetry/auto-instrumentations-node": "^0.44.0",
"@opentelemetry/exporter-metrics-otlp-proto": "^0.51.0",
"@opentelemetry/exporter-trace-otlp-proto": "^0.51.0",
"@opentelemetry/resource-detector-container": "^0.3.11",
"@opentelemetry/sdk-metrics": "^1.24.0",
"@opentelemetry/sdk-node": "^0.51.0",
"@opentelemetry/sdk-trace-node": "^1.24.0"
Expand Down
3 changes: 2 additions & 1 deletion src/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-proto';
import { Detector, DetectorSync, envDetector, hostDetector, processDetector, Resource } from '@opentelemetry/resources';
import { PeriodicExportingMetricReader } from '@opentelemetry/sdk-metrics';
import { NodeSDK, NodeSDKConfiguration } from '@opentelemetry/sdk-node';
import { containerDetector } from '@opentelemetry/resource-detector-container';

import { version } from '../package.json';
import PodUidDetector from './detectors/node/opentelemetry-resource-detector-kubernetes-pod';
Expand Down Expand Up @@ -55,7 +56,7 @@ let detectors: (Detector | DetectorSync)[];
if (process.env.OTEL_NODE_RESOURCE_DETECTORS != null) {
detectors = getResourceDetectors();
} else {
detectors = [envDetector, processDetector, hostDetector];
detectors = [envDetector, processDetector, containerDetector, hostDetector];
}
detectors.push(new PodUidDetector());
detectors.push(new ServiceNameFallbackDetector());
Expand Down

0 comments on commit 708888f

Please sign in to comment.