diff --git a/core/lib/src/trace/subscriber.rs b/core/lib/src/trace/subscriber.rs
index 80b36806b5..df201e4e4b 100644
--- a/core/lib/src/trace/subscriber.rs
+++ b/core/lib/src/trace/subscriber.rs
@@ -1,9 +1,10 @@
-use std::marker::PhantomData;
+use std::cell::Cell;
use std::ops::Index;
use std::sync::OnceLock;
use std::sync::atomic::{AtomicU8, Ordering};
use std::fmt::{self, Debug, Display};
-// use std::time::Instant;
+use std::thread::ThreadId;
+use std::hash::{Hash, Hasher};
use tracing::{Event, Level, Metadata, Subscriber};
use tracing::level_filters::LevelFilter;
@@ -11,14 +12,13 @@ use tracing::field::{Field, Visit};
use tracing::span::{Attributes, Id, Record};
use tracing_subscriber::prelude::*;
-use tracing_subscriber::layer::Context;
-use tracing_subscriber::registry::LookupSpan;
+use tracing_subscriber::layer::{Context, Layered};
+use tracing_subscriber::registry::{LookupSpan, SpanRef};
use tracing_subscriber::{reload, filter, Layer, Registry};
use tracing_subscriber::field::RecordFields;
-use figment::Source::File as RelPath;
-use yansi::{Condition, Paint, Painted, Style};
use tinyvec::TinyVec;
+use yansi::{Condition, Paint, Painted, Style};
use crate::config::{Config, CliColors};
use crate::util::Formatter;
@@ -35,8 +35,103 @@ impl PaintExt for Painted<&'static str> {
}
}
+#[derive(Default)]
+pub struct IdentHasher(u128);
+
+impl Hasher for IdentHasher {
+ fn finish(&self) -> u64 {
+ self.0 as u64
+ }
+
+ fn write(&mut self, bytes: &[u8]) {
+ for &byte in bytes {
+ self.0 = (self.0 << 8) | (byte as u128);
+ }
+ }
+
+ fn write_u64(&mut self, i: u64) {
+ self.0 = (self.0 << 64) | (i as u128);
+ }
+
+ fn write_u128(&mut self, i: u128) {
+ self.0 = i;
+ }
+}
+
+#[derive(Debug, Clone, Hash, PartialEq, Eq)]
+pub struct RequestId {
+ thread: ThreadId,
+ span: Id,
+}
+
+thread_local! {
+ pub static CURRENT_REQUEST_ID: Cell