Update opentelemetry to v0.16.x
This commit is contained in:
parent
6c43e56607
commit
fe1ab1e677
|
@ -52,7 +52,7 @@ log = { version = "0.4.14", optional = true }
|
||||||
secrecy = { version = "0.7.0", optional = true }
|
secrecy = { version = "0.7.0", optional = true }
|
||||||
tracinglib = { version = "0.1.25", optional = true, package = "tracing" }
|
tracinglib = { version = "0.1.25", optional = true, package = "tracing" }
|
||||||
tracing-futures = { version = "0.2.5", optional = true, features = ["std-future", "futures-03"] }
|
tracing-futures = { version = "0.2.5", optional = true, features = ["std-future", "futures-03"] }
|
||||||
opentelemetry = { version = "0.13.0", optional = true }
|
opentelemetry = { version = "0.16.0", optional = true, default-features = false, features = ["trace"] }
|
||||||
url = { version = "2.2.1", optional = true }
|
url = { version = "2.2.1", optional = true }
|
||||||
uuid = { version = "0.8.2", optional = true, features = ["v4", "serde"] }
|
uuid = { version = "0.8.2", optional = true, features = ["v4", "serde"] }
|
||||||
rust_decimal = { version = "1.14.3", optional = true }
|
rust_decimal = { version = "1.14.3", optional = true }
|
||||||
|
|
|
@ -162,18 +162,17 @@ impl<T: Tracer + Send + Sync> Extension for OpenTelemetryExtension<T> {
|
||||||
];
|
];
|
||||||
let span = self
|
let span = self
|
||||||
.tracer
|
.tracer
|
||||||
.span_builder(&info.path_node.to_string())
|
.span_builder(info.path_node.to_string())
|
||||||
.with_kind(SpanKind::Server)
|
.with_kind(SpanKind::Server)
|
||||||
.with_attributes(attributes)
|
.with_attributes(attributes)
|
||||||
.start(&*self.tracer);
|
.start(&*self.tracer);
|
||||||
next.run(ctx, info)
|
next.run(ctx, info)
|
||||||
.with_context(OpenTelemetryContext::current_with_span(span))
|
.with_context(OpenTelemetryContext::current_with_span(span))
|
||||||
.map_err(|err| {
|
.inspect_err(|err| {
|
||||||
let current_cx = OpenTelemetryContext::current();
|
let current_cx = OpenTelemetryContext::current();
|
||||||
current_cx
|
current_cx
|
||||||
.span()
|
.span()
|
||||||
.add_event("error".to_string(), vec![KEY_ERROR.string(err.to_string())]);
|
.add_event("error".to_string(), vec![KEY_ERROR.string(err.to_string())]);
|
||||||
err
|
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user