Fix deprecated OTEL API

This commit is contained in:
Chocobozzz 2024-02-21 16:24:21 +01:00
parent d7edb2f8fe
commit 971077bccd
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 6 additions and 5 deletions

View File

@ -51,14 +51,15 @@ class OpenTelemetryMetrics {
const provider = new MeterProvider({
views: [
...NodeJSObserversBuilder.getViews()
],
readers: [
new PrometheusExporter({
host: CONFIG.OPEN_TELEMETRY.METRICS.PROMETHEUS_EXPORTER.HOSTNAME,
port: CONFIG.OPEN_TELEMETRY.METRICS.PROMETHEUS_EXPORTER.PORT
})
]
})
provider.addMetricReader(new PrometheusExporter({
host: CONFIG.OPEN_TELEMETRY.METRICS.PROMETHEUS_EXPORTER.HOSTNAME,
port: CONFIG.OPEN_TELEMETRY.METRICS.PROMETHEUS_EXPORTER.PORT
}))
metrics.setGlobalMeterProvider(provider)
this.meter = metrics.getMeter('default')