Switch from tokio-current-thread to tokio for otel

This commit is contained in:
Aode (lion) 2021-09-18 15:47:10 -05:00
parent 82371d4a65
commit d26ff4a7cb
3 changed files with 4 additions and 4 deletions

View file

@ -30,7 +30,7 @@ dotenv = "0.15.0"
futures-util = "0.3.17" futures-util = "0.3.17"
lru = "0.6.0" lru = "0.6.0"
mime = "0.3.16" mime = "0.3.16"
opentelemetry = { version = "0.16", features = ["rt-tokio-current-thread"] } opentelemetry = { version = "0.16", features = ["rt-tokio"] }
opentelemetry-otlp = "0.9" opentelemetry-otlp = "0.9"
rand = "0.8" rand = "0.8"
rsa = "0.5" rsa = "0.5"

View file

@ -40,7 +40,7 @@ impl ActorCache {
ActorCache { db } ActorCache { db }
} }
#[tracing::instrument(name = "Get Actor", skip(requests))] #[tracing::instrument(name = "Get Actor")]
pub(crate) async fn get( pub(crate) async fn get(
&self, &self,
id: &Url, id: &Url,
@ -68,7 +68,7 @@ impl ActorCache {
self.db.remove_connection(actor.id.clone()).await self.db.remove_connection(actor.id.clone()).await
} }
#[tracing::instrument(name = "Fetch remote actor", skip(requests))] #[tracing::instrument(name = "Fetch remote actor")]
pub(crate) async fn get_no_cache(&self, id: &Url, requests: &Requests) -> Result<Actor, Error> { pub(crate) async fn get_no_cache(&self, id: &Url, requests: &Requests) -> Result<Actor, Error> {
let accepted_actor = requests.fetch::<AcceptedActors>(id.as_str()).await?; let accepted_actor = requests.fetch::<AcceptedActors>(id.as_str()).await?;

View file

@ -58,7 +58,7 @@ async fn main() -> Result<(), anyhow::Error> {
.tonic() .tonic()
.with_endpoint(url.as_str()), .with_endpoint(url.as_str()),
) )
.install_batch(opentelemetry::runtime::TokioCurrentThread)?; .install_batch(opentelemetry::runtime::Tokio)?;
let otel_layer = tracing_opentelemetry::layer().with_tracer(tracer); let otel_layer = tracing_opentelemetry::layer().with_tracer(tracer);