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
The following example results in a panic, but works fine with the batch exporter. There clearly exists a tokio runtime, any ideas?
use opentelemetry_otlp::WithExportConfig;
use std::collections::HashMap;
use tracing::{info, span, Level};
use tracing_subscriber::layer::SubscriberExt;
use tracing_subscriber::Registry;
#[tokio::main]
async fn main() {
let api_key = "...";
let mut metadata = HashMap::new();
metadata.insert("x-honeycomb-team".to_string(), api_key.to_string());
let tracer = opentelemetry_otlp::new_pipeline()
.tracing()
.with_exporter(
opentelemetry_otlp::new_exporter()
.http()
.with_endpoint("https://api.honeycomb.io")
.with_headers(metadata),
)
.install_simple()
.unwrap();
let telemetry = tracing_opentelemetry::layer().with_tracer(tracer);
let registry = Registry::default().with(telemetry);
tracing::subscriber::set_global_default(registry).unwrap();
test();
}
fn test() {
let span = span!(Level::INFO, "test");
let _enter = span.enter();
info!("test");
}
Cargo.toml
[package]
name = "play"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
tokio = { version = "1.36", features = ["full"] }
tracing = "0.1.40"
tracing-log = { version = "0.2.0" }
tracing-opentelemetry = { version = "0.23.0" }
tracing-subscriber = { version = "0.3.18" }
opentelemetry = { version = "0.22.0", features = ["metrics", "trace"] }
opentelemetry_sdk = { version = "0.22.0", features = ["rt-tokio"] }
opentelemetry-otlp = { version = "0.15.0", features = [
"http-proto",
"reqwest-client",
"reqwest-rustls",
] }
API Version
0.15
SDK Version
0.22.0
What Exporters are you seeing the problem on?
OTLP
Relevant log output
thread 'opentelemetry-exporter' panicked at /home/jon/.config/cargo/registry/src/index.crates.io-6f17d22bba15001f/hyper-0.14.28/src/client/connect/dns.rs:121:24:
there is no reactor running, must be called from the context of a Tokio 1.x runtime
The text was updated successfully, but these errors were encountered:
I see, I'm trying to export spans of a program that immediately exits after doing some work and saw the synchronous exporter as the natural solution. Manually flushing all spans would also solve my case, is there any way to do this?
What happened?
The following example results in a panic, but works fine with the batch exporter. There clearly exists a tokio runtime, any ideas?
Cargo.toml
API Version
0.15
SDK Version
0.22.0
What Exporters are you seeing the problem on?
OTLP
Relevant log output
thread 'opentelemetry-exporter' panicked at /home/jon/.config/cargo/registry/src/index.crates.io-6f17d22bba15001f/hyper-0.14.28/src/client/connect/dns.rs:121:24: there is no reactor running, must be called from the context of a Tokio 1.x runtime
The text was updated successfully, but these errors were encountered: