Skip to content

Commit

Permalink
Set global opentelemetry error handler to use tracing::error
Browse files Browse the repository at this point in the history
  • Loading branch information
yuandrew committed Dec 10, 2024
1 parent dd37e29 commit efc31e6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion core/src/telemetry/otel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use super::{
};
use crate::{abstractions::dbg_panic, telemetry::metrics::DEFAULT_S_BUCKETS};
use opentelemetry::{
self,
self, global,
metrics::{Meter, MeterProvider as MeterProviderT},
Key, KeyValue, Value,
};
Expand Down Expand Up @@ -160,6 +160,9 @@ impl<U> MemoryGauge<U> {
pub fn build_otlp_metric_exporter(
opts: OtelCollectorOptions,
) -> Result<CoreOtelMeter, anyhow::Error> {
global::set_error_handler(|err| {
tracing::error!("{}", err);
})?;
let mut exporter =
opentelemetry_otlp::TonicExporterBuilder::default().with_endpoint(opts.url.to_string());
if opts.url.scheme() == "https" || opts.url.scheme() == "grpcs" {
Expand Down

0 comments on commit efc31e6

Please sign in to comment.