Skip to content

Commit 7cc1162

Browse files
authored
fix: MSRV (bump to 1.88) & api changes in dependencies, reformat (#325)
1 parent 4892f8e commit 7cc1162

File tree

12 files changed

+88
-84
lines changed

12 files changed

+88
-84
lines changed

.mise.toml

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,21 @@ OTEL_TRACES_SAMPLER = "always_on"
55
# RUST_LOG = "warn,otel::setup=debug"
66

77
[tools]
8-
rust = { version = "1.87.0", profile = "minimal", components = "rustfmt,clippy" } # the rust tool stack (with cargo, fmt, clippy) to build source
9-
grpcurl = '1.9'
10-
protoc = '34.0'
8+
rust = { version = "1.88.0", profile = "minimal", components = "rustfmt,clippy" } # the rust tool stack (with cargo, fmt, clippy) to build source
9+
grpcurl = "1.9"
10+
protoc = "34.0"
1111
# grpc-health-probe = "*"
1212
# sccache = "0.5"
1313
# cargo-binstall allow to download (insteal of build) "cargo:*"
1414
# - do not use cargo-binstall" (it's a special name used by mise)
1515
# - "aqua:cargo-bins/cargo-binstall" allow to download the binary
1616
"aqua:cargo-bins/cargo-binstall" = "1"
1717

18+
[tasks.autofix]
19+
description = "Automatically fix some linting issues & format code"
20+
depends_post = ["format"]
21+
run = "cargo clippy --all-features --fix --allow-dirty"
22+
1823
[tasks.format]
1924
alias = "fmt"
2025
description = "Format the code and sort dependencies"
@@ -86,39 +91,38 @@ release-plz set-version tracing-opentelemetry-instrumentation-sdk@"$version"
8691
[tasks."install:cargo-deny"]
8792
hide = true
8893
description = "Install cargo-deny"
89-
run = 'cargo binstall -y cargo-deny || cargo install --locked cargo-deny'
94+
run = "cargo binstall -y cargo-deny || cargo install --locked cargo-deny"
9095

9196
[tasks."install:cargo-nextest"]
9297
hide = true
9398
description = "Install cargo-nextest"
94-
run = 'cargo binstall -y cargo-nextest || cargo install --locked cargo-nextest'
99+
run = "cargo binstall -y cargo-nextest || cargo install --locked cargo-nextest"
95100

96101
[tasks."install:cargo-insta"]
97102
hide = true
98103
description = "Install cargo-insta"
99-
run = 'cargo binstall -y cargo-insta || cargo install --locked cargo-insta'
104+
run = "cargo binstall -y cargo-insta || cargo install --locked cargo-insta"
100105

101106
[tasks."install:cargo-release"]
102107
hide = true
103108
description = "Install cargo-release"
104-
run = 'cargo binstall -y cargo-release || cargo install --locked cargo-release'
109+
run = "cargo binstall -y cargo-release || cargo install --locked cargo-release"
105110

106111
[tasks."install:git-cliff"]
107112
hide = true
108113
description = "Install git-cliff"
109-
run = 'cargo binstall -y git-cliff || cargo install --locked git-cliff'
114+
run = "cargo binstall -y git-cliff || cargo install --locked git-cliff"
110115

111116
[tasks."install:cargo-hack"]
112117
hide = true
113118
description = "Install cargo-hack"
114-
run = 'cargo binstall -y cargo-hack || cargo install --locked cargo-hack'
115-
119+
run = "cargo binstall -y cargo-hack || cargo install --locked cargo-hack"
116120

117121
[tasks.run-otel-desktop-viewer]
118122
description = "Run otel-desktop-viewer as receiver and viewer of otel trace"
119123
run = [
120-
'# Viewer: open http://localhost:8000',
121-
'docker run -p 8000:8000 -p 4317:4317 -p 4318:4318 ghcr.io/ctrlspice/otel-desktop-viewer:latest-amd64',
124+
"# Viewer: open http://localhost:8000",
125+
"docker run -p 8000:8000 -p 4317:4317 -p 4318:4318 ghcr.io/ctrlspice/otel-desktop-viewer:latest-amd64",
122126
]
123127

124128
[tasks.run-jaeger]
@@ -138,7 +142,7 @@ run = [
138142

139143
[tasks.run-example-grpc-server]
140144
description = "Run gRPC server example"
141-
run = 'cd examples/grpc && OTEL_SERVICE_NAME=grpc-server cargo run --bin server'
145+
run = "cd examples/grpc && OTEL_SERVICE_NAME=grpc-server cargo run --bin server"
142146

143147
[tasks.run-example-grpc-client]
144148
description = "Run gRPC client example"
@@ -149,7 +153,7 @@ cd examples/grpc && OTEL_SERVICE_NAME=grpc-client cargo run --bin client
149153

150154
[tasks.run-example-axum-otlp-server]
151155
description = "Run axum-otlp server example"
152-
run = 'cd examples/axum-otlp && OTEL_SERVICE_NAME=axum-otlp-4317 cargo run'
156+
run = "cd examples/axum-otlp && OTEL_SERVICE_NAME=axum-otlp-4317 cargo run"
153157

154158
[tasks.run-example-axum-otlp-server-http]
155159
description = "Run axum-otlp server example over HTTP"
@@ -168,7 +172,7 @@ curl -i http://127.0.0.1:3003/
168172

169173
[tasks.run-example-load]
170174
description = "Run load test example"
171-
run = 'cd examples/load && cargo run --release 2>/dev/null'
175+
run = "cd examples/load && cargo run --release 2>/dev/null"
172176

173177
[tasks.ci]
174178
depends = ["check", "lint", "test", "deny"]

Cargo.toml

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,47 +12,47 @@ members = [
1212
exclude = ["target"]
1313

1414
[workspace.package]
15-
edition = "2024"
1615
version = "0.32.0"
17-
license = "CC0-1.0"
16+
edition = "2024"
17+
rust-version = "1.88.0"
1818
homepage = "https://github.com/davidB/tracing-opentelemetry-instrumentation-sdk"
1919
repository = "https://github.com/davidB/tracing-opentelemetry-instrumentation-sdk"
20-
rust-version = "1.87.0"
21-
22-
[workspace.metadata.release]
23-
pre-release-commit-message = "🚀 (cargo-release) version {{version}}"
24-
tag-prefix = ""
25-
tag-name = "{{prefix}}{{version}}"
26-
tag-message = "🔖 {{version}}"
20+
license = "CC0-1.0"
2721

2822
[workspace.dependencies]
2923
assert2 = "0.4"
3024
axum = { version = "0.8", default-features = false }
3125
http = "^1"
3226
hyper = "1"
3327
insta = { version = "^1", features = ["redactions", "yaml"] }
34-
opentelemetry = { version = "0.31", features = [
28+
opentelemetry = { version = "0.31", default-features = false, features = [
3529
"trace",
36-
], default-features = false }
37-
opentelemetry_sdk = { version = "0.31", default-features = false, features = [
38-
"rt-tokio",
3930
] }
4031
opentelemetry-aws = { version = "0.19", default-features = false }
4132
opentelemetry-jaeger-propagator = { version = "0.31", default-features = false }
42-
opentelemetry-resource-detectors = { version = "0.10", default-features = false }
43-
opentelemetry-semantic-conventions = { version = "0.31", default-features = false }
44-
opentelemetry-zipkin = { version = "0.31", default-features = false }
4533
opentelemetry-otlp = { version = "0.31", default-features = false }
4634
opentelemetry-proto = { version = "0.31", default-features = false }
35+
opentelemetry-resource-detectors = { version = "0.10", default-features = false }
36+
opentelemetry_sdk = { version = "0.31", default-features = false, features = [
37+
"rt-tokio",
38+
] }
39+
opentelemetry-semantic-conventions = { version = "0.31", default-features = false }
4740
opentelemetry-stdout = { version = "0.31" }
41+
opentelemetry-zipkin = { version = "0.31", default-features = false }
4842
rstest = "0.26"
4943
tokio = { version = "1", default-features = false }
5044
tokio-stream = { version = "0.1", default-features = false }
51-
tonic = { version = "0.14", default-features = false } #should be sync with opentelemetry-proto
45+
tonic = { version = "0.14", default-features = false } # should be sync with opentelemetry-proto
5246
tower = { version = "0.5", default-features = false }
5347
tracing = "0.1"
5448
tracing-opentelemetry = "0.32"
5549

50+
[workspace.metadata.release]
51+
pre-release-commit-message = "🚀 (cargo-release) version {{version}}"
52+
tag-prefix = ""
53+
tag-name = "{{prefix}}{{version}}"
54+
tag-message = "🔖 {{version}}"
55+
5656
[profile.dev.package.insta]
5757
opt-level = 3
5858

examples/grpc/src/client.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
3131

3232
let response = client.say_hello(request).await?;
3333

34-
println!("RESPONSE={:?}", response);
34+
println!("RESPONSE={response:?}");
3535
}
3636
{
3737
let request = tonic::Request::new(StatusRequest {
@@ -41,7 +41,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
4141

4242
let response = client.say_status(request).await;
4343

44-
println!("RESPONSE={:?}", response);
44+
println!("RESPONSE={response:?}");
4545
}
4646
{
4747
let request = tonic::Request::new(StatusRequest {
@@ -51,7 +51,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
5151

5252
let response = client.say_status(request).await;
5353

54-
println!("RESPONSE={:?}", response);
54+
println!("RESPONSE={response:?}");
5555
}
5656

5757
Ok(())

examples/grpc/src/server.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
6060
.register_encoded_file_descriptor_set(generated::FILE_DESCRIPTOR_SET)
6161
.build_v1()?;
6262

63-
println!("GreeterServer listening on {}", addr);
63+
println!("GreeterServer listening on {addr}");
6464

6565
Server::builder()
6666
.timeout(std::time::Duration::from_secs(10))

fake-opentelemetry-collector/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,19 @@ async fn demo_fake_tracer_and_collector() {
4848
"[].end_time_unix_nano" => "[timestamp]",
4949
"[].events[].time_unix_nano" => "[timestamp]",
5050
"[].trace_id" => insta::dynamic_redaction(|value, _path| {
51-
assert2::let_assert!(Some(trace_id) = value.as_str());
51+
assert2::assert!(let Some(trace_id) = value.as_str());
5252
format!("[trace_id:lg{}]", trace_id.len())
5353
}),
5454
"[].span_id" => insta::dynamic_redaction(|value, _path| {
55-
assert2::let_assert!(Some(span_id) = value.as_str());
55+
assert2::assert!(let Some(span_id) = value.as_str());
5656
format!("[span_id:lg{}]", span_id.len())
5757
}),
5858
"[].links[].trace_id" => insta::dynamic_redaction(|value, _path| {
59-
assert2::let_assert!(Some(trace_id) = value.as_str());
59+
assert2::assert!(let Some(trace_id) = value.as_str());
6060
format!("[trace_id:lg{}]", trace_id.len())
6161
}),
6262
"[].links[].span_id" => insta::dynamic_redaction(|value, _path| {
63-
assert2::let_assert!(Some(span_id) = value.as_str());
63+
assert2::assert!(let Some(span_id) = value.as_str());
6464
format!("[span_id:lg{}]", span_id.len())
6565
}),
6666
});

fake-opentelemetry-collector/src/logs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ impl From<opentelemetry_proto::tonic::logs::v1::LogRecord> for ExportedLog {
2828
observed_time_unix_nano: value.observed_time_unix_nano,
2929
severity_number: value.severity_number,
3030
severity_text: value.severity_text,
31-
body: value.body.map(|value| format!("{:?}", value)),
31+
body: value.body.map(|value| format!("{value:?}")),
3232
attributes: cnv_attributes(&value.attributes),
3333
dropped_attributes_count: value.dropped_attributes_count,
3434
flags: value.flags,

fake-opentelemetry-collector/tests/demo_log.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ async fn demo_fake_logger_and_collector() {
3636

3737
insta::assert_yaml_snapshot!(otel_logs, {
3838
"[].trace_id" => insta::dynamic_redaction(|value, _path| {
39-
assert2::let_assert!(Some(trace_id) = value.as_str());
39+
assert2::assert!(let Some(trace_id) = value.as_str());
4040
format!("[trace_id:lg{}]", trace_id.len())
4141
}),
4242
"[].span_id" => insta::dynamic_redaction(|value, _path| {
43-
assert2::let_assert!(Some(span_id) = value.as_str());
43+
assert2::assert!(let Some(span_id) = value.as_str());
4444
format!("[span_id:lg{}]", span_id.len())
4545
}),
4646
"[].observed_time_unix_nano" => "[timestamp]",

0 commit comments

Comments
 (0)