Skip to content

Commit d39f065

Browse files
authored
rename some code attributes (open-telemetry#1624)
1 parent 2f3d1ba commit d39f065

File tree

19 files changed

+152
-47
lines changed

19 files changed

+152
-47
lines changed

.chloggen/code-rename.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Use this changelog template to create an entry for release notes.
2+
#
3+
# If your change doesn't affect end users you should instead start
4+
# your pull request title with [chore] or use the "Skip Changelog" label.
5+
6+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
7+
change_type: breaking
8+
9+
# The name of the area of concern in the attributes-registry, (e.g. http, cloud, db)
10+
component: code
11+
12+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
13+
note: rename `code.function`, `code.lineno`, `code.column` and `code.filepath`
14+
15+
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
16+
# The values here must be integers.
17+
issues: [ 1377, 1599 ]
18+
19+
# (Optional) One or more lines of additional information to render under the primary note.
20+
# These lines will be padded with 2 spaces and then inserted directly into the document.
21+
# Use pipe (|) for multiline entries.
22+
subtext: |
23+
`code.function` renamed to `code.function.name`
24+
`code.lineno` renamed to `code.line.number`
25+
`code.column` renamed to `code.column.number`
26+
`code.filepath` renamed to `code.file.path`

docs/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Semantic Conventions are defined for the following areas:
2222

2323
* **[General](general/README.md): General Semantic Conventions**.
2424
* [CICD](cicd/cicd-metrics.md): Semantic Conventions for CICD systems.
25+
* [Code](code/README.md): Semantic Conventions for code.
2526
* [Cloud Providers](cloud-providers/README.md): Semantic Conventions for cloud providers libraries.
2627
* [CloudEvents](cloudevents/README.md): Semantic Conventions for the CloudEvents specification.
2728
* [Database](database/README.md): Semantic Conventions for database operations.

docs/attributes-registry/code.md

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,29 @@
66

77
# Code
88

9+
- [Code Attributes](#code-attributes)
10+
- [Deprecated Code Attributes](#deprecated-code-attributes)
11+
912
## Code Attributes
1013

11-
These attributes allow to report this unit of code and therefore to provide more context about the span.
14+
These attributes provide context about source code
1215

1316
| Attribute | Type | Description | Examples | Stability |
1417
|---|---|---|---|---|
15-
| <a id="code-column" href="#code-column">`code.column`</a> | int | The column number in `code.filepath` best representing the operation. It SHOULD point within the code unit named in `code.function`. | `16` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
16-
| <a id="code-filepath" href="#code-filepath">`code.filepath`</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` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
17-
| <a id="code-function" href="#code-function">`code.function`</a> | string | The method or function name, or equivalent (usually rightmost part of the code unit's name). | `serveRequest` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
18-
| <a id="code-lineno" href="#code-lineno">`code.lineno`</a> | int | The line number in `code.filepath` best representing the operation. It SHOULD point within the code unit named in `code.function`. | `42` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
19-
| <a id="code-namespace" href="#code-namespace">`code.namespace`</a> | 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` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
18+
| <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` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
19+
| <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` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
20+
| <a id="code-function-name" href="#code-function-name">`code.function.name`</a> | string | The method or function name, or equivalent (usually rightmost part of the code unit's name). | `serveRequest` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
21+
| <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` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
22+
| <a id="code-namespace" href="#code-namespace">`code.namespace`</a> | string | The "namespace" within which `code.function.name` is defined. Usually the qualified class or module name, such that `code.namespace` + some separator + `code.function.name` form a unique identifier for the code unit. | `com.example.MyHttpService` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
2023
| <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)` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
24+
25+
## Deprecated Code Attributes
26+
27+
These deprecated attributes provide context about source code
28+
29+
| Attribute | Type | Description | Examples | Stability |
30+
|---|---|---|---|---|
31+
| <a id="code-column" href="#code-column">`code.column`</a> | int | Deprecated, use `code.column.number` | `16` | ![Deprecated](https://img.shields.io/badge/-deprecated-red)<br>Replaced by `code.column.number` |
32+
| <a id="code-filepath" href="#code-filepath">`code.filepath`</a> | string | Deprecated, use `code.file.path` instead | `/usr/local/MyApplication/content_root/app/index.php` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
33+
| <a id="code-function" href="#code-function">`code.function`</a> | string | Deprecated, use `code.function.name` instead | `serveRequest` | ![Deprecated](https://img.shields.io/badge/-deprecated-red)<br>Replaced by `code.function.name` |
34+
| <a id="code-lineno" href="#code-lineno">`code.lineno`</a> | int | Deprecated, use `code.line.number` instead | `42` | ![Deprecated](https://img.shields.io/badge/-deprecated-red)<br>Replaced by `code.line.number` |

docs/attributes-registry/faas.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ FaaS attributes
4242
**[6] `faas.name`:** This is the name of the function as configured/deployed on the FaaS
4343
platform and is usually different from the name of the callback
4444
function (which may be stored in the
45-
[`code.namespace`/`code.function`](/docs/general/attributes.md#source-code-attributes)
45+
[`code.namespace`/`code.function.name`](/docs/general/attributes.md#source-code-attributes)
4646
span attributes).
4747

4848
For some cloud providers, the above definition is ambiguous. The following

docs/attributes-registry/rpc.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ This document defines attributes for remote procedure calls.
4343

4444
**[5] `rpc.message.id`:** This way we guarantee that the values will be consistent between different implementations.
4545

46-
**[6] `rpc.method`:** This is the logical name of the method from the RPC interface perspective, which can be different from the name of any implementing method/function. The `code.function` attribute may be used to store the latter (e.g., method actually executing the call on the server side, RPC client stub method on the client side).
46+
**[6] `rpc.method`:** This is the logical name of the method from the RPC interface perspective, which can be different from the name of any implementing method/function. The `code.function.name` attribute may be used to store the latter (e.g., method actually executing the call on the server side, RPC client stub method on the client side).
4747

4848
**[7] `rpc.service`:** This is the logical name of the service from the RPC interface perspective, which can be different from the name of any implementing class. The `code.namespace` attribute may be used to store the latter (despite the attribute name, it may include a class name; e.g., class with method actually executing the call on the server side, RPC client stub class on the client side).
4949

docs/cloud-providers/aws-sdk.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ with the naming guidelines for RPC client spans.
3939
| [`rpc.method`](/docs/attributes-registry/rpc.md) | string | The name of the operation corresponding to the request, as returned by the AWS SDK [1] | `GetItem`; `PutItem` | `Recommended` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
4040
| [`rpc.service`](/docs/attributes-registry/rpc.md) | string | The name of the service to which a request is made, as returned by the AWS SDK. [2] | `DynamoDB`; `S3` | `Recommended` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
4141

42-
**[1] `rpc.method`:** This is the logical name of the method from the RPC interface perspective, which can be different from the name of any implementing method/function. The `code.function` attribute may be used to store the latter (e.g., method actually executing the call on the server side, RPC client stub method on the client side).
42+
**[1] `rpc.method`:** This is the logical name of the method from the RPC interface perspective, which can be different from the name of any implementing method/function. The `code.function.name` attribute may be used to store the latter (e.g., method actually executing the call on the server side, RPC client stub method on the client side).
4343

4444
**[2] `rpc.service`:** This is the logical name of the service from the RPC interface perspective, which can be different from the name of any implementing class. The `code.namespace` attribute may be used to store the latter (despite the attribute name, it may include a class name; e.g., class with method actually executing the call on the server side, RPC client stub class on the client side).
4545

docs/code/README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!--- Hugo front matter used to generate the website version of this page:
2+
linkTitle: Code
3+
path_base_for_github_subdir:
4+
from: tmp/semconv/docs/code/_index.md
5+
to: code/README.md
6+
--->
7+
8+
# Semantic Conventions for Code
9+
10+
**Status**: [Experimental][DocumentStatus]
11+
12+
This document defines semantic conventions for source code.
13+
14+
> **Warning**
15+
>
16+
> Existing code instrumentations that are using
17+
> [v1.29.0 of `code` conventions](https://github.com/open-telemetry/semantic-conventions/blob/v1.29.0/docs/attributes-registry/code.md)
18+
> (or prior):
19+
>
20+
> * SHOULD NOT change the version of the `code` conventions that they emit by default
21+
> until the `code` semantic conventions are marked stable.
22+
23+
[DocumentStatus]: https://opentelemetry.io/docs/specs/otel/document-status

0 commit comments

Comments
 (0)