From 971077bccdc4ead799b90395db8c853cb2078f1e Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 21 Feb 2024 16:24:21 +0100 Subject: [PATCH] Fix deprecated OTEL API --- server/core/lib/opentelemetry/metrics.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/server/core/lib/opentelemetry/metrics.ts b/server/core/lib/opentelemetry/metrics.ts index 9d70fbe19..f29942fd5 100644 --- a/server/core/lib/opentelemetry/metrics.ts +++ b/server/core/lib/opentelemetry/metrics.ts @@ -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')