-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(config): Optimize instrumentation setup for better performance
- Loading branch information
1 parent
d516cb4
commit 635eb3a
Showing
3 changed files
with
16 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,18 @@ | ||
import { NodeSDK } from '@opentelemetry/sdk-node' | ||
import { getNodeAutoInstrumentations } from '@opentelemetry/auto-instrumentations-node' | ||
import { | ||
PeriodicExportingMetricReader, | ||
ConsoleMetricExporter, | ||
} from '@opentelemetry/sdk-metrics' | ||
import opentelemetry from '@opentelemetry/sdk-node' | ||
import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http' | ||
import { getNodeAutoInstrumentations } from '@opentelemetry/auto-instrumentations-node' | ||
|
||
const otlpExporter = new OTLPTraceExporter({ | ||
url: 'http://localhost:4318/v1/traces', | ||
const sdk = new opentelemetry.NodeSDK({ | ||
traceExporter: new OTLPTraceExporter(), | ||
instrumentations: [ | ||
getNodeAutoInstrumentations({ | ||
// we recommend disabling fs autoinstrumentation since it can be noisy | ||
// and expensive during startup | ||
'@opentelemetry/instrumentation-fs': { | ||
enabled: false, | ||
}, | ||
}), | ||
], | ||
}) | ||
|
||
export const sdk = new NodeSDK({ | ||
traceExporter: otlpExporter, | ||
metricReader: new PeriodicExportingMetricReader({ | ||
exporter: new ConsoleMetricExporter(), | ||
}), | ||
instrumentations: [getNodeAutoInstrumentations()], | ||
}) | ||
sdk.start() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters