Skip to content

Commit

Permalink
fix: fix open telemetry init
Browse files Browse the repository at this point in the history
  • Loading branch information
vicanso committed Dec 14, 2024
1 parent 571d199 commit a6784a0
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions src/otel/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use opentelemetry::{
use opentelemetry_otlp::WithExportConfig;
use opentelemetry_sdk::{
propagation::{BaggagePropagator, TraceContextPropagator},
trace::{self, BatchConfigBuilder, RandomIdGenerator, Sampler},
trace::{BatchConfigBuilder, RandomIdGenerator, Sampler},
Resource,
};
use pingora::{server::ShutdownWatch, services::background::BackgroundService};
Expand Down Expand Up @@ -163,18 +163,14 @@ impl BackgroundService for TracerService {
.build();
opentelemetry_sdk::trace::TracerProvider::builder()
.with_span_processor(batch)
.with_config(
trace::Config::default()
// TODO smapler config
.with_sampler(Sampler::AlwaysOn)
.with_id_generator(RandomIdGenerator::default())
.with_max_attributes_per_span(self.max_attributes)
.with_max_events_per_span(self.max_events)
.with_resource(Resource::new(vec![KeyValue::new(
"service.name",
get_service_name(&self.name),
)])),
)
.with_sampler(Sampler::AlwaysOn)
.with_id_generator(RandomIdGenerator::default())
.with_max_attributes_per_span(self.max_attributes)
.with_max_events_per_span(self.max_events)
.with_resource(Resource::new(vec![KeyValue::new(
"service.name",
get_service_name(&self.name),
)]))
.build()
});

Expand Down

0 comments on commit a6784a0

Please sign in to comment.