diff --git a/server/src/main/java/com/octopus/teamcity/opentelemetry/server/helpers/OTELMetrics.java b/server/src/main/java/com/octopus/teamcity/opentelemetry/server/helpers/OTELMetrics.java index cde47d2..b5c6c22 100644 --- a/server/src/main/java/com/octopus/teamcity/opentelemetry/server/helpers/OTELMetrics.java +++ b/server/src/main/java/com/octopus/teamcity/opentelemetry/server/helpers/OTELMetrics.java @@ -18,13 +18,9 @@ public static SdkMeterProvider getOTELMeterProvider(@Nullable MetricExporter met .setInterval(Duration.ofSeconds(10)) .build(); - var sdkMeterProvider = SdkMeterProvider.builder() + return SdkMeterProvider.builder() .setResource(Resource.getDefault().merge(serviceNameResource)) .registerMetricReader(providedMetricExporter) .build(); - - // Shutdown hooks to close resources properly - Runtime.getRuntime().addShutdownHook(new Thread(sdkMeterProvider::close)); - return sdkMeterProvider; } }