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

rename some code attributes #1624

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 10 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
25 changes: 25 additions & 0 deletions .chloggen/code-rename.yaml
Copy link
Member

@trask trask Dec 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd recommend leaving this PR open until December 12 11 (to give us time to raise in the meetings below)

I'd like to give enough community notice, especially since we aren't planning to provide any migration plan

I will post today in #otel-semantic-conventions, #otel-specification, and #otel-maintainers slack channels

and I'll add it to next week's meeting agendas for those SIGs to make sure everyone has a chance to voice any concerns before we merge it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a general strategy to provide a migration plan when renaming attributes beyond communication ?

Once this is merged and we know it will be included in the next semconv release, I think that I can open issues in the known impacted repositories that have been listed in the description. Please 👍 or reply to this comment if you think it's the right approach and I'll create issues.

Here we deprecate existing attributes, so I think that only the repositories where deprecation warnings are not permitted opentelemetry-java-instrumentation would require to deal with that in the semconv update PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the related announcement on slack I got what "migration plan" here means: using OTEL_SEMCONV_STABILITY_OPT_IN configuration and keeping it compatible for a while, likely waiting for the next major release of each component before finally doing the change.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the consensus is that code namespace is not used wide enough to justify the migration plan (see notes https://docs.google.com/document/d/1pdvPeKjA8v8w_fGKAN68JjWBmVJtPCpqdi9IZrd6eEo/edit?tab=t.0), so we should be good to go.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is being used.
If people have to start properly migrating these breaking changes maybe they will be less trigger happy in creating them.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brunobat are you asking to include code attribute breaking changes under a OTEL_SEMCONV_STABILITY_OPT_IN plan similar to http attribute breaking changes? thanks

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SylvainJuge probably we should (at least) include language:

Warning Existing instrumentations that are using v1.29.0 of this document (or prior)
SHOULD NOT change the version of the code attribute conventions that they emit by default until the code attribute semantic conventions are marked stable.

to ensure that people only have to deal with a single breaking change from now until stabilization is complete

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brunobat do you have particular examples that would be problematic here ? Most usages I've found were in producing telemetry, not on the consumption side.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@trask, I'm ok with your suggestion.

@SylvainJuge, I've only used those properties in PoCs, it's not critical if they change.
This is a matter of principle.
In a public project like this, people shouldn't assume it's not used just because it doesn't show up in a search.
Many projects and libraries outside the OpenTelemetry repository are starting to rely on semantic conventions. Breaking them frequently will put a break on adoption.

Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# 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: breaking

# 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: rename `code.function`, `code.lineno` and `code.column`

# 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, 1599 ]

# (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: |
`code.function` renamed to `code.function.name`
`code.lineno` renamed to `code.line.number`
`code.column` renamed to `code.column.number`
23 changes: 18 additions & 5 deletions docs/attributes-registry/code.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,28 @@

# Code

- [Code Attributes](#code-attributes)
- [Deprecated Code Attributes](#deprecated-code-attributes)

## Code Attributes

These attributes allow to report this unit of code and therefore to provide more context about the span.
These attributes provide context about source code

| Attribute | Type | Description | Examples | Stability |
|---|---|---|---|---|
| <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) |
| <a id="code-column-number" href="#code-column-number">`code.column.number`</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) |
| <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) |
| <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) |
| <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) |
| <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) |
| <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) |
trask marked this conversation as resolved.
Show resolved Hide resolved
| <a id="code-line-number" href="#code-line-number">`code.line.number`</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) |
| <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) |
| <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) |

## Deprecated Code Attributes

These deprecated attributes provide context about source code

| Attribute | Type | Description | Examples | Stability |
|---|---|---|---|---|
| <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` |
| <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` |
| <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` |
8 changes: 4 additions & 4 deletions docs/general/attributes.md
Original file line number Diff line number Diff line change
Expand Up @@ -489,11 +489,11 @@ about the span.

| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
|---|---|---|---|---|---|
| [`code.column`](/docs/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` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| [`code.column.number`](/docs/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` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| [`code.filepath`](/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` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| [`code.function`](/docs/attributes-registry/code.md) | string | The method or function name, or equivalent (usually rightmost part of the code unit's name). | `serveRequest` | `Recommended` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| [`code.lineno`](/docs/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` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| [`code.namespace`](/docs/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` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| [`code.function.name`](/docs/attributes-registry/code.md) | string | The method or function name, or equivalent (usually rightmost part of the code unit's name). | `serveRequest` | `Recommended` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| [`code.line.number`](/docs/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` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| [`code.namespace`](/docs/attributes-registry/code.md) | 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` | `Recommended` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| [`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` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |

<!-- markdownlint-restore -->
Expand Down
8 changes: 4 additions & 4 deletions model/code/common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ groups:
- id: code
type: attribute_group
brief: >
These attributes allow to report this unit of code and therefore to provide more context about the span.
These attributes provide context about source code
attributes:
- ref: code.function
- ref: code.function.name
- ref: code.namespace
- ref: code.filepath
- ref: code.lineno
- ref: code.column
- ref: code.line.number
- ref: code.column.number
- ref: code.stacktrace
requirement_level: opt_in
28 changes: 28 additions & 0 deletions model/code/registry-deprecated.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
groups:
- id: registry.code.deprecated
type: attribute_group
display_name: Deprecated Code Attributes
brief: >
These deprecated attributes provide context about source code
attributes:
- id: code.function
type: string
stability: experimental
deprecated: Replaced by `code.function.name`
brief: >
Deprecated, use `code.function.name` instead
examples: serveRequest
- id: code.lineno
type: int
stability: experimental
deprecated: Replaced by `code.line.number`
brief: >
Deprecated, use `code.line.number` instead
examples: 42
- id: code.column
type: int
stability: experimental
deprecated: Replaced by `code.column.number`
brief: >
Deprecated, use `code.column.number`
examples: 16
12 changes: 6 additions & 6 deletions model/code/registry.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ groups:
type: attribute_group
display_name: Code Attributes
brief: >
These attributes allow to report this unit of code and therefore to provide more context about the span.
These attributes provide context about source code
attributes:
- id: code.function
- id: code.function.name
type: string
stability: experimental
brief: >
Expand All @@ -15,22 +15,22 @@ groups:
type: string
stability: experimental
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.
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.
examples: com.example.MyHttpService
- id: code.filepath
type: string
stability: experimental
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.lineno
- id: code.line.number
type: int
stability: experimental
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: code.column
- id: code.column.number
type: int
stability: experimental
brief: >
Expand Down
8 changes: 8 additions & 0 deletions schema-next.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@ file_format: 1.1.0
schema_url: https://opentelemetry.io/schemas/next
versions:
next:
all:
changes:
# https://github.com/open-telemetry/semantic-conventions/pull/1624
- rename_attributes:
attribute_map:
code.function: code.function.name
code.lineno: code.line.number
code.column: code.column.number
SylvainJuge marked this conversation as resolved.
Show resolved Hide resolved
1.29.0:
all:
changes:
Expand Down
Loading