Skip to content

Commit fba170c

Browse files
committed
Update tracing example
1 parent 5b5c6b8 commit fba170c

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

examples/tracing/Cargo.toml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ authors = ["Jan Kuehle <[email protected]>"]
55
edition = "2018"
66

77
[dependencies]
8-
opentelemetry = { version = "0.12.0", features = ["tokio-support"] }
9-
opentelemetry-application-insights = { version = "0.12.0", features = ["reqwest-client"] }
10-
reqwest = "0.11.2"
11-
tokio = { version = "1.4.0", features = ["rt", "rt-multi-thread", "macros", "process", "time"] }
12-
tracing = "0.1.22"
13-
tracing-attributes = "0.1.11"
14-
tracing-futures = "0.2.4"
15-
tracing-opentelemetry = "0.11.0"
16-
tracing-subscriber = "0.2.15"
8+
opentelemetry = { version = "0.14.0", features = ["rt-tokio"] }
9+
opentelemetry-application-insights = { version = "0.15.0", features = ["reqwest-client"] }
10+
reqwest = "0.11.3"
11+
tokio = { version = "1.6.0", features = ["rt", "rt-multi-thread", "macros", "process", "time"] }
12+
tracing = "0.1.26"
13+
tracing-attributes = "0.1.15"
14+
tracing-futures = "0.2.5"
15+
tracing-opentelemetry = "0.13.0"
16+
tracing-subscriber = "0.2.18"

examples/tracing/src/main.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,9 @@ async fn main() -> Result<(), Box<dyn Error>> {
4747

4848
let instrumentation_key =
4949
env::var("INSTRUMENTATION_KEY").expect("env var INSTRUMENTATION_KEY should exist");
50-
let (tracer, _uninstall) =
51-
opentelemetry_application_insights::new_pipeline(instrumentation_key)
52-
.with_client(reqwest::Client::new())
53-
.install();
50+
let tracer = opentelemetry_application_insights::new_pipeline(instrumentation_key)
51+
.with_client(reqwest::Client::new())
52+
.install_batch(opentelemetry::runtime::Tokio);
5453
let telemetry = tracing_opentelemetry::layer().with_tracer(tracer);
5554
let subscriber = Registry::default().with(telemetry);
5655
tracing::subscriber::set_global_default(subscriber).expect("setting global default failed");
@@ -73,5 +72,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
7372
}
7473
}
7574

75+
opentelemetry::global::shutdown_tracer_provider();
76+
7677
Ok(())
7778
}

0 commit comments

Comments
 (0)