refactor: Delegate otlp_protocol to standard OTLP env variables

This commit is contained in:
Jade Ellis committed 2026-10-12 10:03:16 +01:00
1 parent fd4cb4a306
commit 3975d31b91
6 files changed
+20 -64

No files matched your search

+4 -9
View File
@@ -56,16 +56,11 @@ pub(crate) fn init(
#[cfg(feature = "otlp_telemetry")]
if config.allow_otlp_metrics {
use opentelemetry_otlp::{MetricExporter, Protocol, WithExportConfig};
use opentelemetry_otlp::MetricExporter;
let exporter = match config.otlp_protocol.as_str() {
| "grpc" => MetricExporter::builder()
.with_tonic()
.with_protocol(Protocol::Grpc)
.build(),
| _ => MetricExporter::builder().with_http().build(),
}
.map_err(|e| err!(Config("allow_otlp_metrics", "{e}")))?;
let exporter = MetricExporter::builder()
.build()
.map_err(|e| err!(Config("allow_otlp_metrics", "{e}")))?;
builder = builder.with_periodic_exporter(exporter);
readers = true;