From dcd9970b3b39e98bebb0a647eca364b875665718 Mon Sep 17 00:00:00 2001 From: Daniel Lundin Date: Sat, 30 Nov 2024 01:07:13 +0100 Subject: [PATCH] chore: remove otlp logging Let's stick with traces and metrics for now? --- controller/src/instrumentation.rs | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/controller/src/instrumentation.rs b/controller/src/instrumentation.rs index 44f3807..360a539 100644 --- a/controller/src/instrumentation.rs +++ b/controller/src/instrumentation.rs @@ -1,9 +1,7 @@ use anyhow::{anyhow, Result}; use once_cell::sync::Lazy; use opentelemetry::{trace::TracerProvider as _, KeyValue}; -use opentelemetry_appender_tracing::layer::OpenTelemetryTracingBridge; use opentelemetry_sdk::{ - logs::LoggerProvider, metrics::{MeterProviderBuilder, PeriodicReader, SdkMeterProvider}, runtime, trace::{RandomIdGenerator, Sampler, TracerProvider}, @@ -26,18 +24,6 @@ static RESOURCE: Lazy = Lazy::new(|| { ]) }); -// Construct LoggingProdiver for LoggingLayer -fn init_logging_provider() -> Result { - let exporter = opentelemetry_otlp::LogExporter::builder() - .with_tonic() - .build()?; - let logging_provider: LoggerProvider = LoggerProvider::builder() - .with_resource(RESOURCE.clone()) - .with_batch_exporter(exporter, runtime::Tokio) - .build(); - Ok(logging_provider) -} - // Construct MeterProvider for MetricsLayer fn init_meter_provider() -> Result { let exporter = opentelemetry_otlp::MetricExporter::builder() @@ -81,7 +67,6 @@ fn init_tracer_provider() -> Result { // Initialize tracing-subscriber and return OtelGuard for opentelemetry-related termination processing pub fn init_tracing_subscriber() -> Result { - let logging_provider = init_logging_provider()?; let meter_provider = init_meter_provider()?; let tracer_provider = init_tracer_provider()?; @@ -92,18 +77,15 @@ pub fn init_tracing_subscriber() -> Result { .with(tracing_subscriber::fmt::layer()) .with(MetricsLayer::new(meter_provider.clone())) .with(OpenTelemetryLayer::new(tracer)) - .with(OpenTelemetryTracingBridge::new(&logging_provider)) .init(); Ok(OtelGuard { - logging_provider, meter_provider, tracer_provider, }) } pub struct OtelGuard { - logging_provider: LoggerProvider, meter_provider: SdkMeterProvider, tracer_provider: TracerProvider, } @@ -113,9 +95,6 @@ impl Drop for OtelGuard { if let Err(err) = self.tracer_provider.shutdown() { eprintln!("{err:?}"); } - if let Err(err) = self.logging_provider.shutdown() { - eprintln!("{err:?}"); - } if let Err(err) = self.meter_provider.shutdown() { eprintln!("{err:?}"); }