Skip to content

Commit

Permalink
opentelemetry: Update otel to 0.17.0 (#1853)
Browse files Browse the repository at this point in the history
## Motivation

Support the latest OpenTelemetry specification.

## Solution

Update `opentelemetry` to the latest `0.17.x` release. Breaking changes
upstream in the tracking of parent contexts in otel's `SpanBuilder` have
necessitated a new `OtelData` struct to continue pairing tracing spans
with their associated otel `Context`.
# Conflicts:
#	.github/workflows/check_msrv.yml
#	tracing-opentelemetry/Cargo.toml
#	tracing-opentelemetry/benches/trace.rs
#	tracing-opentelemetry/src/layer.rs
#	tracing-opentelemetry/src/span_ext.rs
#	tracing-opentelemetry/tests/trace_state_propagation.rs
  • Loading branch information
jtescher committed Jan 30, 2022
1 parent 7cf4854 commit f455630
Show file tree
Hide file tree
Showing 9 changed files with 165 additions and 84 deletions.
4 changes: 2 additions & 2 deletions examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ inferno = "0.10.0"
tempfile = "3"

# opentelemetry example
opentelemetry = { version = "0.16", default-features = false, features = ["trace"] }
opentelemetry-jaeger = "0.15"
opentelemetry = { version = "0.17", default-features = false, features = ["trace"] }
opentelemetry-jaeger = "0.16"

# fmt examples
snafu = "0.6.10"
Expand Down
6 changes: 3 additions & 3 deletions tracing-opentelemetry/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ categories = [
keywords = ["tracing", "opentelemetry", "jaeger", "zipkin", "async"]
license = "MIT"
edition = "2018"
rust-version = "1.42.0"
rust-version = "1.46.0"

[features]
default = ["tracing-log"]

[dependencies]
opentelemetry = { version = "0.16", default-features = false, features = ["trace"] }
opentelemetry = { version = "0.17", default-features = false, features = ["trace"] }
tracing = { path = "../tracing", version = "0.1", default-features = false, features = ["std"] }
tracing-core = { path = "../tracing-core", version = "0.1" }
tracing-subscriber = { path = "../tracing-subscriber", version = "0.3", default-features = false, features = ["registry", "std"] }
Expand All @@ -32,7 +32,7 @@ tracing-log = { path = "../tracing-log", version = "0.1", default-features = fal
[dev-dependencies]
async-trait = "0.1"
criterion = { version = "0.3", default_features = false }
opentelemetry-jaeger = "0.15"
opentelemetry-jaeger = "0.16"

[lib]
bench = false
Expand Down
6 changes: 3 additions & 3 deletions tracing-opentelemetry/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ $ firefox http://localhost:16686/

## Supported Rust Versions

Tracing is built against the latest stable release. The minimum supported
version is 1.42. The current Tracing version is not guaranteed to build on Rust
versions earlier than the minimum supported version.
Tracing Opentelemetry is built against the latest stable release. The minimum
supported version is 1.46. The current Tracing version is not guaranteed to
build on Rust versions earlier than the minimum supported version.

Tracing follows the same compiler support policies as the rest of the Tokio
project. The current stable Rust compiler and the three most recent minor
Expand Down
9 changes: 4 additions & 5 deletions tracing-opentelemetry/benches/trace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ fn many_children(c: &mut Criterion) {

group.bench_function("spec_baseline", |b| {
let provider = TracerProvider::default();
let tracer = provider.tracer("bench", None);
let tracer = provider.tracer("bench");
b.iter(|| {
fn dummy(tracer: &Tracer, cx: &Context) {
for _ in 0..99 {
tracer.start_with_context("child", cx.clone());
tracer.start_with_context("child", cx);
}
}

Expand All @@ -41,7 +41,7 @@ fn many_children(c: &mut Criterion) {

{
let provider = TracerProvider::default();
let tracer = provider.tracer("bench", None);
let tracer = provider.tracer("bench");
let otel_layer = tracing_opentelemetry::layer()
.with_tracer(tracer)
.with_tracked_inactivity(false);
Expand Down Expand Up @@ -96,8 +96,7 @@ where
let span = ctx.span(id).expect("Span not found, this is a bug");
let mut extensions = span.extensions_mut();
extensions.insert(
SpanBuilder::from_name(attrs.metadata().name().to_string())
.with_start_time(SystemTime::now()),
SpanBuilder::from_name(attrs.metadata().name()).with_start_time(SystemTime::now()),
);
}

Expand Down
Loading

0 comments on commit f455630

Please sign in to comment.