2
0
Fork 0
mirror of https://git.asonix.dog/asonix/pict-rs synced 2024-12-22 11:21:24 +00:00

Wire up cross-application propagation

This commit is contained in:
Aode (lion) 2021-09-19 14:36:53 -05:00
parent 79a0fa32ee
commit 7cb6a15acd
3 changed files with 12 additions and 2 deletions

2
Cargo.lock generated
View file

@ -2043,8 +2043,10 @@ version = "0.4.0-beta.12"
source = "git+https://github.com/asonix/tracing-actix-web?branch=asonix/tracing-error-work-around#51e7911af7d1dd6a9c8265fa19b94224ddff56e2"
dependencies = [
"actix-web",
"opentelemetry",
"tracing",
"tracing-futures",
"tracing-opentelemetry",
"uuid",
]

View file

@ -35,10 +35,16 @@ time = { version = "0.3.0", features = ["serde"] }
tokio = { version = "1", default-features = false, features = ["fs", "io-util", "process", "sync"] }
tokio-util = { version = "0.6", default-features = false, features = ["codec"] }
tracing = "0.1.15"
tracing-actix-web = { version = "0.4.0-beta.8", git = "https://github.com/asonix/tracing-actix-web", branch = "asonix/tracing-error-work-around" }
tracing-error = "0.1.2"
tracing-futures = "0.2.4"
tracing-log = "0.1.2"
tracing-opentelemetry = "0.15"
tracing-subscriber = { version = "0.2.5", features = ["fmt", "tracing-log"] }
url = "2.2"
[dependencies.tracing-actix-web]
version = "0.4.0-beta.8"
git = "https://github.com/asonix/tracing-actix-web"
branch = "asonix/tracing-error-work-around"
default-features = false
features = ["emit_event_on_error", "opentelemetry_0_16"]

View file

@ -11,7 +11,7 @@ use futures_util::{
Stream,
};
use once_cell::sync::Lazy;
use opentelemetry::{sdk::Resource, KeyValue};
use opentelemetry::{sdk::{Resource, propagation::TraceContextPropagator}, KeyValue};
use opentelemetry_otlp::WithExportConfig;
use std::{
collections::HashSet,
@ -794,6 +794,8 @@ async fn filename_by_alias(
async fn main() -> Result<(), anyhow::Error> {
LogTracer::init()?;
opentelemetry::global::set_text_map_propagator(TraceContextPropagator::new());
let env_filter = EnvFilter::try_from_default_env().unwrap_or_else(|_| EnvFilter::new("info"));
let format_layer = tracing_subscriber::fmt::layer()
.with_span_events(FmtSpan::NEW | FmtSpan::CLOSE)