You've already forked authentication-service
mirror of
https://github.com/matrix-org/matrix-authentication-service.git
synced 2025-08-09 04:22:45 +03:00
Fix traces not being created for requests
This commit is contained in:
@@ -27,6 +27,7 @@ use mas_email::{MailTransport, Mailer};
|
||||
use mas_storage::MIGRATOR;
|
||||
use mas_tasks::TaskQueue;
|
||||
use mas_templates::Templates;
|
||||
use opentelemetry::trace::TraceContextExt;
|
||||
use opentelemetry_http::HeaderExtractor;
|
||||
use tower::{make::Shared, ServiceBuilder};
|
||||
use tower_http::{
|
||||
@@ -62,6 +63,12 @@ impl<B> MakeSpan<B> for OtelMakeSpan {
|
||||
propagator.extract(&extractor)
|
||||
});
|
||||
|
||||
let cx = if cx.span().span_context().is_remote() {
|
||||
cx
|
||||
} else {
|
||||
opentelemetry::Context::new()
|
||||
};
|
||||
|
||||
// Attach the context so when the request span is created it gets properly
|
||||
// parented
|
||||
let _guard = cx.attach();
|
||||
|
Reference in New Issue
Block a user