Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add semantic conventions for thread.name and thread.id span attributes #789

Merged
merged 5 commits into from
Aug 18, 2020
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 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,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.
mateuszrzeszutek marked this conversation as resolved.
Show resolved Hide resolved

| 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()` |
Copy link

@johantiden johantiden Aug 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thread.currentThread().getId() is deprecated since java 19. There is a Thread.currentThread().threadId() instead.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi @johantiden! this page has been moved to another repo: https://github.com/open-telemetry/semantic-conventions/blob/main/docs/general/attributes.md#general-thread-attributes

can you open an issue (or PR) over there? thanks

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I opened an issue in open-telemetry/semantic-conventions#1375 so we don't miss it as this PR here was closed 4 years ago.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the pointers! I just called it as I saw it. I came to this commit from the original pull request.

| .Net | `Thread.CurrentThread.ManagedThreadId` | `Thread.CurrentThread.Name` |
| Python | `threading.current_thread().ident` | `threading.current_thread().name` |
| Ruby | | `Thread.current.name` |
mateuszrzeszutek marked this conversation as resolved.
Show resolved Hide resolved