Skip to content

Commit 83b5544

Browse files
authored
Replace otel.sdk.span.ended metric with improved span.started metric (#2431)
1 parent b32b0d9 commit 83b5544

File tree

6 files changed

+84
-22
lines changed

6 files changed

+84
-22
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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: 'enhancement'
8+
9+
# The name of the area of concern in the attributes-registry, (e.g. http, cloud, db)
10+
component: 'otel'
11+
12+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
13+
note: Replaces `otel.sdk.span.ended` with `otel.sdk.span.started` and allow differentiation based on the parent span origin
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: [2431]
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:

docs/otel/sdk-metrics.md

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ This document describes metrics emitted by the OpenTelemetry SDK components them
1414

1515
- [Span metrics](#span-metrics)
1616
- [Metric: `otel.sdk.span.live`](#metric-otelsdkspanlive)
17-
- [Metric: `otel.sdk.span.ended`](#metric-otelsdkspanended)
17+
- [Metric: `otel.sdk.span.started`](#metric-otelsdkspanstarted)
1818
- [Metric: `otel.sdk.processor.span.queue.size`](#metric-otelsdkprocessorspanqueuesize)
1919
- [Metric: `otel.sdk.processor.span.queue.capacity`](#metric-otelsdkprocessorspanqueuecapacity)
2020
- [Metric: `otel.sdk.processor.span.processed`](#metric-otelsdkprocessorspanprocessed)
@@ -51,10 +51,7 @@ This metric is [recommended][MetricRecommended].
5151

5252
| Name | Instrument Type | Unit (UCUM) | Description | Stability | Entity Associations |
5353
| -------- | --------------- | ----------- | -------------- | --------- | ------ |
54-
| `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) | |
55-
56-
**[1]:** For spans with `recording=true`: Implementations MUST record both `otel.sdk.span.live` and `otel.sdk.span.ended`.
57-
For spans with `recording=false`: If implementations decide to record this metric, they MUST also record `otel.sdk.span.ended`.
54+
| `otel.sdk.span.live` | UpDownCounter | `{span}` | The number of created spans with `recording=true` for which the end operation has not been called yet | ![Development](https://img.shields.io/badge/-development-blue) | |
5855

5956
| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
6057
|---|---|---|---|---|---|
@@ -75,11 +72,11 @@ For spans with `recording=false`: If implementations decide to record this metri
7572
<!-- END AUTOGENERATED TEXT -->
7673
<!-- endsemconv -->
7774

78-
### Metric: `otel.sdk.span.ended`
75+
### Metric: `otel.sdk.span.started`
7976

8077
This metric is [recommended][MetricRecommended].
8178

82-
<!-- semconv metric.otel.sdk.span.ended -->
79+
<!-- semconv metric.otel.sdk.span.started -->
8380
<!-- NOTE: THIS TEXT IS AUTOGENERATED. DO NOT EDIT BY HAND. -->
8481
<!-- see templates/registry/markdown/snippet.md.j2 -->
8582
<!-- prettier-ignore-start -->
@@ -88,17 +85,27 @@ This metric is [recommended][MetricRecommended].
8885

8986
| Name | Instrument Type | Unit (UCUM) | Description | Stability | Entity Associations |
9087
| -------- | --------------- | ----------- | -------------- | --------- | ------ |
91-
| `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) | |
88+
| `otel.sdk.span.started` | Counter | `{span}` | The number of created spans [1] | ![Development](https://img.shields.io/badge/-development-blue) | |
9289

93-
**[1]:** For spans with `recording=true`: Implementations MUST record both `otel.sdk.span.live` and `otel.sdk.span.ended`.
94-
For spans with `recording=false`: If implementations decide to record this metric, they MUST also record `otel.sdk.span.live`.
90+
**[1]:** Implementations MUST record this metric for all spans, even for non-recording ones.
9591

9692
| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
9793
|---|---|---|---|---|---|
94+
| [`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](https://opentelemetry.io/docs/specs/otel/trace/api/#isremote) | `none`; `local`; `remote` | `Recommended` | ![Development](https://img.shields.io/badge/-development-blue) |
9895
| [`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) |
9996

10097
---
10198

99+
`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.
100+
101+
| Value | Description | Stability |
102+
|---|---|---|
103+
| `local` | The span has a parent and the parent's span context [isRemote()](https://opentelemetry.io/docs/specs/otel/trace/api/#isremote) is false | ![Development](https://img.shields.io/badge/-development-blue) |
104+
| `none` | The span does not have a parent, it is a root span | ![Development](https://img.shields.io/badge/-development-blue) |
105+
| `remote` | The span has a parent and the parent's span context [isRemote()](https://opentelemetry.io/docs/specs/otel/trace/api/#isremote) is true | ![Development](https://img.shields.io/badge/-development-blue) |
106+
107+
---
108+
102109
`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.
103110

104111
| Value | Description | Stability |

docs/registry/attributes/otel.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,23 @@ Attributes reserved for OpenTelemetry
1414

1515
| Attribute | Type | Description | Examples | Stability |
1616
|---|---|---|---|---|
17+
| <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](https://opentelemetry.io/docs/specs/otel/trace/api/#isremote) | `none`; `local`; `remote` | ![Development](https://img.shields.io/badge/-development-blue) |
1718
| <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) |
1819
| <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) |
1920
| <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) |
2021

2122
---
2223

24+
`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.
25+
26+
| Value | Description | Stability |
27+
|---|---|---|
28+
| `local` | The span has a parent and the parent's span context [isRemote()](https://opentelemetry.io/docs/specs/otel/trace/api/#isremote) is false | ![Development](https://img.shields.io/badge/-development-blue) |
29+
| `none` | The span does not have a parent, it is a root span | ![Development](https://img.shields.io/badge/-development-blue) |
30+
| `remote` | The span has a parent and the parent's span context [isRemote()](https://opentelemetry.io/docs/specs/otel/trace/api/#isremote) is true | ![Development](https://img.shields.io/badge/-development-blue) |
31+
32+
---
33+
2334
`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.
2435

2536
| Value | Description | Stability |

model/otel/deprecated/metrics-deprecated.yaml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@ groups:
1414
metric_name: otel.sdk.span.ended.count
1515
stability: development
1616
deprecated:
17-
reason: renamed
18-
renamed_to: otel.sdk.span.ended
19-
brief: "Deprecated, use `otel.sdk.span.ended` instead."
17+
reason: obsoleted
18+
brief: "Use `otel.sdk.span.started` minus `otel.sdk.span.live` to derive this value."
2019
instrument: counter
2120
unit: "{span}"
2221
- id: metric.otel.sdk.processor.span.processed.count
@@ -49,3 +48,12 @@ groups:
4948
brief: "Deprecated, use `otel.sdk.exporter.span.exported` instead."
5049
instrument: updowncounter
5150
unit: "{span}"
51+
- id: metric.otel.sdk.span.ended
52+
type: metric
53+
metric_name: otel.sdk.span.ended
54+
stability: development
55+
deprecated:
56+
reason: obsoleted
57+
brief: "Use `otel.sdk.span.started` minus `otel.sdk.span.live` to derive this value."
58+
instrument: counter
59+
unit: "{span}"

model/otel/metrics.yaml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,24 @@ groups:
33
type: metric
44
metric_name: otel.sdk.span.live
55
stability: development
6-
brief: "The number of created spans for which the end operation has not been called yet"
6+
brief: "The number of created spans with `recording=true` for which the end operation has not been called yet"
77
instrument: updowncounter
88
unit: "{span}"
9-
note: |
10-
For spans with `recording=true`: Implementations MUST record both `otel.sdk.span.live` and `otel.sdk.span.ended`.
11-
For spans with `recording=false`: If implementations decide to record this metric, they MUST also record `otel.sdk.span.ended`.
129
attributes:
1310
- ref: otel.span.sampling_result
1411

15-
- id: metric.otel.sdk.span.ended
12+
- id: metric.otel.sdk.span.started
1613
type: metric
17-
metric_name: otel.sdk.span.ended
14+
metric_name: otel.sdk.span.started
1815
stability: development
19-
brief: "The number of created spans for which the end operation was called"
16+
brief: "The number of created spans"
2017
instrument: counter
2118
unit: "{span}"
2219
note: |
23-
For spans with `recording=true`: Implementations MUST record both `otel.sdk.span.live` and `otel.sdk.span.ended`.
24-
For spans with `recording=false`: If implementations decide to record this metric, they MUST also record `otel.sdk.span.live`.
20+
Implementations MUST record this metric for all spans, even for non-recording ones.
2521
attributes:
2622
- ref: otel.span.sampling_result
23+
- ref: otel.span.parent.origin
2724

2825
- id: metric.otel.sdk.processor.span.queue.size
2926
type: metric

model/otel/registry.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,23 @@ groups:
3939
stability: development
4040
brief: "The result value of the sampler for this span"
4141
stability: development
42+
- id: otel.span.parent.origin
43+
type:
44+
members:
45+
- id: none
46+
value: none
47+
brief: 'The span does not have a parent, it is a root span'
48+
stability: development
49+
- id: local
50+
value: local
51+
brief: The span has a parent and the parent's span context [isRemote()](https://opentelemetry.io/docs/specs/otel/trace/api/#isremote) is false
52+
stability: development
53+
- id: remote
54+
value: remote
55+
brief: The span has a parent and the parent's span context [isRemote()](https://opentelemetry.io/docs/specs/otel/trace/api/#isremote) is true
56+
stability: development
57+
brief: "Determines whether the span has a parent span, and if so, [whether it is a remote parent](https://opentelemetry.io/docs/specs/otel/trace/api/#isremote)"
58+
stability: development
4259
- id: registry.otel.scope
4360
type: attribute_group
4461
display_name: OTel Scope Attributes

0 commit comments

Comments
 (0)