Compatibility with latest version of otel
kesavkolla opened this issue · 7 comments
I wanted to try otel 0.15 when I tried to change the references to new version code breaks.
Cargo.toml
[dependencies]
tracing = "0.1.19"
opentelemetry = { version = "0.15", features = ["rt-tokio-current-thread"] }
opentelemetry-jaeger = { version = "0.13", features = ["tokio"] }
tracing-opentelemetry = { version = "0.13" }
tracing-subscriber = { version = "0.2.12", features = ["registry", "env-filter"] }
tracing-bunyan-formatter = "0.1.6"
tokio = { version = "1", features = ["full"] }
actix-web = "4.0.0-beta.8"
tracing-actix-web = { git = "https://github.com/LukeMathWalker/tracing-actix-web", features = ["opentelemetry_0_15"] }
The init code:
fn init_telemetry() {
let app_name = concat!(env!("CARGO_PKG_NAME"), ":", env!("CARGO_PKG_VERSION"));
// Start a new Jaeger trace pipeline.
// Spans are exported in batch - recommended setup for a production application.
global::set_text_map_propagator(TraceContextPropagator::new());
let tracer = opentelemetry_jaeger::new_pipeline()
.with_service_name(app_name)
.install_batch(TokioCurrentThread)
.expect("Failed to install OpenTelemetry tracer.");
// Filter based on level - trace, debug, info, warn, error
// Tunable via `RUST_LOG` env variable
let env_filter = EnvFilter::try_from_default_env().unwrap_or(EnvFilter::new("info"));
// Create a `tracing` layer using the Jaeger tracer
let telemetry = tracing_opentelemetry::layer().with_tracer(tracer);
// Create a `tracing` layer to emit spans as structured logs to stdout
let formatting_layer = BunyanFormattingLayer::new(app_name.into(), std::io::stdout);
// Combined them all together in a `tracing` subscriber
let subscriber = Registry::default()
.with(env_filter)
.with(telemetry)
.with(JsonStorageLayer)
.with(formatting_layer);
tracing::subscriber::set_global_default(subscriber)
.expect("Failed to install `tracing` subscriber.")
}
Error:
error[E0277]: the trait bound `TokioCurrentThread: opentelemetry::runtime::Runtime` is not satisfied
--> src/main.rs:26:24
|
26 | .install_batch(TokioCurrentThread)
| ^^^^^^^^^^^^^^^^^^ the trait `opentelemetry::runtime::Runtime` is not implemented for `TokioCurrentThread`
|
help: trait impl with same name found
--> /home/kesav/.cargo/registry/src/github.com-1ecc6299db9ec823/opentelemetry-0.15.0/src/runtime.rs:78:1
|
78 | / impl Runtime for TokioCurrentThread {
79 | | type Interval = tokio_stream::wrappers::IntervalStream;
80 | | type Delay = tokio::time::Sleep;
81 | |
... |
104 | | }
105 | | }
| |_^
= note: perhaps two different versions of crate `opentelemetry` are being used?
Can you paste here the output of cargo tree | grep -C 20 opentelemetry
?
I think your version of tracing-opentelemetry
is incorrect.
Here is the command output:
cargo tree | grep -C 20 opentelemetry
│ │ ├── form_urlencoded v1.0.1
│ │ │ ├── matches v0.1.9
│ │ │ └── percent-encoding v2.1.0
│ │ ├── itoa v0.4.7
│ │ ├── ryu v1.0.5
│ │ └── serde v1.0.127 (*)
│ ├── smallvec v1.6.1
│ ├── socket2 v0.4.1
│ │ └── libc v0.2.99
│ ├── time v0.2.27 (*)
│ └── url v2.2.2
│ ├── form_urlencoded v1.0.1 (*)
│ ├── idna v0.2.3
│ │ ├── matches v0.1.9
│ │ ├── unicode-bidi v0.3.6
│ │ └── unicode-normalization v0.1.19
│ │ └── tinyvec v1.3.1
│ │ └── tinyvec_macros v0.1.0
│ ├── matches v0.1.9
│ └── percent-encoding v2.1.0
├── opentelemetry v0.15.0
│ ├── async-trait v0.1.51 (proc-macro)
│ │ ├── proc-macro2 v1.0.28 (*)
│ │ ├── quote v1.0.9 (*)
│ │ └── syn v1.0.74 (*)
│ ├── crossbeam-channel v0.5.1
│ │ ├── cfg-if v1.0.0
│ │ └── crossbeam-utils v0.8.5
│ │ ├── cfg-if v1.0.0
│ │ └── lazy_static v1.4.0
│ ├── futures v0.3.16
│ │ ├── futures-channel v0.3.16 (*)
│ │ ├── futures-core v0.3.16
│ │ ├── futures-executor v0.3.16
│ │ │ ├── futures-core v0.3.16
│ │ │ ├── futures-task v0.3.16
│ │ │ └── futures-util v0.3.16 (*)
│ │ ├── futures-io v0.3.16
│ │ ├── futures-sink v0.3.16
│ │ ├── futures-task v0.3.16
│ │ └── futures-util v0.3.16 (*)
│ ├── lazy_static v1.4.0
│ ├── percent-encoding v2.1.0
│ ├── pin-project v1.0.8 (*)
│ ├── rand v0.8.4 (*)
│ ├── thiserror v1.0.26
│ │ └── thiserror-impl v1.0.26 (proc-macro)
│ │ ├── proc-macro2 v1.0.28 (*)
│ │ ├── quote v1.0.9 (*)
│ │ └── syn v1.0.74 (*)
│ ├── tokio v1.10.0 (*)
│ └── tokio-stream v0.1.7
│ ├── futures-core v0.3.16
│ ├── pin-project-lite v0.2.7
│ └── tokio v1.10.0 (*)
├── opentelemetry-jaeger v0.13.0
│ ├── async-trait v0.1.51 (proc-macro) (*)
│ ├── lazy_static v1.4.0
│ ├── opentelemetry v0.14.0
│ │ ├── async-trait v0.1.51 (proc-macro) (*)
│ │ ├── crossbeam-channel v0.5.1 (*)
│ │ ├── futures v0.3.16 (*)
│ │ ├── lazy_static v1.4.0
│ │ ├── percent-encoding v2.1.0
│ │ ├── pin-project v1.0.8 (*)
│ │ ├── rand v0.8.4 (*)
│ │ └── thiserror v1.0.26 (*)
│ ├── thiserror v1.0.26 (*)
│ ├── thrift v0.13.0
│ │ ├── byteorder v1.4.3
│ │ ├── integer-encoding v1.1.7
│ │ ├── log v0.4.14 (*)
│ │ ├── ordered-float v1.1.1
│ │ │ └── num-traits v0.2.14
│ │ │ [build-dependencies]
│ │ │ └── autocfg v1.0.1
│ │ └── threadpool v1.8.1
│ │ └── num_cpus v1.13.0 (*)
│ └── tokio v1.10.0 (*)
├── tokio v1.10.0 (*)
├── tracing v0.1.26 (*)
├── tracing-actix-web v0.4.0-beta.10 (https://github.com/LukeMathWalker/tracing-actix-web#1f3ecfe1)
│ ├── actix-web v4.0.0-beta.8 (*)
│ ├── futures v0.3.16 (*)
│ ├── opentelemetry v0.15.0 (*)
│ ├── tracing v0.1.26 (*)
│ ├── tracing-futures v0.2.5
│ │ ├── pin-project v1.0.8 (*)
│ │ └── tracing v0.1.26 (*)
│ ├── tracing-opentelemetry v0.14.0
│ │ ├── opentelemetry v0.15.0 (*)
│ │ ├── tracing v0.1.26 (*)
│ │ ├── tracing-core v0.1.18 (*)
│ │ ├── tracing-log v0.1.2
│ │ │ ├── lazy_static v1.4.0
│ │ │ ├── log v0.4.14 (*)
│ │ │ └── tracing-core v0.1.18 (*)
│ │ └── tracing-subscriber v0.2.19
│ │ ├── ansi_term v0.12.1
│ │ ├── chrono v0.4.19
│ │ │ ├── libc v0.2.99
│ │ │ ├── num-integer v0.1.44
│ │ │ │ └── num-traits v0.2.14 (*)
│ │ │ │ [build-dependencies]
│ │ │ │ └── autocfg v1.0.1
│ │ │ ├── num-traits v0.2.14 (*)
│ │ │ └── time v0.1.44
│ │ │ └── libc v0.2.99
│ │ ├── lazy_static v1.4.0
│ │ ├── matchers v0.0.1
│ │ │ └── regex-automata v0.1.10
--
│ │ │ └── once_cell v1.8.0
│ │ ├── tracing v0.1.26 (*)
│ │ ├── tracing-core v0.1.18 (*)
│ │ ├── tracing-log v0.1.2 (*)
│ │ └── tracing-serde v0.1.2
│ │ ├── serde v1.0.127 (*)
│ │ └── tracing-core v0.1.18 (*)
│ └── uuid v0.8.2
│ └── getrandom v0.2.3 (*)
├── tracing-bunyan-formatter v0.2.4
│ ├── chrono v0.4.19 (*)
│ ├── gethostname v0.2.1
│ │ └── libc v0.2.99
│ ├── log v0.4.14 (*)
│ ├── serde v1.0.127 (*)
│ ├── serde_json v1.0.66 (*)
│ ├── tracing v0.1.26 (*)
│ ├── tracing-core v0.1.18 (*)
│ ├── tracing-log v0.1.2 (*)
│ └── tracing-subscriber v0.2.19 (*)
├── tracing-opentelemetry v0.14.0 (*)
└── tracing-subscriber v0.2.19 (*)
You can see from that output that opentelemetry-jaeger
is pulling in the old version of opentelemetry
, 0.14.x.
Try updating it.
When I updated the opentelemetry-jaeger to 0.15.0 then also it's not working. Looks like all these crates have some crucial interdependencies.
If I bump up opentelemetry-jaeger
to 0.15.0 then it's pulling opentelemetry version 0.16
Looks like new version of otel is 0.16. This repo tracing-actix-web is not using otel 0.16 yet. Would it be possible to add 0.16 also to this project?
I'd suggest you first get yours to compile - use opentelemetry-jaeger
0.14.x.
We don't have support yet for opentelemetry
0.16.
We released support for opentelemetry
0.16. Closing this one.