Moved thread and code to the registry (#434)

Signed-off-by: Alexander Wert <alexander.wert@elastic.co>
This commit is contained in:
Alexander Wert 2023-10-27 16:13:49 +02:00 committed by GitHub
parent 131637a718
commit fde7b11e61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 99 additions and 45 deletions

View File

@ -27,11 +27,13 @@ All registered attributes are listed by namespace in this registry.
Currently, the following namespaces exist:
* [Code](code.md)
* [Container](container.md)
* [HTTP](http.md)
* [Network](network.md)
* [OCI](oci.md)
* [RPC](rpc.md)
* [Thread](thread.md)
* [URL](url.md)
* [User agent](user-agent.md)

View File

@ -0,0 +1,18 @@
<!--- Hugo front matter used to generate the website version of this page:
--->
# Code
These attributes allow to report this unit of code and therefore to provide more context about the telemetry data.
## Code Attributes
<!-- semconv registry.code(omit_requirement_level) -->
| Attribute | Type | Description | Examples |
|---|---|---|---|
| `code.column` | int | The column number in `code.filepath` best representing the operation. It SHOULD point within the code unit named in `code.function`. | `16` |
| `code.filepath` | string | The source code file name that identifies the code unit as uniquely as possible (preferably an absolute file path). | `/usr/local/MyApplication/content_root/app/index.php` |
| `code.function` | string | The method or function name, or equivalent (usually rightmost part of the code unit's name). | `serveRequest` |
| `code.lineno` | int | The line number in `code.filepath` best representing the operation. It SHOULD point within the code unit named in `code.function`. | `42` |
| `code.namespace` | string | The "namespace" within which `code.function` is defined. Usually the qualified class or module name, such that `code.namespace` + some separator + `code.function` form a unique identifier for the code unit. | `com.example.MyHttpService` |
<!-- endsemconv -->

View File

@ -0,0 +1,15 @@
<!--- Hugo front matter used to generate the website version of this page:
--->
# Thread
These attributes may be used for any operation to store information about a thread.
## Thread Attributes
<!-- semconv registry.thread(omit_requirement_level) -->
| Attribute | Type | Description | Examples |
|---|---|---|---|
| `thread.id` | int | Current "managed" thread ID (as opposed to OS thread ID). | `42` |
| `thread.name` | string | Current thread name. | `main` |
<!-- endsemconv -->

View File

@ -358,8 +358,8 @@ a thread that started a span.
<!-- semconv thread -->
| Attribute | Type | Description | Examples | Requirement Level |
|---|---|---|---|---|
| `thread.id` | int | Current "managed" thread ID (as opposed to OS thread ID). | `42` | Recommended |
| `thread.name` | string | Current thread name. | `main` | Recommended |
| [`thread.id`](../attributes-registry/thread.md) | int | Current "managed" thread ID (as opposed to OS thread ID). | `42` | Recommended |
| [`thread.name`](../attributes-registry/thread.md) | string | Current thread name. | `main` | Recommended |
<!-- endsemconv -->
Examples of where `thread.id` and `thread.name` can be extracted from:
@ -384,11 +384,11 @@ about the span.
<!-- semconv code -->
| Attribute | Type | Description | Examples | Requirement Level |
|---|---|---|---|---|
| `code.column` | int | The column number in `code.filepath` best representing the operation. It SHOULD point within the code unit named in `code.function`. | `16` | Recommended |
| `code.filepath` | string | The source code file name that identifies the code unit as uniquely as possible (preferably an absolute file path). | `/usr/local/MyApplication/content_root/app/index.php` | Recommended |
| `code.function` | string | The method or function name, or equivalent (usually rightmost part of the code unit's name). | `serveRequest` | Recommended |
| `code.lineno` | int | The line number in `code.filepath` best representing the operation. It SHOULD point within the code unit named in `code.function`. | `42` | Recommended |
| `code.namespace` | string | The "namespace" within which `code.function` is defined. Usually the qualified class or module name, such that `code.namespace` + some separator + `code.function` form a unique identifier for the code unit. | `com.example.MyHttpService` | Recommended |
| [`code.column`](../attributes-registry/code.md) | int | The column number in `code.filepath` best representing the operation. It SHOULD point within the code unit named in `code.function`. | `16` | Recommended |
| [`code.filepath`](../attributes-registry/code.md) | string | The source code file name that identifies the code unit as uniquely as possible (preferably an absolute file path). | `/usr/local/MyApplication/content_root/app/index.php` | Recommended |
| [`code.function`](../attributes-registry/code.md) | string | The method or function name, or equivalent (usually rightmost part of the code unit's name). | `serveRequest` | Recommended |
| [`code.lineno`](../attributes-registry/code.md) | int | The line number in `code.filepath` best representing the operation. It SHOULD point within the code unit named in `code.function`. | `42` | Recommended |
| [`code.namespace`](../attributes-registry/code.md) | string | The "namespace" within which `code.function` is defined. Usually the qualified class or module name, such that `code.namespace` + some separator + `code.function` form a unique identifier for the code unit. | `com.example.MyHttpService` | Recommended |
<!-- endsemconv -->
[DocumentStatus]: https://github.com/open-telemetry/opentelemetry-specification/tree/v1.26.0/specification/document-status.md

View File

@ -37,50 +37,19 @@ groups:
or an attribute value in a [SAML 2.0 Assertion](http://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-tech-overview-2.0.html).
examples: 'read:message, write:files'
- id: thread
prefix: thread
type: span
brief: >
These attributes may be used for any operation to store information about a thread that started a span.
attributes:
- id: id
type: int
brief: >
Current "managed" thread ID (as opposed to OS thread ID).
examples: 42
- id: name
type: string
brief: >
Current thread name.
examples: main
- ref: thread.id
- ref: thread.name
- id: code
prefix: code
type: span
brief: >
These attributes allow to report this unit of code and therefore to provide more context about the span.
attributes:
- id: function
type: string
brief: >
The method or function name, or equivalent (usually rightmost part of the code unit's name).
examples: serveRequest
- id: namespace
type: string
brief: >
The "namespace" within which `code.function` is defined. Usually the qualified class or module name,
such that `code.namespace` + some separator + `code.function` form a unique identifier for the code unit.
examples: com.example.MyHttpService
- id: filepath
type: string
brief: >
The source code file name that identifies the code unit as uniquely as possible (preferably an absolute file path).
examples: /usr/local/MyApplication/content_root/app/index.php
- id: lineno
type: int
brief: >
The line number in `code.filepath` best representing the operation. It SHOULD point within the code unit named in `code.function`.
examples: 42
- id: column
type: int
brief: >
The column number in `code.filepath` best representing the operation. It SHOULD point within the code unit named in `code.function`.
examples: 16
- ref: code.function
- ref: code.namespace
- ref: code.filepath
- ref: code.lineno
- ref: code.column

33
model/registry/code.yaml Normal file
View File

@ -0,0 +1,33 @@
groups:
- id: registry.code
prefix: code
type: span
brief: >
These attributes allow to report this unit of code and therefore to provide more context about the span.
attributes:
- id: function
type: string
brief: >
The method or function name, or equivalent (usually rightmost part of the code unit's name).
examples: serveRequest
- id: namespace
type: string
brief: >
The "namespace" within which `code.function` is defined. Usually the qualified class or module name,
such that `code.namespace` + some separator + `code.function` form a unique identifier for the code unit.
examples: com.example.MyHttpService
- id: filepath
type: string
brief: >
The source code file name that identifies the code unit as uniquely as possible (preferably an absolute file path).
examples: /usr/local/MyApplication/content_root/app/index.php
- id: lineno
type: int
brief: >
The line number in `code.filepath` best representing the operation. It SHOULD point within the code unit named in `code.function`.
examples: 42
- id: column
type: int
brief: >
The column number in `code.filepath` best representing the operation. It SHOULD point within the code unit named in `code.function`.
examples: 16

View File

@ -0,0 +1,17 @@
groups:
- id: registry.thread
prefix: thread
type: span
brief: >
These attributes may be used for any operation to store information about a thread that started a span.
attributes:
- id: id
type: int
brief: >
Current "managed" thread ID (as opposed to OS thread ID).
examples: 42
- id: name
type: string
brief: >
Current thread name.
examples: main