From 3cf6f6a2f2d155f39d59b82c916d4f2466d8fb44 Mon Sep 17 00:00:00 2001 From: Florian Engelhardt Date: Wed, 17 Jan 2024 08:33:22 +0100 Subject: [PATCH] add thread name --- profiling/src/profiling/mod.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/profiling/src/profiling/mod.rs b/profiling/src/profiling/mod.rs index 36c1ad9afd9..2dc6666a6c8 100644 --- a/profiling/src/profiling/mod.rs +++ b/profiling/src/profiling/mod.rs @@ -1087,6 +1087,15 @@ impl Profiler { value: LabelValue::Num(unsafe { libc::pthread_self() as i64 }, "id".into()), }); + let thread_name = match std::thread::current().name() { + Some(name) => name, + None => "", + }; + labels.push(Label { + key: "thread name", + value: LabelValue::Str(thread_name.into()), + }); + let tags = TAGS.with(|cell| Arc::clone(&cell.borrow())); SampleMessage {