Skip to content

Commit

Permalink
Upgrade to opentelemetry 0.27
Browse files Browse the repository at this point in the history
  • Loading branch information
djc authored and rami3l committed Nov 19, 2024
1 parent c483273 commit bd5ce47
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 26 deletions.
22 changes: 12 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,9 @@ license = "MIT OR Apache-2.0"
[workspace.dependencies]
anyhow = "1.0.69"
fs_at = "0.2.1"
opentelemetry = "0.26"
opentelemetry-otlp = "0.26"
opentelemetry_sdk = { version = "0.26", features = ["rt-tokio"] }
opentelemetry = "0.27"
opentelemetry-otlp = "0.27"
opentelemetry_sdk = { version = "0.27", features = ["rt-tokio"] }
platforms = "3.4"
proptest = "1.1.0"
tempfile = "3.8"
Expand All @@ -156,7 +156,7 @@ tokio = { version = "1.26.0", default-features = false, features = ["macros", "r
tokio-retry = { version = "0.3.0" }
tokio-stream = { version = "0.1.14" }
tracing = "0.1"
tracing-opentelemetry = "0.27"
tracing-opentelemetry = "0.28"
tracing-subscriber = "0.3.16"
url = "2.4"
walkdir = "2"
Expand Down
25 changes: 13 additions & 12 deletions src/cli/log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,27 +152,28 @@ where
fn telemetry_default_tracer() -> Tracer {
use std::time::Duration;

use opentelemetry::{global, trace::TracerProvider, KeyValue};
use opentelemetry::{global, trace::TracerProvider as _, KeyValue};
use opentelemetry_otlp::WithExportConfig;
use opentelemetry_sdk::{
trace::{Config, Sampler},
runtime::Tokio,
trace::{Config, Sampler, TracerProvider},
Resource,
};

let provider = opentelemetry_otlp::new_pipeline()
.tracing()
.with_exporter(
opentelemetry_otlp::new_exporter()
.tonic()
.with_timeout(Duration::from_secs(3)),
)
.with_trace_config(
let exporter = opentelemetry_otlp::SpanExporter::builder()
.with_tonic()
.with_timeout(Duration::from_secs(3))
.build()
.unwrap();

let provider = TracerProvider::builder()
.with_config(
Config::default()
.with_sampler(Sampler::AlwaysOn)
.with_resource(Resource::new(vec![KeyValue::new("service.name", "rustup")])),
)
.install_batch(opentelemetry_sdk::runtime::Tokio)
.expect("error installing `OtlpTracePipeline` in the current `tokio` runtime");
.with_batch_exporter(exporter, Tokio)
.build();

global::set_tracer_provider(provider.clone());
provider.tracer("tracing-otel-subscriber")
Expand Down

0 comments on commit bd5ce47

Please sign in to comment.