Skip to content

Commit

Permalink
Use Builder instead of Config to configure tracer
Browse files Browse the repository at this point in the history
  • Loading branch information
TimDiekmann committed Dec 2, 2024
1 parent e7da671 commit bd0697b
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions libs/@local/tracing/src/opentelemetry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,13 @@ where
// - OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT
// - OTEL_SPAN_EVENT_COUNT_LIMIT
// - OTEL_SPAN_LINK_COUNT_LIMIT
let trace_config = trace::Config::default()
let tracer = trace::TracerProvider::builder()
.with_batch_exporter(exporter, runtime::Tokio)
.with_sampler(Sampler::ParentBased(Box::new(Sampler::TraceIdRatioBased(
0.1,
))))
.with_id_generator(RandomIdGenerator::default())
.with_resource(Resource::new(vec![KeyValue::new("service.name", "graph")]));

let tracer = trace::TracerProvider::builder()
.with_batch_exporter(exporter, runtime::Tokio)
.with_config(trace_config)
.with_resource(Resource::new(vec![KeyValue::new("service.name", "graph")]))
.build()
.tracer("graph");

Expand Down

0 comments on commit bd0697b

Please sign in to comment.