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

mark code.* attributes as release candidate #1599

Merged
merged 17 commits into from
Mar 6, 2025
Merged
Show file tree
Hide file tree
Changes from all 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
22 changes: 22 additions & 0 deletions .chloggen/1599.yaml
Original file line number Diff line number Diff line change
@@ -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:
10 changes: 5 additions & 5 deletions docs/attributes-registry/code.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ These attributes provide context about source code

| Attribute | Type | Description | Examples | Stability |
|---|---|---|---|---|
| <a id="code-column-number" href="#code-column-number">`code.column.number`</a> | 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) |
| <a id="code-file-path" href="#code-file-path">`code.file.path`</a> | 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) |
| <a id="code-function-name" href="#code-function-name">`code.function.name`</a> | 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) |
| <a id="code-line-number" href="#code-line-number">`code.line.number`</a> | 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) |
| <a id="code-stacktrace" href="#code-stacktrace">`code.stacktrace`</a> | 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) |
| <a id="code-column-number" href="#code-column-number">`code.column.number`</a> | 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) |
| <a id="code-file-path" href="#code-file-path">`code.file.path`</a> | 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) |
| <a id="code-function-name" href="#code-function-name">`code.function.name`</a> | 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) |
| <a id="code-line-number" href="#code-line-number">`code.line.number`</a> | 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) |
| <a id="code-stacktrace" href="#code-stacktrace">`code.stacktrace`</a> | 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
Expand Down
2 changes: 1 addition & 1 deletion docs/code/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
13 changes: 7 additions & 6 deletions docs/general/attributes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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)<br>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)<br>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
Expand Down
3 changes: 1 addition & 2 deletions model/code/common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions model/code/registry.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand Down
Loading