Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zipkin pipeline fail #32

Closed
Farkal opened this issue Oct 30, 2020 · 3 comments · Fixed by #33
Closed

Zipkin pipeline fail #32

Farkal opened this issue Oct 30, 2020 · 3 comments · Fixed by #33

Comments

@Farkal
Copy link

Farkal commented Oct 30, 2020

If i try to use zipkin pipeline instead of jaeger it fail with: Cannot drop a runtime in a context where blocking is not allowed. This happens when a runtime is dropped from within an asynchronous context.

Code:

[dependencies]
actix-web = "3.2"
actix-web-opentelemetry = "0.7"
opentelemetry-zipkin = "0.7"
use actix_web::{get, web, App, HttpServer, Responder};
use actix_web_opentelemetry::RequestTracing;

#[get("/{id}/{name}/index.html")]
async fn index(web::Path((id, name)): web::Path<(u32, String)>) -> impl Responder {
    format!("Hello {}! id:{}", name, id)
}

#[actix_web::main]
async fn main() -> std::io::Result<()> {
    opentelemetry_zipkin::new_pipeline()
            .install()
            .expect("pipeline install error");
    HttpServer::new(|| App::new().service(index).wrap(RequestTracing::new()))
        .bind("127.0.0.1:8080")?
        .run()
        .await
}
@jtescher
Copy link
Contributor

jtescher commented Oct 30, 2020

@Farkal it should work if you use the following workaround currently once the next zipkin version is released:

[dependencies]
# ...
opentelemetry-zipkin = { version = "0.8", features = ["reqwest-client"], default-features = false }

@jtescher
Copy link
Contributor

If you want to use things currently, you can specify the http client when you start the zipkin pipeline:

[dependencies]
actix-web = "3.2"
actix-web-opentelemetry = "0.7"
opentelemetry = { version = "0.9", features = ["reqwest"] }
opentelemetry-zipkin = { version = "0.7", default-features = false }
reqwest = "0.10"
use actix_web::{get, web, App, HttpServer, Responder};
use actix_web_opentelemetry::RequestTracing;

#[get("/{id}/{name}/index.html")]
async fn index(web::Path((id, name)): web::Path<(u32, String)>) -> impl Responder {
    format!("Hello {}! id:{}", name, id)
}

#[actix_web::main]
async fn main() -> std::io::Result<()> {
    opentelemetry_zipkin::new_pipeline()
        .with_http_client(reqwest::Client::new())
        .install()
        .expect("pipeline install error");
    HttpServer::new(|| App::new().service(index).wrap(RequestTracing::new()))
        .bind("127.0.0.1:8080")?
        .run()
        .await
}

@Farkal
Copy link
Author

Farkal commented Oct 31, 2020

Wow that was quick ! Thank you very much !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants