Skip to content

Commit

Permalink
Dont emit metrics to console
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-richardson committed Nov 28, 2024
1 parent b748590 commit b29bcd2
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 9 deletions.
1 change: 0 additions & 1 deletion server/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ dependencies {
implementation('io.opentelemetry:opentelemetry-api:1.44.1')
implementation('io.opentelemetry:opentelemetry-sdk:1.44.1')
implementation('io.opentelemetry:opentelemetry-exporter-otlp:1.44.1')
implementation('io.opentelemetry:opentelemetry-exporter-logging:1.44.1')
implementation 'io.opentelemetry:opentelemetry-sdk-metrics:1.28.0'
implementation('io.opentelemetry:opentelemetry-semconv:1.31.0-alpha-SNAPSHOT')
implementation('io.opentelemetry:opentelemetry-exporter-zipkin')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ private MetricExporter buildMetricsExporter(String endpoint, Map<String, String>
return null;
}

private SpanProcessor buildGrpcSpanProcessor(Map<String, String> headers, String exporterEndpoint, MetricExporter metricsExporter) {
private SpanProcessor buildGrpcSpanProcessor(Map<String, String> headers, String exporterEndpoint, @Nullable MetricExporter metricsExporter) {

var serviceNameResource = Resource.create(Attributes.of(ResourceAttributes.SERVICE_NAME, PluginConstants.SERVICE_NAME));
var meterProvider = OTELMetrics.getOTELMeterProvider(metricsExporter, serviceNameResource);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.octopus.teamcity.opentelemetry.server.helpers;

import io.opentelemetry.api.GlobalOpenTelemetry;
import io.opentelemetry.exporter.logging.LoggingMetricExporter;
import io.opentelemetry.sdk.OpenTelemetrySdk;
import io.opentelemetry.sdk.metrics.SdkMeterProvider;
import io.opentelemetry.sdk.metrics.export.MetricExporter;
Expand All @@ -26,13 +25,8 @@ public static SdkMeterProvider getOTELMeterProvider(@Nullable MetricExporter met
if (metricsConfigured.get()) return sdkMeterProvider;
metricsConfigured.set(true);

var loggingMetricExporter = LoggingMetricExporter.create();
var consoleLogMetricReader = PeriodicMetricReader.builder(loggingMetricExporter)
.setInterval(Duration.ofSeconds(10))
.build();
var meterProviderBuilder = SdkMeterProvider.builder()
.setResource(Resource.getDefault().merge(serviceNameResource))
.registerMetricReader(consoleLogMetricReader);
.setResource(Resource.getDefault().merge(serviceNameResource));
if (metricExporter != null) {
var providedMetricExporterBuilder = PeriodicMetricReader.builder(metricExporter)
.setInterval(Duration.ofSeconds(10))
Expand Down

0 comments on commit b29bcd2

Please sign in to comment.