From 83862197eccabc9562d8636198b4afbdadcf8b09 Mon Sep 17 00:00:00 2001 From: Andy Lok Date: Thu, 26 Oct 2023 18:28:54 +0800 Subject: [PATCH 1/4] update opentelemetry Signed-off-by: Andy Lok --- minitrace-opentelemetry/Cargo.toml | 2 +- minitrace-opentelemetry/src/lib.rs | 6 +++--- minitrace/Cargo.toml | 4 ++-- minitrace/examples/asynchronous.rs | 5 +++-- minitrace/examples/synchronous.rs | 5 +++-- minitrace/examples/unit_test.rs | 5 ++++- 6 files changed, 16 insertions(+), 11 deletions(-) diff --git a/minitrace-opentelemetry/Cargo.toml b/minitrace-opentelemetry/Cargo.toml index 1359ce39..473ec472 100644 --- a/minitrace-opentelemetry/Cargo.toml +++ b/minitrace-opentelemetry/Cargo.toml @@ -16,7 +16,7 @@ keywords = ["tracing", "span", "datadog", "jaeger", "opentelemetry"] futures = { version = "0.3", features = ["executor"] } log = "0.4" minitrace = { path = "../minitrace" } -opentelemetry = { version = "0.19", features = ["trace"] } +opentelemetry = { version = "0.20", features = ["trace"] } [dev-dependencies] opentelemetry-otlp = { version = "0.12", features = ["trace"] } diff --git a/minitrace-opentelemetry/src/lib.rs b/minitrace-opentelemetry/src/lib.rs index 97aacb4e..b1a3f018 100644 --- a/minitrace-opentelemetry/src/lib.rs +++ b/minitrace-opentelemetry/src/lib.rs @@ -57,13 +57,13 @@ impl OpenTelemetryReporter { .iter() .map(move |span| SpanData { span_context: SpanContext::new( - span.trace_id.0.to_be_bytes().into(), - span.span_id.0.to_be_bytes().into(), + span.trace_id.0.into(), + span.span_id.0.into(), TraceFlags::default(), false, TraceState::default(), ), - parent_span_id: span.parent_id.0.to_be_bytes().into(), + parent_span_id: span.parent_id.0.into(), name: span.name.clone(), start_time: UNIX_EPOCH + Duration::from_nanos(span.begin_time_unix_ns), end_time: UNIX_EPOCH diff --git a/minitrace/Cargo.toml b/minitrace/Cargo.toml index 0eb2365c..469e71c4 100644 --- a/minitrace/Cargo.toml +++ b/minitrace/Cargo.toml @@ -42,8 +42,8 @@ minitrace-jaeger = { version = "0.5.1", path = "../minitrace-jaeger" } minitrace-opentelemetry = { version = "0.5.1", path = "../minitrace-opentelemetry" } mockall = "0.11" once_cell = "1" -opentelemetry = { version = "0.19", features = ["trace"] } -opentelemetry-otlp = { version = "0.12", features = ["trace"] } +opentelemetry = { version = "0.20", features = ["trace"] } +opentelemetry-otlp = { version = "0.13", features = ["trace"] } rand = "0.8" rustracing = "0.6" serial_test = "2" diff --git a/minitrace/examples/asynchronous.rs b/minitrace/examples/asynchronous.rs index 9ac6011e..d2f9ce77 100644 --- a/minitrace/examples/asynchronous.rs +++ b/minitrace/examples/asynchronous.rs @@ -95,14 +95,15 @@ impl ReportAll { }, opentelemetry_otlp::TonicConfig::default(), ) - .unwrap(), + .expect("initialize oltp exporter"), opentelemetry::trace::SpanKind::Server, Cow::Owned(opentelemetry::sdk::Resource::new([ - opentelemetry::KeyValue::new("service.name", "asynchronous"), + opentelemetry::KeyValue::new("service.name", "asynchronous(opentelemetry)"), ])), opentelemetry::InstrumentationLibrary::new( "example-crate", Some(env!("CARGO_PKG_VERSION")), + None::<&'static str>, None, ), ), diff --git a/minitrace/examples/synchronous.rs b/minitrace/examples/synchronous.rs index da99f642..29279e3b 100644 --- a/minitrace/examples/synchronous.rs +++ b/minitrace/examples/synchronous.rs @@ -71,14 +71,15 @@ impl ReportAll { }, opentelemetry_otlp::TonicConfig::default(), ) - .unwrap(), + .expect("initialize oltp exporter"), opentelemetry::trace::SpanKind::Server, Cow::Owned(opentelemetry::sdk::Resource::new([ - opentelemetry::KeyValue::new("service.name", "synchronous"), + opentelemetry::KeyValue::new("service.name", "synchronous(opentelemetry)"), ])), opentelemetry::InstrumentationLibrary::new( "example-crate", Some(env!("CARGO_PKG_VERSION")), + None::<&'static str>, None, ), ), diff --git a/minitrace/examples/unit_test.rs b/minitrace/examples/unit_test.rs index 795ff3ce..6a18424f 100644 --- a/minitrace/examples/unit_test.rs +++ b/minitrace/examples/unit_test.rs @@ -57,7 +57,10 @@ mod test_util { pub fn closure_name() -> &'static str { let full_name = std::any::type_name::(); - full_name.rsplit("::").next().unwrap() + full_name + .rsplit("::") + .find(|name| *name != "{{closure}}") + .unwrap() } } From 99a608ef7e0844832ca678f5310be72df39d36bb Mon Sep 17 00:00:00 2001 From: Andy Lok Date: Thu, 26 Oct 2023 18:29:14 +0800 Subject: [PATCH 2/4] bump version 0.6.0 Signed-off-by: Andy Lok --- minitrace-datadog/Cargo.toml | 2 +- minitrace-jaeger/Cargo.toml | 2 +- minitrace-macro/Cargo.toml | 2 +- minitrace-opentelemetry/Cargo.toml | 2 +- minitrace/Cargo.toml | 10 +++++----- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/minitrace-datadog/Cargo.toml b/minitrace-datadog/Cargo.toml index 1a12e454..560ac82a 100644 --- a/minitrace-datadog/Cargo.toml +++ b/minitrace-datadog/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "minitrace-datadog" -version = "0.5.1" +version = "0.6.0" authors = ["The TiKV Project Authors"] license = "Apache-2.0" edition = "2021" diff --git a/minitrace-jaeger/Cargo.toml b/minitrace-jaeger/Cargo.toml index e40628f7..7c46b25d 100644 --- a/minitrace-jaeger/Cargo.toml +++ b/minitrace-jaeger/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "minitrace-jaeger" -version = "0.5.1" +version = "0.6.0" authors = ["The TiKV Project Authors"] license = "Apache-2.0" edition = "2021" diff --git a/minitrace-macro/Cargo.toml b/minitrace-macro/Cargo.toml index 440fea26..6e652d25 100644 --- a/minitrace-macro/Cargo.toml +++ b/minitrace-macro/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "minitrace-macro" -version = "0.5.1" +version = "0.6.0" authors = ["The TiKV Project Authors"] license = "Apache-2.0" edition = "2021" diff --git a/minitrace-opentelemetry/Cargo.toml b/minitrace-opentelemetry/Cargo.toml index 473ec472..ce44e126 100644 --- a/minitrace-opentelemetry/Cargo.toml +++ b/minitrace-opentelemetry/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "minitrace-opentelemetry" -version = "0.5.1" +version = "0.6.0" authors = ["The TiKV Project Authors"] license = "Apache-2.0" edition = "2021" diff --git a/minitrace/Cargo.toml b/minitrace/Cargo.toml index 469e71c4..ecba8d55 100644 --- a/minitrace/Cargo.toml +++ b/minitrace/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "minitrace" -version = "0.5.1" +version = "0.6.0" authors = ["The TiKV Project Authors"] license = "Apache-2.0" edition = "2021" @@ -17,7 +17,7 @@ enable = [] [dependencies] futures = "0.3" -minitrace-macro = { version = "0.5.1", path = "../minitrace-macro" } +minitrace-macro = { version = "0.6.0", path = "../minitrace-macro" } minstant = "0.1" parking_lot = "0.12" pin-project = "1" @@ -37,9 +37,9 @@ futures-timer = "3" log = "0.4" logcall = "0.1.4" minitrace = { path = ".", features = ["enable"] } -minitrace-datadog = { version = "0.5.1", path = "../minitrace-datadog" } -minitrace-jaeger = { version = "0.5.1", path = "../minitrace-jaeger" } -minitrace-opentelemetry = { version = "0.5.1", path = "../minitrace-opentelemetry" } +minitrace-datadog = { version = "0.6.0", path = "../minitrace-datadog" } +minitrace-jaeger = { version = "0.6.0", path = "../minitrace-jaeger" } +minitrace-opentelemetry = { version = "0.6.0", path = "../minitrace-opentelemetry" } mockall = "0.11" once_cell = "1" opentelemetry = { version = "0.20", features = ["trace"] } From f3bf3347d2c3b2dd796aee6adb70e0f037cad35f Mon Sep 17 00:00:00 2001 From: Andy Lok Date: Thu, 26 Oct 2023 18:51:17 +0800 Subject: [PATCH 3/4] update changelog Signed-off-by: Andy Lok --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 97968123..cd9238b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## v0.6.0 + - Span name and event name now accept both `&'static str` and `String` (`Into>`), which previously only accept `&'static str`. - `with_property` and `with_properties` now accept `impl Into>`, which previously accept `Cow<'static, str>`. From 5a88db4ad680ca736f42915971c5e81f9e7fb873 Mon Sep 17 00:00:00 2001 From: Andy Lok Date: Thu, 26 Oct 2023 19:18:10 +0800 Subject: [PATCH 4/4] fix Signed-off-by: Andy Lok --- minitrace-opentelemetry/Cargo.toml | 2 +- minitrace-opentelemetry/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/minitrace-opentelemetry/Cargo.toml b/minitrace-opentelemetry/Cargo.toml index ce44e126..1e262aa2 100644 --- a/minitrace-opentelemetry/Cargo.toml +++ b/minitrace-opentelemetry/Cargo.toml @@ -19,6 +19,6 @@ minitrace = { path = "../minitrace" } opentelemetry = { version = "0.20", features = ["trace"] } [dev-dependencies] -opentelemetry-otlp = { version = "0.12", features = ["trace"] } +opentelemetry-otlp = { version = "0.13", features = ["trace"] } rand = "0.8" tokio = { version = "1", features = ["rt-multi-thread"] } diff --git a/minitrace-opentelemetry/README.md b/minitrace-opentelemetry/README.md index 67b70bf5..be37cac2 100644 --- a/minitrace-opentelemetry/README.md +++ b/minitrace-opentelemetry/README.md @@ -54,7 +54,7 @@ let reporter = OpenTelemetryReporter::new( .unwrap(), SpanKind::Server, Cow::Owned(Resource::new([KeyValue::new("service.name", "asynchronous")])), - InstrumentationLibrary::new("example-crate", Some(env!("CARGO_PKG_VERSION")), None), + InstrumentationLibrary::new("example-crate", Some(env!("CARGO_PKG_VERSION")), None::<&'static str>, None), ); minitrace::set_reporter(reporter, Config::default());