427 lines
27 KiB
Markdown
427 lines
27 KiB
Markdown
<!--- Hugo front matter used to generate the website version of this page:
|
|
linkTitle: Attributes
|
|
aliases: [general-attributes]
|
|
--->
|
|
|
|
# General attributes
|
|
|
|
**Status**: [Development][DocumentStatus]
|
|
|
|
The attributes described in this section are not specific to a particular operation but rather generic.
|
|
They may be used in any Span they apply to.
|
|
Particular operations may refer to or require some of these attributes.
|
|
|
|
<!-- toc -->
|
|
|
|
- [Server, client and shared network attributes](#server-client-and-shared-network-attributes)
|
|
- [Address and port attributes](#address-and-port-attributes)
|
|
- [Server attributes](#server-attributes)
|
|
- [`server.address`](#serveraddress)
|
|
- [Client attributes](#client-attributes)
|
|
- [Source and destination attributes](#source-and-destination-attributes)
|
|
- [Source](#source)
|
|
- [Destination](#destination)
|
|
- [Other network attributes](#other-network-attributes)
|
|
- [`network.peer.*` and `network.local.*` attributes](#networkpeer-and-networklocal-attributes)
|
|
- [Client/server examples using `network.peer.*`](#clientserver-examples-using-networkpeer)
|
|
- [Simple client/server example](#simple-clientserver-example)
|
|
- [Client/server example with reverse proxy](#clientserver-example-with-reverse-proxy)
|
|
- [Client/server example with forward proxy](#clientserver-example-with-forward-proxy)
|
|
- [Network connection and carrier attributes](#network-connection-and-carrier-attributes)
|
|
- [General remote service attributes](#general-remote-service-attributes)
|
|
- [General thread attributes](#general-thread-attributes)
|
|
- [Source code attributes](#source-code-attributes)
|
|
|
|
<!-- tocstop -->
|
|
|
|
<!-- Keep old anchor IDs -->
|
|
<a name="server-and-client-attributes"></a>
|
|
|
|
## Server, client and shared network attributes
|
|
|
|
These attributes may be used to describe the client and server in a connection-based network interaction
|
|
where there is one side that initiates the connection (the client is the side that initiates the connection).
|
|
This covers all TCP network interactions since TCP is connection-based and one side initiates the
|
|
connection (an exception is made for peer-to-peer communication over TCP where the "user-facing" surface of the
|
|
protocol / API does not expose a clear notion of client and server).
|
|
This also covers UDP network interactions where one side initiates the interaction, e.g. QUIC (HTTP/3) and DNS.
|
|
|
|
In an ideal situation, not accounting for proxies, multiple IP addresses or host names,
|
|
the `server.*` attributes are the same on the client and server.
|
|
|
|
### Address and port attributes
|
|
|
|
For all IP-based protocols, the "address" should be just the IP-level address.
|
|
Protocol-specific parts of an address are split into other attributes (when applicable) such as "port" attributes for
|
|
TCP and UDP. If such transport-specific information is collected and the attribute name does not already uniquely
|
|
identify the transport, then setting [`network.transport`](#other-network-attributes) is especially encouraged.
|
|
|
|
### Server attributes
|
|
|
|
> **Warning**
|
|
> Attributes in this section are in use by the HTTP semantic conventions.
|
|
Once the HTTP semantic conventions are declared stable, changes to the attributes in this section will only be allowed
|
|
if they do not cause breaking changes to HTTP semantic conventions.
|
|
|
|
<!-- semconv server -->
|
|
<!-- NOTE: THIS TEXT IS AUTOGENERATED. DO NOT EDIT BY HAND. -->
|
|
<!-- see templates/registry/markdown/snippet.md.j2 -->
|
|
<!-- prettier-ignore-start -->
|
|
<!-- markdownlint-capture -->
|
|
<!-- markdownlint-disable -->
|
|
|
|
| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
|
|
|---|---|---|---|---|---|
|
|
| [`server.address`](/docs/attributes-registry/server.md) | string | Server domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name. [1] | `example.com`; `10.1.2.80`; `/tmp/my.sock` | `Recommended` |  |
|
|
| [`server.port`](/docs/attributes-registry/server.md) | int | Server port number. [2] | `80`; `8080`; `443` | `Recommended` |  |
|
|
|
|
**[1] `server.address`:** When observed from the client side, and when communicating through an intermediary, `server.address` SHOULD represent the server address behind any intermediaries, for example proxies, if it's available.
|
|
|
|
**[2] `server.port`:** When observed from the client side, and when communicating through an intermediary, `server.port` SHOULD represent the server port behind any intermediaries, for example proxies, if it's available.
|
|
|
|
<!-- markdownlint-restore -->
|
|
<!-- prettier-ignore-end -->
|
|
<!-- END AUTOGENERATED TEXT -->
|
|
<!-- endsemconv -->
|
|
|
|
`server.address` and `server.port` represent logical server name and port. Semantic conventions that refer to these attributes SHOULD
|
|
specify what these attributes mean in their context.
|
|
|
|
#### `server.address`
|
|
|
|
For IP-based communication, the name should be a DNS host name of the service. On client side it matches remote service name, on server side, it represents local service name as seen externally on clients.
|
|
|
|
When connecting to an URL `https://example.com/foo`, `server.address` matches `"example.com"` on both client and server side.
|
|
|
|
On client side, it's usually passed in form of URL, connection string, host name, etc. Sometimes host name is only available to instrumentation as a string which may contain DNS name or IP address. `server.address` SHOULD be set to the available known hostname (e.g., `"127.0.0.1"` if connecting to an URL `https://127.0.0.1/foo`).
|
|
|
|
If only IP address is available, it should be populated on `server.address`. Reverse DNS lookup SHOULD NOT be used to obtain DNS name.
|
|
|
|
If `network.transport` is `"pipe"`, the absolute path to the file representing it should be used as `server.address`.
|
|
If there is no such file (e.g., anonymous pipe),
|
|
the name should explicitly be set to the empty string to distinguish it from the case where the name is just unknown or not covered by the instrumentation.
|
|
|
|
For Unix domain socket, `server.address` attribute represents remote endpoint address on the client side and local endpoint address on the server side.
|
|
|
|
### Client attributes
|
|
|
|
> **Warning**
|
|
> Attributes in this section are in use by the HTTP semantic conventions.
|
|
Once the HTTP semantic conventions are declared stable, changes to the attributes in this section will only be allowed
|
|
if they do not cause breaking changes to HTTP semantic conventions.
|
|
|
|
<!-- semconv client -->
|
|
<!-- NOTE: THIS TEXT IS AUTOGENERATED. DO NOT EDIT BY HAND. -->
|
|
<!-- see templates/registry/markdown/snippet.md.j2 -->
|
|
<!-- prettier-ignore-start -->
|
|
<!-- markdownlint-capture -->
|
|
<!-- markdownlint-disable -->
|
|
|
|
| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
|
|
|---|---|---|---|---|---|
|
|
| [`client.address`](/docs/attributes-registry/client.md) | string | Client address - domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name. [1] | `client.example.com`; `10.1.2.80`; `/tmp/my.sock` | `Recommended` |  |
|
|
| [`client.port`](/docs/attributes-registry/client.md) | int | Client port number. [2] | `65123` | `Recommended` |  |
|
|
|
|
**[1] `client.address`:** When observed from the server side, and when communicating through an intermediary, `client.address` SHOULD represent the client address behind any intermediaries, for example proxies, if it's available.
|
|
|
|
**[2] `client.port`:** When observed from the server side, and when communicating through an intermediary, `client.port` SHOULD represent the client port behind any intermediaries, for example proxies, if it's available.
|
|
|
|
<!-- markdownlint-restore -->
|
|
<!-- prettier-ignore-end -->
|
|
<!-- END AUTOGENERATED TEXT -->
|
|
<!-- endsemconv -->
|
|
|
|
### Source and destination attributes
|
|
|
|
These attributes may be used to describe the sender and receiver of a network exchange/packet. These should be used
|
|
when there is no client/server relationship between the two sides, or when that relationship is unknown.
|
|
This covers low-level network interactions (e.g. packet tracing) where you don't know if
|
|
there was a connection or which side initiated it.
|
|
This also covers unidirectional UDP flows and peer-to-peer communication where the
|
|
"user-facing" surface of the protocol / API does not expose a clear notion of client and server.
|
|
|
|
#### Source
|
|
|
|
<!-- semconv source -->
|
|
<!-- NOTE: THIS TEXT IS AUTOGENERATED. DO NOT EDIT BY HAND. -->
|
|
<!-- see templates/registry/markdown/snippet.md.j2 -->
|
|
<!-- prettier-ignore-start -->
|
|
<!-- markdownlint-capture -->
|
|
<!-- markdownlint-disable -->
|
|
|
|
| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
|
|
|---|---|---|---|---|---|
|
|
| [`source.address`](/docs/attributes-registry/source.md) | string | Source address - domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name. [1] | `source.example.com`; `10.1.2.80`; `/tmp/my.sock` | `Recommended` |  |
|
|
| [`source.port`](/docs/attributes-registry/source.md) | int | Source port number | `3389`; `2888` | `Recommended` |  |
|
|
|
|
**[1] `source.address`:** When observed from the destination side, and when communicating through an intermediary, `source.address` SHOULD represent the source address behind any intermediaries, for example proxies, if it's available.
|
|
|
|
<!-- markdownlint-restore -->
|
|
<!-- prettier-ignore-end -->
|
|
<!-- END AUTOGENERATED TEXT -->
|
|
<!-- endsemconv -->
|
|
|
|
#### Destination
|
|
|
|
Destination fields capture details about the receiver of a network exchange/packet.
|
|
|
|
<!-- semconv destination -->
|
|
<!-- NOTE: THIS TEXT IS AUTOGENERATED. DO NOT EDIT BY HAND. -->
|
|
<!-- see templates/registry/markdown/snippet.md.j2 -->
|
|
<!-- prettier-ignore-start -->
|
|
<!-- markdownlint-capture -->
|
|
<!-- markdownlint-disable -->
|
|
|
|
| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
|
|
|---|---|---|---|---|---|
|
|
| [`destination.address`](/docs/attributes-registry/destination.md) | string | Destination address - domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name. [1] | `destination.example.com`; `10.1.2.80`; `/tmp/my.sock` | `Recommended` |  |
|
|
| [`destination.port`](/docs/attributes-registry/destination.md) | int | Destination port number | `3389`; `2888` | `Recommended` |  |
|
|
|
|
**[1] `destination.address`:** When observed from the source side, and when communicating through an intermediary, `destination.address` SHOULD represent the destination address behind any intermediaries, for example proxies, if it's available.
|
|
|
|
<!-- markdownlint-restore -->
|
|
<!-- prettier-ignore-end -->
|
|
<!-- END AUTOGENERATED TEXT -->
|
|
<!-- endsemconv -->
|
|
|
|
<a name="network-attributes"></a>
|
|
|
|
### Other network attributes
|
|
|
|
> **Warning**
|
|
> Attributes in this section are in use by the HTTP semantic conventions.
|
|
Once the HTTP semantic conventions are declared stable, changes to the attributes in this section will only be allowed
|
|
if they do not cause breaking changes to HTTP semantic conventions.
|
|
|
|
<!-- semconv network-core -->
|
|
<!-- NOTE: THIS TEXT IS AUTOGENERATED. DO NOT EDIT BY HAND. -->
|
|
<!-- see templates/registry/markdown/snippet.md.j2 -->
|
|
<!-- prettier-ignore-start -->
|
|
<!-- markdownlint-capture -->
|
|
<!-- markdownlint-disable -->
|
|
|
|
| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
|
|
|---|---|---|---|---|---|
|
|
| [`network.local.address`](/docs/attributes-registry/network.md) | string | Local address of the network connection - IP address or Unix domain socket name. | `10.1.2.80`; `/tmp/my.sock` | `Recommended` |  |
|
|
| [`network.local.port`](/docs/attributes-registry/network.md) | int | Local port number of the network connection. | `65123` | `Recommended` |  |
|
|
| [`network.peer.address`](/docs/attributes-registry/network.md) | string | Peer address of the network connection - IP address or Unix domain socket name. | `10.1.2.80`; `/tmp/my.sock` | `Recommended` |  |
|
|
| [`network.peer.port`](/docs/attributes-registry/network.md) | int | Peer port number of the network connection. | `65123` | `Recommended` |  |
|
|
| [`network.protocol.name`](/docs/attributes-registry/network.md) | string | [OSI application layer](https://wikipedia.org/wiki/Application_layer) or non-OSI equivalent. [1] | `amqp`; `http`; `mqtt` | `Recommended` |  |
|
|
| [`network.protocol.version`](/docs/attributes-registry/network.md) | string | The actual version of the protocol used for network communication. [2] | `1.1`; `2` | `Recommended` |  |
|
|
| [`network.transport`](/docs/attributes-registry/network.md) | string | [OSI transport layer](https://wikipedia.org/wiki/Transport_layer) or [inter-process communication method](https://wikipedia.org/wiki/Inter-process_communication). [3] | `tcp`; `udp` | `Recommended` |  |
|
|
| [`network.type`](/docs/attributes-registry/network.md) | string | [OSI network layer](https://wikipedia.org/wiki/Network_layer) or non-OSI equivalent. [4] | `ipv4`; `ipv6` | `Recommended` |  |
|
|
|
|
**[1] `network.protocol.name`:** The value SHOULD be normalized to lowercase.
|
|
|
|
**[2] `network.protocol.version`:** If protocol version is subject to negotiation (for example using [ALPN](https://www.rfc-editor.org/rfc/rfc7301.html)), this attribute SHOULD be set to the negotiated version. If the actual protocol version is not known, this attribute SHOULD NOT be set.
|
|
|
|
**[3] `network.transport`:** The value SHOULD be normalized to lowercase.
|
|
|
|
Consider always setting the transport when setting a port number, since
|
|
a port number is ambiguous without knowing the transport. For example
|
|
different processes could be listening on TCP port 12345 and UDP port 12345.
|
|
|
|
**[4] `network.type`:** The value SHOULD be normalized to lowercase.
|
|
|
|
---
|
|
|
|
`network.transport` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.
|
|
|
|
| Value | Description | Stability |
|
|
|---|---|---|
|
|
| `pipe` | Named or anonymous pipe. |  |
|
|
| `quic` | QUIC |  |
|
|
| `tcp` | TCP |  |
|
|
| `udp` | UDP |  |
|
|
| `unix` | Unix domain socket |  |
|
|
|
|
---
|
|
|
|
`network.type` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.
|
|
|
|
| Value | Description | Stability |
|
|
|---|---|---|
|
|
| `ipv4` | IPv4 |  |
|
|
| `ipv6` | IPv6 |  |
|
|
|
|
<!-- markdownlint-restore -->
|
|
<!-- prettier-ignore-end -->
|
|
<!-- END AUTOGENERATED TEXT -->
|
|
<!-- endsemconv -->
|
|
|
|
#### `network.peer.*` and `network.local.*` attributes
|
|
|
|
These attributes identify network peers that are directly connected to each other.
|
|
|
|
`network.peer.address` and `network.local.address` should be IP addresses, Unix domain socket names, or other addresses specific to network type.
|
|
|
|
_Note: Specific structures and methods to obtain socket-level attributes are mentioned here only as examples. Instrumentations would usually use Socket API provided by their environment or sockets implementations._
|
|
|
|
When connecting using `connect(2)` ([Linux or other POSIX systems](https://man7.org/linux/man-pages/man2/connect.2.html) /
|
|
[Windows](https://docs.microsoft.com/windows/win32/api/winsock2/nf-winsock2-connect))
|
|
or `bind(2)`([Linux or other POSIX systems](https://man7.org/linux/man-pages/man2/bind.2.html) /
|
|
[Windows](https://docs.microsoft.com/windows/win32/api/winsock2/nf-winsock2-bind))
|
|
with `AF_INET` address family, `network.peer.address` and `network.peer.port` represent `sin_addr` and `sin_port` fields
|
|
of `sockaddr_in` structure.
|
|
|
|
`network.peer.address` and `network.peer.port` can be obtained by calling `getpeername` method
|
|
([Linux or other POSIX systems](https://man7.org/linux/man-pages/man2/getpeername.2.html) /
|
|
[Windows](https://docs.microsoft.com/windows/win32/api/winsock2/nf-winsock2-getpeername)).
|
|
|
|
`network.local.address` and `network.local.port` can be obtained by calling `getsockname` method
|
|
([Linux or other POSIX systems](https://man7.org/linux/man-pages/man2/getsockname.2.html) /
|
|
[Windows](https://docs.microsoft.com/windows/win32/api/winsock2/nf-winsock2-getsockname)).
|
|
|
|
##### Client/server examples using `network.peer.*`
|
|
|
|
Note that `network.local.*` attributes are not included in these examples since they are typically Opt-In.
|
|
|
|
###### Simple client/server example
|
|
|
|

|
|
|
|
###### Client/server example with reverse proxy
|
|
|
|

|
|
|
|
###### Client/server example with forward proxy
|
|
|
|

|
|
|
|
#### Network connection and carrier attributes
|
|
|
|
<!-- semconv network-connection-and-carrier -->
|
|
<!-- NOTE: THIS TEXT IS AUTOGENERATED. DO NOT EDIT BY HAND. -->
|
|
<!-- see templates/registry/markdown/snippet.md.j2 -->
|
|
<!-- prettier-ignore-start -->
|
|
<!-- markdownlint-capture -->
|
|
<!-- markdownlint-disable -->
|
|
|
|
| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
|
|
|---|---|---|---|---|---|
|
|
| [`network.carrier.icc`](/docs/attributes-registry/network.md) | string | The ISO 3166-1 alpha-2 2-character country code associated with the mobile carrier network. | `DE` | `Recommended` |  |
|
|
| [`network.carrier.mcc`](/docs/attributes-registry/network.md) | string | The mobile carrier country code. | `310` | `Recommended` |  |
|
|
| [`network.carrier.mnc`](/docs/attributes-registry/network.md) | string | The mobile carrier network code. | `001` | `Recommended` |  |
|
|
| [`network.carrier.name`](/docs/attributes-registry/network.md) | string | The name of the mobile carrier. | `sprint` | `Recommended` |  |
|
|
| [`network.connection.subtype`](/docs/attributes-registry/network.md) | string | This describes more details regarding the connection.type. It may be the type of cell technology connection, but it could be used for describing details about a wifi connection. | `LTE` | `Recommended` |  |
|
|
| [`network.connection.type`](/docs/attributes-registry/network.md) | string | The internet connection type. | `wifi` | `Recommended` |  |
|
|
|
|
---
|
|
|
|
`network.connection.subtype` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.
|
|
|
|
| Value | Description | Stability |
|
|
|---|---|---|
|
|
| `cdma` | CDMA |  |
|
|
| `cdma2000_1xrtt` | CDMA2000 1XRTT |  |
|
|
| `edge` | EDGE |  |
|
|
| `ehrpd` | EHRPD |  |
|
|
| `evdo_0` | EVDO Rel. 0 |  |
|
|
| `evdo_a` | EVDO Rev. A |  |
|
|
| `evdo_b` | EVDO Rev. B |  |
|
|
| `gprs` | GPRS |  |
|
|
| `gsm` | GSM |  |
|
|
| `hsdpa` | HSDPA |  |
|
|
| `hspa` | HSPA |  |
|
|
| `hspap` | HSPAP |  |
|
|
| `hsupa` | HSUPA |  |
|
|
| `iden` | IDEN |  |
|
|
| `iwlan` | IWLAN |  |
|
|
| `lte` | LTE |  |
|
|
| `lte_ca` | LTE CA |  |
|
|
| `nr` | 5G NR (New Radio) |  |
|
|
| `nrnsa` | 5G NRNSA (New Radio Non-Standalone) |  |
|
|
| `td_scdma` | TD-SCDMA |  |
|
|
| `umts` | UMTS |  |
|
|
|
|
---
|
|
|
|
`network.connection.type` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.
|
|
|
|
| Value | Description | Stability |
|
|
|---|---|---|
|
|
| `cell` | cell |  |
|
|
| `unavailable` | unavailable |  |
|
|
| `unknown` | unknown |  |
|
|
| `wifi` | wifi |  |
|
|
| `wired` | wired |  |
|
|
|
|
<!-- markdownlint-restore -->
|
|
<!-- prettier-ignore-end -->
|
|
<!-- END AUTOGENERATED TEXT -->
|
|
<!-- endsemconv -->
|
|
|
|
For `Unix` and `pipe`, since the connection goes over the file system instead of being directly to a known peer, `server.address` is the only attribute that usually makes sense (see description of `server.address` below).
|
|
|
|
## General remote service attributes
|
|
|
|
This attribute may be used for any operation that accesses some remote service.
|
|
Users can define what the name of a service is based on their particular semantics in their distributed system.
|
|
Instrumentations SHOULD provide a way for users to configure this name.
|
|
|
|
<!-- semconv peer -->
|
|
<!-- NOTE: THIS TEXT IS AUTOGENERATED. DO NOT EDIT BY HAND. -->
|
|
<!-- see templates/registry/markdown/snippet.md.j2 -->
|
|
<!-- prettier-ignore-start -->
|
|
<!-- markdownlint-capture -->
|
|
<!-- markdownlint-disable -->
|
|
|
|
| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
|
|
|---|---|---|---|---|---|
|
|
| [`peer.service`](/docs/attributes-registry/peer.md) | string | The [`service.name`](/docs/resource/README.md#service) of the remote service. SHOULD be equal to the actual `service.name` resource attribute of the remote service if any. | `AuthTokenCache` | `Recommended` |  |
|
|
|
|
<!-- markdownlint-restore -->
|
|
<!-- prettier-ignore-end -->
|
|
<!-- END AUTOGENERATED TEXT -->
|
|
<!-- endsemconv -->
|
|
|
|
Examples of `peer.service` that users may specify:
|
|
|
|
- A Redis cache of auth tokens as `peer.service="AuthTokenCache"`.
|
|
- A gRPC service `rpc.service="io.opentelemetry.AuthService"` may be hosted in both a gateway, `peer.service="ExternalApiService"` and a backend, `peer.service="AuthService"`.
|
|
|
|
## General thread attributes
|
|
|
|
These attributes may be used for any operation to store information about
|
|
a thread that started a span.
|
|
|
|
<!-- semconv thread -->
|
|
<!-- NOTE: THIS TEXT IS AUTOGENERATED. DO NOT EDIT BY HAND. -->
|
|
<!-- see templates/registry/markdown/snippet.md.j2 -->
|
|
<!-- prettier-ignore-start -->
|
|
<!-- markdownlint-capture -->
|
|
<!-- markdownlint-disable -->
|
|
|
|
| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
|
|
|---|---|---|---|---|---|
|
|
| [`thread.id`](/docs/attributes-registry/thread.md) | int | Current "managed" thread ID (as opposed to OS thread ID). | `42` | `Recommended` |  |
|
|
| [`thread.name`](/docs/attributes-registry/thread.md) | string | Current thread name. | `main` | `Recommended` |  |
|
|
|
|
<!-- markdownlint-restore -->
|
|
<!-- prettier-ignore-end -->
|
|
<!-- END AUTOGENERATED TEXT -->
|
|
<!-- endsemconv -->
|
|
|
|
Examples of where `thread.id` and `thread.name` can be extracted from:
|
|
|
|
| Language or platform | `thread.id` | `thread.name` |
|
|
|-----------------------|----------------------------------------|------------------------------------------------|
|
|
| JVM | `Thread.currentThread().threadId()` | `Thread.currentThread().getName()` |
|
|
| .NET | `Thread.CurrentThread.ManagedThreadId` | `Thread.CurrentThread.Name` |
|
|
| Python | `threading.current_thread().ident` | `threading.current_thread().name` |
|
|
| Ruby | `Thread.current.object_id` | `Thread.current.name` |
|
|
| C++ | `std::this_thread::get_id()` | |
|
|
| Erlang | `erlang:self()` | `erlang:process_info(self(), registered_name)` |
|
|
|
|
## Source code attributes
|
|
|
|
**Status**: [Release Candidate][DocumentStatus]
|
|
|
|
Often a span is closely tied to a certain unit of code that is logically responsible for handling
|
|
the operation that the span describes (usually the method that starts the span).
|
|
For an HTTP server span, this would be the function that handles the incoming request, for example.
|
|
The [code attributes](https://opentelemetry.io/docs/specs/semconv/code/#attributes) allow to report this unit of code
|
|
and therefore to provide more context.
|
|
|
|
[DocumentStatus]: https://opentelemetry.io/docs/specs/otel/document-status
|