2
0
Fork 0
mirror of https://git.asonix.dog/asonix/pict-rs synced 2024-12-22 11:21:24 +00:00

Update opentelemetry to 0.27

This commit is contained in:
asonix 2024-11-23 15:01:09 -06:00
parent 5c370a7bb4
commit 7dff11a83a
3 changed files with 30 additions and 29 deletions

22
Cargo.lock generated
View file

@ -1984,9 +1984,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
[[package]] [[package]]
name = "opentelemetry" name = "opentelemetry"
version = "0.26.0" version = "0.27.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "570074cc999d1a58184080966e5bd3bf3a9a4af650c3b05047c2621e7405cd17" checksum = "0f3cebff57f7dbd1255b44d8bddc2cebeb0ea677dbaa2e25a3070a91b318f660"
dependencies = [ dependencies = [
"futures-core", "futures-core",
"futures-sink", "futures-sink",
@ -1998,9 +1998,9 @@ dependencies = [
[[package]] [[package]]
name = "opentelemetry-otlp" name = "opentelemetry-otlp"
version = "0.26.0" version = "0.27.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "29e1f9c8b032d4f635c730c0efcf731d5e2530ea13fa8bef7939ddc8420696bd" checksum = "91cf61a1868dacc576bf2b2a1c3e9ab150af7272909e80085c3173384fe11f76"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"futures-core", "futures-core",
@ -2012,13 +2012,14 @@ dependencies = [
"thiserror 1.0.69", "thiserror 1.0.69",
"tokio", "tokio",
"tonic", "tonic",
"tracing",
] ]
[[package]] [[package]]
name = "opentelemetry-proto" name = "opentelemetry-proto"
version = "0.26.1" version = "0.27.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c9d3968ce3aefdcca5c27e3c4ea4391b37547726a70893aab52d3de95d5f8b34" checksum = "a6e05acbfada5ec79023c85368af14abd0b307c015e9064d249b2a950ef459a6"
dependencies = [ dependencies = [
"opentelemetry", "opentelemetry",
"opentelemetry_sdk", "opentelemetry_sdk",
@ -2028,9 +2029,9 @@ dependencies = [
[[package]] [[package]]
name = "opentelemetry_sdk" name = "opentelemetry_sdk"
version = "0.26.0" version = "0.27.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2c627d9f4c9cdc1f21a29ee4bfbd6028fcb8bcf2a857b43f3abdf72c9c862f3" checksum = "27b742c1cae4693792cc564e58d75a2a0ba29421a34a85b50da92efa89ecb2bc"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"futures-channel", "futures-channel",
@ -2045,6 +2046,7 @@ dependencies = [
"thiserror 1.0.69", "thiserror 1.0.69",
"tokio", "tokio",
"tokio-stream", "tokio-stream",
"tracing",
] ]
[[package]] [[package]]
@ -3598,9 +3600,9 @@ dependencies = [
[[package]] [[package]]
name = "tracing-opentelemetry" name = "tracing-opentelemetry"
version = "0.27.0" version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc58af5d3f6c5811462cabb3289aec0093f7338e367e5a33d28c0433b3c7360b" checksum = "97a971f6058498b5c0f1affa23e7ea202057a7301dbff68e968b2d578bcbd053"
dependencies = [ dependencies = [
"js-sys", "js-sys",
"once_cell", "once_cell",

View file

@ -46,9 +46,9 @@ metrics-exporter-prometheus = { version = "0.16.0", default-features = false, fe
mime = "0.3.17" mime = "0.3.17"
nanorand = { version = "0.7.0", optional = true } nanorand = { version = "0.7.0", optional = true }
object_store = { version = "0.11.0", features = ["aws"] } object_store = { version = "0.11.0", features = ["aws"] }
opentelemetry_sdk = { version = "0.26.0", features = ["rt-tokio"] } opentelemetry_sdk = { version = "0.27.0", features = ["rt-tokio"] }
opentelemetry = "0.26.0" opentelemetry = "0.27.0"
opentelemetry-otlp = "0.26.0" opentelemetry-otlp = { version = "0.27.0", features = ["grpc-tonic"] }
pin-project-lite = "0.2.14" pin-project-lite = "0.2.14"
refinery = { version = "0.8.14", features = ["tokio-postgres", "postgres"] } refinery = { version = "0.8.14", features = ["tokio-postgres", "postgres"] }
reqwest = { version = "0.12.5", default-features = false, features = ["json", "rustls-tls-no-provider", "stream"] } reqwest = { version = "0.12.5", default-features = false, features = ["json", "rustls-tls-no-provider", "stream"] }
@ -83,7 +83,7 @@ toml = "0.8.14"
tracing = "0.1.40" tracing = "0.1.40"
tracing-error = "0.2.0" tracing-error = "0.2.0"
tracing-log = "0.2.0" tracing-log = "0.2.0"
tracing-opentelemetry = "0.27.0" tracing-opentelemetry = "0.28.0"
tracing-subscriber = { version = "0.3.18", features = [ tracing-subscriber = { version = "0.3.18", features = [
"ansi", "ansi",
"env-filter", "env-filter",
@ -98,6 +98,6 @@ uuid = { version = "1.10.0", features = ["serde", "std", "v4", "v7"] }
webpki-roots = "0.26.3" webpki-roots = "0.26.3"
[dependencies.tracing-actix-web] [dependencies.tracing-actix-web]
version = "0.7.14" version = "0.7.15"
default-features = false default-features = false
features = ["opentelemetry_0_26"] features = ["opentelemetry_0_27"]

View file

@ -76,20 +76,19 @@ where
for<'a> S: LookupSpan<'a>, for<'a> S: LookupSpan<'a>,
{ {
if let Some(url) = otel.url.as_ref() { if let Some(url) = otel.url.as_ref() {
let tracer = opentelemetry_otlp::new_pipeline() let exporter = opentelemetry_otlp::SpanExporter::builder()
.tracing() .with_tonic()
.with_trace_config(opentelemetry_sdk::trace::Config::default().with_resource( .with_endpoint(url.as_str())
Resource::new(vec![KeyValue::new( .build()?;
"service.name",
otel.service_name.clone(), let tracer = opentelemetry_sdk::trace::TracerProvider::builder()
)]), .with_config(
)) opentelemetry_sdk::trace::Config::default().with_resource(Resource::new(vec![
.with_exporter( KeyValue::new("service.name", otel.service_name.clone()),
opentelemetry_otlp::new_exporter() ])),
.tonic()
.with_endpoint(url.as_str()),
) )
.install_batch(opentelemetry_sdk::runtime::Tokio)?; .with_batch_exporter(exporter, opentelemetry_sdk::runtime::Tokio)
.build();
let otel_layer = tracing_opentelemetry::layer() let otel_layer = tracing_opentelemetry::layer()
.with_tracer(tracer.tracer("pict-rs-tracer")) .with_tracer(tracer.tracer("pict-rs-tracer"))