From 9b2de21297fab2d6c3bb041b3ffbf973306b00c1 Mon Sep 17 00:00:00 2001 From: mateuszrzeszutek Date: Wed, 12 Aug 2020 11:44:36 +0200 Subject: [PATCH 1/5] Add semantic conventions for thread.name and thread.id span attributes --- .../semantic_conventions/span-general.md | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/specification/trace/semantic_conventions/span-general.md b/specification/trace/semantic_conventions/span-general.md index 618b725a63b..63b85b368a0 100644 --- a/specification/trace/semantic_conventions/span-general.md +++ b/specification/trace/semantic_conventions/span-general.md @@ -13,6 +13,7 @@ Particular operations may refer to or require some of these attributes. * [`net.*.name` attributes](#netname-attributes) - [General remote service attributes](#general-remote-service-attributes) - [General identity attributes](#general-identity-attributes) +- [General thread attributes](#general-thread-attributes) @@ -129,3 +130,22 @@ Examples of where the `enduser.id` value is extracted from: Given the sensitive nature of this information, SDKs and exporters SHOULD drop these attributes by default and then provide a configuration parameter to turn on retention for use cases where the information is required and would not violate any policies or regulations. + +## General thread attributes + +These attributes may be used for any operation to store information about +a span's current execution thread. + +| Attribute name | Notes and examples | +|----------------|----------------------------------------------------------| +| `thread.id` | Current thread id, if exposed by the platform. E.g. `42` | +| `thread.name` | Current thread name. E.g. `main` | + +Examples of where `thread.id` and `thread.name` can be extracted from: + +| Launguage or platform | `thread.id` | `thread.name` | +|-----------------------|----------------------------------------|------------------------------------| +| JVM | `Thread.currentThread().getId()` | `Thread.currentThread().getName()` | +| .Net | `Thread.CurrentThread.ManagedThreadId` | `Thread.CurrentThread.Name` | +| Python | `threading.current_thread().ident` | `threading.current_thread().name` | +| Ruby | | `Thread.current.name` | From 240011288b0893507fe0845854dda25c59237026 Mon Sep 17 00:00:00 2001 From: Mateusz Rzeszutek Date: Wed, 12 Aug 2020 12:18:17 +0200 Subject: [PATCH 2/5] Update specification/trace/semantic_conventions/span-general.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Correct `thread.id` description Co-authored-by: Christian Neumüller --- specification/trace/semantic_conventions/span-general.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specification/trace/semantic_conventions/span-general.md b/specification/trace/semantic_conventions/span-general.md index 63b85b368a0..b250513db59 100644 --- a/specification/trace/semantic_conventions/span-general.md +++ b/specification/trace/semantic_conventions/span-general.md @@ -138,7 +138,7 @@ a span's current execution thread. | Attribute name | Notes and examples | |----------------|----------------------------------------------------------| -| `thread.id` | Current thread id, if exposed by the platform. E.g. `42` | +| `thread.id` | Current "managed" thread ID (as opposed to OS thread ID). E.g. `42` | | `thread.name` | Current thread name. E.g. `main` | Examples of where `thread.id` and `thread.name` can be extracted from: From 17d28d550f4a490c2ab82f4beaa250d37917de2f Mon Sep 17 00:00:00 2001 From: mateuszrzeszutek Date: Thu, 13 Aug 2020 11:00:28 +0200 Subject: [PATCH 3/5] Add semantic conventions for thread.name and thread.id attributes Define "thread" more precisely as "thread that started a span" --- specification/trace/semantic_conventions/span-general.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/specification/trace/semantic_conventions/span-general.md b/specification/trace/semantic_conventions/span-general.md index b250513db59..289bf6d0f67 100644 --- a/specification/trace/semantic_conventions/span-general.md +++ b/specification/trace/semantic_conventions/span-general.md @@ -134,12 +134,12 @@ information is required and would not violate any policies or regulations. ## General thread attributes These attributes may be used for any operation to store information about -a span's current execution thread. +a thread that started a span. -| Attribute name | Notes and examples | -|----------------|----------------------------------------------------------| +| Attribute name | Notes and examples | +|----------------|---------------------------------------------------------------------| | `thread.id` | Current "managed" thread ID (as opposed to OS thread ID). E.g. `42` | -| `thread.name` | Current thread name. E.g. `main` | +| `thread.name` | Current thread name. E.g. `main` | Examples of where `thread.id` and `thread.name` can be extracted from: @@ -149,3 +149,4 @@ Examples of where `thread.id` and `thread.name` can be extracted from: | .Net | `Thread.CurrentThread.ManagedThreadId` | `Thread.CurrentThread.Name` | | Python | `threading.current_thread().ident` | `threading.current_thread().name` | | Ruby | | `Thread.current.name` | +| C++ | `std::this_thread::get_id` | | From 6031140b79756dd3e6659253b6193910415db405 Mon Sep 17 00:00:00 2001 From: Mateusz Rzeszutek Date: Fri, 14 Aug 2020 10:43:17 +0200 Subject: [PATCH 4/5] Update specification/trace/semantic_conventions/span-general.md Co-authored-by: Tigran Najaryan <4194920+tigrannajaryan@users.noreply.github.com> --- specification/trace/semantic_conventions/span-general.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specification/trace/semantic_conventions/span-general.md b/specification/trace/semantic_conventions/span-general.md index 289bf6d0f67..08b985e6f42 100644 --- a/specification/trace/semantic_conventions/span-general.md +++ b/specification/trace/semantic_conventions/span-general.md @@ -149,4 +149,4 @@ Examples of where `thread.id` and `thread.name` can be extracted from: | .Net | `Thread.CurrentThread.ManagedThreadId` | `Thread.CurrentThread.Name` | | Python | `threading.current_thread().ident` | `threading.current_thread().name` | | Ruby | | `Thread.current.name` | -| C++ | `std::this_thread::get_id` | | +| C++ | `std::this_thread::get_id()` | | From e5bcb102f859abd29b4e52e16811834c59366906 Mon Sep 17 00:00:00 2001 From: Mateusz Rzeszutek Date: Mon, 17 Aug 2020 09:22:40 +0200 Subject: [PATCH 5/5] Update specification/trace/semantic_conventions/span-general.md Co-authored-by: Tristan Sloughter --- specification/trace/semantic_conventions/span-general.md | 1 + 1 file changed, 1 insertion(+) diff --git a/specification/trace/semantic_conventions/span-general.md b/specification/trace/semantic_conventions/span-general.md index 08b985e6f42..d656c358d25 100644 --- a/specification/trace/semantic_conventions/span-general.md +++ b/specification/trace/semantic_conventions/span-general.md @@ -150,3 +150,4 @@ Examples of where `thread.id` and `thread.name` can be extracted from: | Python | `threading.current_thread().ident` | `threading.current_thread().name` | | Ruby | | `Thread.current.name` | | C++ | `std::this_thread::get_id()` | | +| Erlang | `erlang:system_info(scheduler_id)` | |