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

fix(exmaples): actix web should use TokioCurrentThread as runtime #734

Merged
merged 4 commits into from
Feb 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/actix-http/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ publish = false

[dependencies]
opentelemetry = { path = "../../opentelemetry", features = ["rt-tokio"] }
opentelemetry-jaeger = { path = "../../opentelemetry-jaeger", features = ["reqwest_collector_client", "rt-tokio"] }
opentelemetry-jaeger = { path = "../../opentelemetry-jaeger", features = ["reqwest_collector_client", "rt-tokio-current-thread"] }
thrift = "0.13"
actix-web = "4.0.0-beta.4"
actix-service = "2.0.0-beta.5"
Expand Down
10 changes: 8 additions & 2 deletions examples/actix-http/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use actix_service::Service;
use actix_web::middleware::Logger;
use actix_web::{web, App, HttpServer};
use opentelemetry::global::shutdown_tracer_provider;
use opentelemetry::trace::TraceError;
use opentelemetry::{global, sdk::trace as sdktrace};
use opentelemetry::{
Expand All @@ -12,7 +13,7 @@ fn init_tracer() -> Result<sdktrace::Tracer, TraceError> {
opentelemetry_jaeger::new_pipeline()
.with_collector_endpoint("http://127.0.0.1:14268/api/traces")
.with_service_name("trace-http-demo")
.install_batch(opentelemetry::runtime::Tokio)
.install_batch(opentelemetry::runtime::TokioCurrentThread)
}

async fn index() -> &'static str {
Expand Down Expand Up @@ -45,5 +46,10 @@ async fn main() -> std::io::Result<()> {
.bind("127.0.0.1:8088")
.unwrap()
.run()
.await
.await?;

// wait until all pending spans get exported.
shutdown_tracer_provider();

Ok(())
}