Skip to content

Commit 2ea5c71

Browse files
[chore] Consolidate thread details into yaml/registry (#2708)
1 parent 6a0fca1 commit 2ea5c71

File tree

3 files changed

+84
-15
lines changed

3 files changed

+84
-15
lines changed

docs/general/attributes.md

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -394,25 +394,35 @@ a thread that started a span.
394394

395395
| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
396396
|---|---|---|---|---|---|
397-
| [`thread.id`](/docs/registry/attributes/thread.md) | int | Current "managed" thread ID (as opposed to OS thread ID). | `42` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) |
398-
| [`thread.name`](/docs/registry/attributes/thread.md) | string | Current thread name. | `main` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) |
397+
| [`thread.id`](/docs/registry/attributes/thread.md) | int | Current "managed" thread ID (as opposed to OS thread ID). [1] | `42` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) |
398+
| [`thread.name`](/docs/registry/attributes/thread.md) | string | Current thread name. [2] | `main` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) |
399+
400+
**[1] `thread.id`:** Examples of where the value can be extracted from:
401+
402+
| Language or platform | Source |
403+
| --- | --- |
404+
| JVM | `Thread.currentThread().threadId()` |
405+
| .NET | `Thread.CurrentThread.ManagedThreadId` |
406+
| Python | `threading.current_thread().ident` |
407+
| Ruby | `Thread.current.object_id` |
408+
| C++ | `std::this_thread::get_id()` |
409+
| Erlang | `erlang:self()` |
410+
411+
**[2] `thread.name`:** Examples of where the value can be extracted from:
412+
413+
| Language or platform | Source |
414+
| --- | --- |
415+
| JVM | `Thread.currentThread().getName()` |
416+
| .NET | `Thread.CurrentThread.Name` |
417+
| Python | `threading.current_thread().name` |
418+
| Ruby | `Thread.current.name` |
419+
| Erlang | `erlang:process_info(self(), registered_name)` |
399420

400421
<!-- markdownlint-restore -->
401422
<!-- prettier-ignore-end -->
402423
<!-- END AUTOGENERATED TEXT -->
403424
<!-- endsemconv -->
404425

405-
Examples of where `thread.id` and `thread.name` can be extracted from:
406-
407-
| Language or platform | `thread.id` | `thread.name` |
408-
|-----------------------|----------------------------------------|------------------------------------------------|
409-
| JVM | `Thread.currentThread().threadId()` | `Thread.currentThread().getName()` |
410-
| .NET | `Thread.CurrentThread.ManagedThreadId` | `Thread.CurrentThread.Name` |
411-
| Python | `threading.current_thread().ident` | `threading.current_thread().name` |
412-
| Ruby | `Thread.current.object_id` | `Thread.current.name` |
413-
| C++ | `std::this_thread::get_id()` | |
414-
| Erlang | `erlang:self()` | `erlang:process_info(self(), registered_name)` |
415-
416426
## Source code attributes
417427

418428
**Status**: [Release Candidate][DocumentStatus]

docs/registry/attributes/thread.md

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,26 @@ These attributes may be used for any operation to store information about a thre
99

1010
| Attribute | Type | Description | Examples | Stability |
1111
|---|---|---|---|---|
12-
| <a id="thread-id" href="#thread-id">`thread.id`</a> | int | Current "managed" thread ID (as opposed to OS thread ID). | `42` | ![Development](https://img.shields.io/badge/-development-blue) |
13-
| <a id="thread-name" href="#thread-name">`thread.name`</a> | string | Current thread name. | `main` | ![Development](https://img.shields.io/badge/-development-blue) |
12+
| <a id="thread-id" href="#thread-id">`thread.id`</a> | int | Current "managed" thread ID (as opposed to OS thread ID). [1] | `42` | ![Development](https://img.shields.io/badge/-development-blue) |
13+
| <a id="thread-name" href="#thread-name">`thread.name`</a> | string | Current thread name. [2] | `main` | ![Development](https://img.shields.io/badge/-development-blue) |
14+
15+
**[1] `thread.id`:** Examples of where the value can be extracted from:
16+
17+
| Language or platform | Source |
18+
| --- | --- |
19+
| JVM | `Thread.currentThread().threadId()` |
20+
| .NET | `Thread.CurrentThread.ManagedThreadId` |
21+
| Python | `threading.current_thread().ident` |
22+
| Ruby | `Thread.current.object_id` |
23+
| C++ | `std::this_thread::get_id()` |
24+
| Erlang | `erlang:self()` |
25+
26+
**[2] `thread.name`:** Examples of where the value can be extracted from:
27+
28+
| Language or platform | Source |
29+
| --- | --- |
30+
| JVM | `Thread.currentThread().getName()` |
31+
| .NET | `Thread.CurrentThread.Name` |
32+
| Python | `threading.current_thread().name` |
33+
| Ruby | `Thread.current.name` |
34+
| Erlang | `erlang:process_info(self(), registered_name)` |

model/thread/registry.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,48 @@ groups:
1010
stability: development
1111
brief: >
1212
Current "managed" thread ID (as opposed to OS thread ID).
13+
note: >
14+
15+
Examples of where the value can be extracted from:
16+
17+
18+
| Language or platform | Source |
19+
20+
| --- | --- |
21+
22+
| JVM | `Thread.currentThread().threadId()` |
23+
24+
| .NET | `Thread.CurrentThread.ManagedThreadId` |
25+
26+
| Python | `threading.current_thread().ident` |
27+
28+
| Ruby | `Thread.current.object_id` |
29+
30+
| C++ | `std::this_thread::get_id()` |
31+
32+
| Erlang | `erlang:self()` |
1333
examples: 42
1434
- id: thread.name
1535
type: string
1636
stability: development
1737
brief: >
1838
Current thread name.
39+
note: >
40+
41+
Examples of where the value can be extracted from:
42+
43+
44+
| Language or platform | Source |
45+
46+
| --- | --- |
47+
48+
| JVM | `Thread.currentThread().getName()` |
49+
50+
| .NET | `Thread.CurrentThread.Name` |
51+
52+
| Python | `threading.current_thread().name` |
53+
54+
| Ruby | `Thread.current.name` |
55+
56+
| Erlang | `erlang:process_info(self(), registered_name)` |
1957
examples: main

0 commit comments

Comments
 (0)