Replies: 3 comments 3 replies
-
@raaynaldo Could you try using async fn create_observable_gauge() {
let meter = global::meter("mylibraryname");
let _observable_gauge = meter
.f64_observable_gauge("create_observable_gauge")
.with_description("Testing gauge")
.with_unit("myunit")
.with_callback(move |observer| {
println!("with callback");
let val = futures_executor::block_on(async_function());
println!("val hello: {}", val);
observer.observe(val, &[KeyValue::new("new key from gauge", "myvalue1")]);
})
.init();
} |
Beta Was this translation helpful? Give feedback.
3 replies
-
https://github.com/open-telemetry/opentelemetry-rust/pull/2428/files Take a look at this PR which shows how to do asynchronous calls from inside Observable. It does show using tokio also. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm still new in Rust, but I'm required to implement OTEL in my rust project. I'm trying to call an async function in the Observable Callback function, but I got this error message
Any thought could be helpful! Thank you!
Beta Was this translation helpful? Give feedback.
All reactions