diff --git a/.chloggen/1599.yaml b/.chloggen/1599.yaml new file mode 100644 index 0000000000..2efbbcbb6b --- /dev/null +++ b/.chloggen/1599.yaml @@ -0,0 +1,22 @@ +# Use this changelog template to create an entry for release notes. +# +# If your change doesn't affect end users you should instead start +# your pull request title with [chore] or use the "Skip Changelog" label. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: enhancement + +# The name of the area of concern in the attributes-registry, (e.g. http, cloud, db) +component: code + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Mark `code.*` semantic conventions as release candidate + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +# The values here must be integers. +issues: [ 1377 ] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: diff --git a/docs/attributes-registry/code.md b/docs/attributes-registry/code.md index f2f72c32ba..7f31612726 100644 --- a/docs/attributes-registry/code.md +++ b/docs/attributes-registry/code.md @@ -12,11 +12,11 @@ These attributes provide context about source code | Attribute | Type | Description | Examples | Stability | |---|---|---|---|---| -| `code.column.number` | int | The column number in `code.file.path` best representing the operation. It SHOULD point within the code unit named in `code.function.name`. | `16` | ![Development](https://img.shields.io/badge/-development-blue) | -| `code.file.path` | 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` | ![Development](https://img.shields.io/badge/-development-blue) | -| `code.function.name` | string | The method or function fully-qualified name without arguments. The value should fit the natural representation of the language runtime, which is also likely the same used within `code.stacktrace` attribute value. [1] | `com.example.MyHttpService.serveRequest`; `GuzzleHttp\Client::transfer`; `fopen` | ![Development](https://img.shields.io/badge/-development-blue) | -| `code.line.number` | int | The line number in `code.file.path` best representing the operation. It SHOULD point within the code unit named in `code.function.name`. | `42` | ![Development](https://img.shields.io/badge/-development-blue) | -| `code.stacktrace` | string | A stacktrace as a string in the natural representation for the language runtime. The representation is to be determined and documented by each language SIG. | `at com.example.GenerateTrace.methodB(GenerateTrace.java:13)\n at com.example.GenerateTrace.methodA(GenerateTrace.java:9)\n at com.example.GenerateTrace.main(GenerateTrace.java:5)` | ![Development](https://img.shields.io/badge/-development-blue) | +| `code.column.number` | int | The column number in `code.file.path` best representing the operation. It SHOULD point within the code unit named in `code.function.name`. | `16` | ![Release Candidate](https://img.shields.io/badge/-rc-mediumorchid) | +| `code.file.path` | 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` | ![Release Candidate](https://img.shields.io/badge/-rc-mediumorchid) | +| `code.function.name` | string | The method or function fully-qualified name without arguments. The value should fit the natural representation of the language runtime, which is also likely the same used within `code.stacktrace` attribute value. [1] | `com.example.MyHttpService.serveRequest`; `GuzzleHttp\Client::transfer`; `fopen` | ![Release Candidate](https://img.shields.io/badge/-rc-mediumorchid) | +| `code.line.number` | int | The line number in `code.file.path` best representing the operation. It SHOULD point within the code unit named in `code.function.name`. | `42` | ![Release Candidate](https://img.shields.io/badge/-rc-mediumorchid) | +| `code.stacktrace` | string | A stacktrace as a string in the natural representation for the language runtime. The representation is identical to [`exception.stacktrace`](/docs/exceptions/exceptions-spans.md#stacktrace-representation). | `at com.example.GenerateTrace.methodB(GenerateTrace.java:13)\n at com.example.GenerateTrace.methodA(GenerateTrace.java:9)\n at com.example.GenerateTrace.main(GenerateTrace.java:5)` | ![Release Candidate](https://img.shields.io/badge/-rc-mediumorchid) | **[1] `code.function.name`:** Values and format depends on each language runtime, thus it is impossible to provide an exhaustive list of examples. The values are usually the same (or prefixes of) the ones found in native stack trace representation stored in diff --git a/docs/code/README.md b/docs/code/README.md index 4f70db0c23..5670bb68d7 100644 --- a/docs/code/README.md +++ b/docs/code/README.md @@ -4,7 +4,7 @@ linkTitle: Code # Semantic conventions for code -**Status**: [Development][DocumentStatus] +**Status**: [Release Candidate][DocumentStatus] This document defines semantic conventions for source code. diff --git a/docs/general/attributes.md b/docs/general/attributes.md index 40348ee28b..2218eddf4f 100644 --- a/docs/general/attributes.md +++ b/docs/general/attributes.md @@ -415,6 +415,8 @@ Examples of where `thread.id` and `thread.name` can be extracted from: ## 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. @@ -430,12 +432,11 @@ about the span. | Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability | |---|---|---|---|---|---| -| [`code.column.number`](/docs/attributes-registry/code.md) | int | The column number in `code.file.path` best representing the operation. It SHOULD point within the code unit named in `code.function.name`. | `16` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) | -| [`code.filepath`](/docs/attributes-registry/code.md) | string | Deprecated, use `code.file.path` instead | `/usr/local/MyApplication/content_root/app/index.php` | `Recommended` | ![Deprecated](https://img.shields.io/badge/-deprecated-red)
Replaced by `code.file.path` | -| [`code.function.name`](/docs/attributes-registry/code.md) | string | The method or function fully-qualified name without arguments. The value should fit the natural representation of the language runtime, which is also likely the same used within `code.stacktrace` attribute value. [1] | `com.example.MyHttpService.serveRequest`; `GuzzleHttp\Client::transfer`; `fopen` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) | -| [`code.line.number`](/docs/attributes-registry/code.md) | int | The line number in `code.file.path` best representing the operation. It SHOULD point within the code unit named in `code.function.name`. | `42` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) | -| [`code.namespace`](/docs/attributes-registry/code.md) | string | Deprecated, namespace is now included into `code.function.name` | `com.example.MyHttpService` | `Recommended` | ![Deprecated](https://img.shields.io/badge/-deprecated-red)
Value should be included in `code.function.name` which is expected to be a fully-qualified name. | -| [`code.stacktrace`](/docs/attributes-registry/code.md) | string | A stacktrace as a string in the natural representation for the language runtime. The representation is to be determined and documented by each language SIG. | `at com.example.GenerateTrace.methodB(GenerateTrace.java:13)\n at com.example.GenerateTrace.methodA(GenerateTrace.java:9)\n at com.example.GenerateTrace.main(GenerateTrace.java:5)` | `Opt-In` | ![Development](https://img.shields.io/badge/-development-blue) | +| [`code.column.number`](/docs/attributes-registry/code.md) | int | The column number in `code.file.path` best representing the operation. It SHOULD point within the code unit named in `code.function.name`. | `16` | `Recommended` | ![Release Candidate](https://img.shields.io/badge/-rc-mediumorchid) | +| [`code.file.path`](/docs/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` | ![Release Candidate](https://img.shields.io/badge/-rc-mediumorchid) | +| [`code.function.name`](/docs/attributes-registry/code.md) | string | The method or function fully-qualified name without arguments. The value should fit the natural representation of the language runtime, which is also likely the same used within `code.stacktrace` attribute value. [1] | `com.example.MyHttpService.serveRequest`; `GuzzleHttp\Client::transfer`; `fopen` | `Recommended` | ![Release Candidate](https://img.shields.io/badge/-rc-mediumorchid) | +| [`code.line.number`](/docs/attributes-registry/code.md) | int | The line number in `code.file.path` best representing the operation. It SHOULD point within the code unit named in `code.function.name`. | `42` | `Recommended` | ![Release Candidate](https://img.shields.io/badge/-rc-mediumorchid) | +| [`code.stacktrace`](/docs/attributes-registry/code.md) | string | A stacktrace as a string in the natural representation for the language runtime. The representation is identical to [`exception.stacktrace`](/docs/exceptions/exceptions-spans.md#stacktrace-representation). | `at com.example.GenerateTrace.methodB(GenerateTrace.java:13)\n at com.example.GenerateTrace.methodA(GenerateTrace.java:9)\n at com.example.GenerateTrace.main(GenerateTrace.java:5)` | `Opt-In` | ![Release Candidate](https://img.shields.io/badge/-rc-mediumorchid) | **[1] `code.function.name`:** Values and format depends on each language runtime, thus it is impossible to provide an exhaustive list of examples. The values are usually the same (or prefixes of) the ones found in native stack trace representation stored in diff --git a/model/code/common.yaml b/model/code/common.yaml index f455943005..e8c43c35cb 100644 --- a/model/code/common.yaml +++ b/model/code/common.yaml @@ -5,8 +5,7 @@ groups: These attributes provide context about source code attributes: - ref: code.function.name - - ref: code.namespace - - ref: code.filepath + - ref: code.file.path - ref: code.line.number - ref: code.column.number - ref: code.stacktrace diff --git a/model/code/registry.yaml b/model/code/registry.yaml index 24f0fcfa14..0e90c194da 100644 --- a/model/code/registry.yaml +++ b/model/code/registry.yaml @@ -7,7 +7,7 @@ groups: attributes: - id: code.function.name type: string - stability: development + stability: release_candidate brief: > The method or function fully-qualified name without arguments. The value should fit the natural representation of the language runtime, which is also likely the same used within `code.stacktrace` attribute value. @@ -33,28 +33,28 @@ groups: * C function: `fopen` - id: code.file.path type: string - stability: development + stability: release_candidate 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: code.line.number type: int - stability: development + stability: release_candidate brief: > The line number in `code.file.path` best representing the operation. It SHOULD point within the code unit named in `code.function.name`. examples: 42 - id: code.column.number type: int - stability: development + stability: release_candidate brief: > The column number in `code.file.path` best representing the operation. It SHOULD point within the code unit named in `code.function.name`. examples: 16 - id: code.stacktrace type: string - stability: development + stability: release_candidate brief: > A stacktrace as a string in the natural representation for the language runtime. - The representation is to be determined and documented by each language SIG. + The representation is identical to [`exception.stacktrace`](/docs/exceptions/exceptions-spans.md#stacktrace-representation). examples: > at com.example.GenerateTrace.methodB(GenerateTrace.java:13)\n at com.example.GenerateTrace.methodA(GenerateTrace.java:9)\n