generated from Patagia/template-nix
This commit is contained in:
parent
c460e4b992
commit
3b04b82998
1 changed files with 6 additions and 8 deletions
|
@ -96,20 +96,18 @@ pub fn init_tracing(otel_endpoint: Option<&String>, log_stderr: bool) -> Result<
|
|||
None => None,
|
||||
};
|
||||
|
||||
let metrics_layer = match meter_provider {
|
||||
Some(ref p) => Some(MetricsLayer::new(p.to_owned())),
|
||||
None => None,
|
||||
};
|
||||
let metrics_layer = meter_provider
|
||||
.as_ref()
|
||||
.map(|p| MetricsLayer::new(p.to_owned()));
|
||||
|
||||
let tracer_provider = match otel_endpoint {
|
||||
Some(endpoint) => Some(init_tracer_provider(endpoint, resource)?),
|
||||
None => None,
|
||||
};
|
||||
|
||||
let trace_layer = match tracer_provider {
|
||||
Some(ref p) => Some(OpenTelemetryLayer::new(p.tracer("tracing-otel-subscriber"))),
|
||||
None => None,
|
||||
};
|
||||
let trace_layer = tracer_provider
|
||||
.as_ref()
|
||||
.map(|p| OpenTelemetryLayer::new(p.tracer("tracing-otel-subscriber")));
|
||||
|
||||
opentelemetry::global::set_text_map_propagator(TraceContextPropagator::new());
|
||||
|
||||
|
|
Loading…
Reference in a new issue