Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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/span-ended-metric-improvements.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: 'otel'

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Ensure that the `otel.sdk.span.ended` is collected even for non-recording spans and allow differentiation based on the parent span origin

# 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: [2431]

# (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:
18 changes: 16 additions & 2 deletions docs/otel/sdk-metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ This metric is [recommended][MetricRecommended].
| `otel.sdk.span.live` | UpDownCounter | `{span}` | The number of created spans for which the end operation has not been called yet [1] | ![Development](https://img.shields.io/badge/-development-blue) | |

**[1]:** For spans with `recording=true`: Implementations MUST record both `otel.sdk.span.live` and `otel.sdk.span.ended`.
For spans with `recording=false`: If implementations decide to record this metric, they MUST also record `otel.sdk.span.ended`.
For spans with `recording=false`: Implementations MAY omit recording `otel.sdk.span.live` (e.g. for performance or simplicity reasons).
In that case they MUST record `otel.sdk.span.ended` on span start for those spans instead.

| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
|---|---|---|---|---|---|
Expand Down Expand Up @@ -91,14 +92,27 @@ This metric is [recommended][MetricRecommended].
| `otel.sdk.span.ended` | Counter | `{span}` | The number of created spans for which the end operation was called [1] | ![Development](https://img.shields.io/badge/-development-blue) | |

**[1]:** For spans with `recording=true`: Implementations MUST record both `otel.sdk.span.live` and `otel.sdk.span.ended`.
For spans with `recording=false`: If implementations decide to record this metric, they MUST also record `otel.sdk.span.live`.
For spans with `recording=false`: If implementations decide to not record `otel.sdk.span.live`, they MUST record `otel.sdk.span.ended` on span start for those spans instead.
In other words, for spans with `recording=false` implementations may treat them as ended directly after they are started from a metrics perspective.
This ensures that `otel.sdk.span.ended` is guaranteed to provide insights about the total span counts and sampling rates, even if spans are not recorded.

| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
|---|---|---|---|---|---|
| [`otel.span.parent.origin`](/docs/registry/attributes/otel.md) | string | Determines whether the span has a parent span, and if so, whether it is a remote parent | `NONE`; `LOCAL`; `REMOTE` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) |
| [`otel.span.sampling_result`](/docs/registry/attributes/otel.md) | string | The result value of the sampler for this span | `DROP`; `RECORD_ONLY`; `RECORD_AND_SAMPLE` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) |

---

`otel.span.parent.origin` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.

| Value | Description | Stability |
|---|---|---|
| `LOCAL` | The span has a parent and the parent's span context isRemote() is false | ![Development](https://img.shields.io/badge/-development-blue) |
| `NONE` | The span does not have a parent, it is a root span | ![Development](https://img.shields.io/badge/-development-blue) |
| `REMOTE` | The span has a parent and the parent's span context isRemote() is true | ![Development](https://img.shields.io/badge/-development-blue) |

---

`otel.span.sampling_result` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.

| Value | Description | Stability |
Expand Down
11 changes: 11 additions & 0 deletions docs/registry/attributes/otel.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,23 @@ Attributes reserved for OpenTelemetry

| Attribute | Type | Description | Examples | Stability |
|---|---|---|---|---|
| <a id="otel-span-parent-origin" href="#otel-span-parent-origin">`otel.span.parent.origin`</a> | string | Determines whether the span has a parent span, and if so, whether it is a remote parent | `NONE`; `LOCAL`; `REMOTE` | ![Development](https://img.shields.io/badge/-development-blue) |
| <a id="otel-span-sampling-result" href="#otel-span-sampling-result">`otel.span.sampling_result`</a> | string | The result value of the sampler for this span | `DROP`; `RECORD_ONLY`; `RECORD_AND_SAMPLE` | ![Development](https://img.shields.io/badge/-development-blue) |
| <a id="otel-status-code" href="#otel-status-code">`otel.status_code`</a> | string | Name of the code, either "OK" or "ERROR". MUST NOT be set if the status code is UNSET. | `OK`; `ERROR` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |
| <a id="otel-status-description" href="#otel-status-description">`otel.status_description`</a> | string | Description of the Status if it has a value, otherwise not set. | `resource not found` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |

---

`otel.span.parent.origin` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.

| Value | Description | Stability |
|---|---|---|
| `LOCAL` | The span has a parent and the parent's span context isRemote() is false | ![Development](https://img.shields.io/badge/-development-blue) |
| `NONE` | The span does not have a parent, it is a root span | ![Development](https://img.shields.io/badge/-development-blue) |
| `REMOTE` | The span has a parent and the parent's span context isRemote() is true | ![Development](https://img.shields.io/badge/-development-blue) |

---

`otel.span.sampling_result` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.

| Value | Description | Stability |
Expand Down
8 changes: 6 additions & 2 deletions model/otel/metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ groups:
unit: "{span}"
note: |
For spans with `recording=true`: Implementations MUST record both `otel.sdk.span.live` and `otel.sdk.span.ended`.
For spans with `recording=false`: If implementations decide to record this metric, they MUST also record `otel.sdk.span.ended`.
For spans with `recording=false`: Implementations MAY omit recording `otel.sdk.span.live` (e.g. for performance or simplicity reasons).
In that case they MUST record `otel.sdk.span.ended` on span start for those spans instead.
attributes:
- ref: otel.span.sampling_result

Expand All @@ -21,9 +22,12 @@ groups:
unit: "{span}"
note: |
For spans with `recording=true`: Implementations MUST record both `otel.sdk.span.live` and `otel.sdk.span.ended`.
For spans with `recording=false`: If implementations decide to record this metric, they MUST also record `otel.sdk.span.live`.
For spans with `recording=false`: If implementations decide to not record `otel.sdk.span.live`, they MUST record `otel.sdk.span.ended` on span start for those spans instead.
In other words, for spans with `recording=false` implementations may treat them as ended directly after they are started from a metrics perspective.
This ensures that `otel.sdk.span.ended` is guaranteed to provide insights about the total span counts and sampling rates, even if spans are not recorded.
attributes:
- ref: otel.span.sampling_result
- ref: otel.span.parent.origin

- id: metric.otel.sdk.processor.span.queue.size
type: metric
Expand Down
17 changes: 17 additions & 0 deletions model/otel/registry.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,23 @@ groups:
stability: development
brief: "The result value of the sampler for this span"
stability: development
- id: otel.span.parent.origin
type:
members:
- id: none
value: NONE
brief: 'The span does not have a parent, it is a root span'
stability: development
- id: local
value: LOCAL
brief: The span has a parent and the parent's span context isRemote() is false
stability: development
- id: remote
value: REMOTE
brief: The span has a parent and the parent's span context isRemote() is true
stability: development
brief: "Determines whether the span has a parent span, and if so, whether it is a remote parent"
stability: development
- id: registry.otel.scope
type: attribute_group
display_name: OTel Scope Attributes
Expand Down
Loading