Skip to content

Commit

Permalink
Add semantic conventions for thread.name and thread.id span attributes (
Browse files Browse the repository at this point in the history
  • Loading branch information
Mateusz Rzeszutek authored Aug 18, 2020
1 parent 9aa1811 commit 2a77ba9
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions specification/trace/semantic_conventions/span-general.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

<!-- tocstop -->

Expand Down Expand Up @@ -129,3 +130,24 @@ 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 thread that started a span.

| 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` |

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` |
| C++ | `std::this_thread::get_id()` | |
| Erlang | `erlang:system_info(scheduler_id)` | |

0 comments on commit 2a77ba9

Please sign in to comment.