Update opentelemetry to v0.16.x

This commit is contained in:
Julian Tescher 2021-08-07 13:07:38 -07:00
parent 9a76ea9896
commit 85fd626f30
No known key found for this signature in database
GPG Key ID: 071E80334C3B170F
2 changed files with 3 additions and 4 deletions

View File

@ -52,7 +52,7 @@ log = { version = "0.4.14", optional = true }
secrecy = { version = "0.7.0", optional = true }
tracinglib = { version = "0.1.25", optional = true, package = "tracing" }
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 }
uuid = { version = "0.8.2", optional = true, features = ["v4", "serde"] }
rust_decimal = { version = "1.14.3", optional = true }

View File

@ -162,18 +162,17 @@ impl<T: Tracer + Send + Sync> Extension for OpenTelemetryExtension<T> {
];
let span = self
.tracer
.span_builder(&info.path_node.to_string())
.span_builder(info.path_node.to_string())
.with_kind(SpanKind::Server)
.with_attributes(attributes)
.start(&*self.tracer);
next.run(ctx, info)
.with_context(OpenTelemetryContext::current_with_span(span))
.map_err(|err| {
.inspect_err(|err| {
let current_cx = OpenTelemetryContext::current();
current_cx
.span()
.add_event("error".to_string(), vec![KEY_ERROR.string(err.to_string())]);
err
})
.await
}