You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have the following dependencies in my Rust application (a playground project in which I am testing opentelemetry-rust components):
[package]
name = "telemetry"version = "0.1.0"edition = "2021"# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
once_cell = "1.18.0"opentelemetry = { version = "0.21.0", features = ["metrics", "trace"] }
opentelemetry-otlp = { version = "0.14.0", features = ["metrics", "trace", "grpc-tonic"] }
opentelemetry_sdk = { version = "0.21.0", features = ["metrics", "trace", "rt-tokio"] }
tokio = { version = "1.34.0", features = ["rt-multi-thread", "macros"] }
When I set the environment variable as OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4317 and create a Docker Compose environment with Jaeger as the tracing backend and Prometheus as the metrics backend, I receive the following:
$ cargo run
Finished dev [unoptimized + debuginfo] target(s) in 0.04s
Running `target/debug/telemetry`
Initializing call_me counter
$ curl otel-collector:8080/metrics
# HELP call_me_total counts how many times call_me is called
# TYPEcall_me_total counter
call_me_total{job="myservice",key="value"} 1
I would have expected to see a value of 10 for call_me_total. Am I mising something?
As a side note, I have also tried different combinations of Mutex<Counter<u64>> and Arc<Mutex<Counter<u64>>>, as well as omitting the static variable altogether, and instead, defining let counter = global::meter("telemetry").u64_counter("call_me").init();, all without success.
API Version
0.21.0
SDK Version
0.21.0
What Exporters are you seeing the problem on?
OTLP
Relevant log output
No response
The text was updated successfully, but these errors were encountered:
@aytekinar this is actually due to the global meter provider shutdown hook not behaving correctly, you can fix this by calling shutdown on the meter provider directly. The global shutdown is not spec compliant and is being removed in #1412.
What happened?
I have the following dependencies in my Rust application (a playground project in which I am testing
opentelemetry-rust
components):My
main.rs
file reads as follows:When I set the environment variable as
OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4317
and create a Docker Compose environment with Jaeger as the tracing backend and Prometheus as the metrics backend, I receive the following:I would have expected to see a value of
10
forcall_me_total
. Am I mising something?As a side note, I have also tried different combinations of
Mutex<Counter<u64>>
andArc<Mutex<Counter<u64>>>
, as well as omitting the static variable altogether, and instead, defininglet counter = global::meter("telemetry").u64_counter("call_me").init();
, all without success.API Version
0.21.0
SDK Version
0.21.0
What Exporters are you seeing the problem on?
OTLP
Relevant log output
No response
The text was updated successfully, but these errors were encountered: