Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(bootstrap-telemetry): coverage
Browse files Browse the repository at this point in the history
lennartkloock committed Jan 15, 2025
1 parent 4d29f8f commit 76ba1d0
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions crates/bootstrap/telemetry/src/lib.rs
Original file line number Diff line number Diff line change
@@ -354,7 +354,7 @@ mod tests {
use std::sync::Arc;

use bytes::Bytes;
use opentelemetry_sdk::metrics::SdkMeterProvider;
use opentelemetry_sdk::{logs::LoggerProvider, metrics::SdkMeterProvider, trace::TracerProvider};
use scuffle_bootstrap::{GlobalWithoutConfig, Service};

use crate::{TelemetryConfig, TelemetrySvc};
@@ -417,10 +417,18 @@ mod tests {

let exporter = scuffle_metrics::prometheus::exporter().build();
prometheus.register_collector(exporter.collector());
let provider = SdkMeterProvider::builder().with_reader(exporter).build();
opentelemetry::global::set_meter_provider(provider.clone());
let metrics = SdkMeterProvider::builder().with_reader(exporter).build();
opentelemetry::global::set_meter_provider(metrics.clone());

let open_telemetry = crate::opentelemetry::OpenTelemetry::new().with_metrics(provider);
let tracer = TracerProvider::default();
opentelemetry::global::set_tracer_provider(tracer.clone());

let logger = LoggerProvider::builder().build();

let open_telemetry = crate::opentelemetry::OpenTelemetry::new()
.with_metrics(metrics)
.with_traces(tracer)
.with_logs(logger);

Ok(Arc::new(TestGlobal {
bind_addr,

0 comments on commit 76ba1d0

Please sign in to comment.