Skip to content

Commit 87bd2c1

Browse files
JonasKunzAlexanderWertjoaopgrassi
authored
Add SDK span telemetry metrics (#1631)
Co-authored-by: Alexander Wert <AlexanderWert@users.noreply.github.com> Co-authored-by: Joao Grassi <5938087+joaopgrassi@users.noreply.github.com>
1 parent 67f0516 commit 87bd2c1

File tree

7 files changed

+719
-1
lines changed

7 files changed

+719
-1
lines changed

.chloggen/sdk-span-metrics.yaml

+22
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: Adds SDK self-monitoring metrics for span processing
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: [1631]
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/attributes-registry/otel.md

+50
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
# OTel
55

66
- [OTel Attributes](#otel-attributes)
7+
- [OTel Component Attributes](#otel-component-attributes)
78
- [OTel Scope Attributes](#otel-scope-attributes)
89
- [Deprecated OTel Library Attributes](#deprecated-otel-library-attributes)
910

@@ -13,18 +14,67 @@ Attributes reserved for OpenTelemetry
1314

1415
| Attribute | Type | Description | Examples | Stability |
1516
|---|---|---|---|---|
17+
| <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) |
1618
| <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) |
1719
| <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) |
1820

1921
---
2022

23+
`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.
24+
25+
| Value | Description | Stability |
26+
|---|---|---|
27+
| `DROP` | The span is not sampled and not recording | ![Development](https://img.shields.io/badge/-development-blue) |
28+
| `RECORD_AND_SAMPLE` | The span is sampled and recording | ![Development](https://img.shields.io/badge/-development-blue) |
29+
| `RECORD_ONLY` | The span is not sampled, but recording | ![Development](https://img.shields.io/badge/-development-blue) |
30+
31+
---
32+
2133
`otel.status_code` 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.
2234

2335
| Value | Description | Stability |
2436
|---|---|---|
2537
| `ERROR` | The operation contains an error. | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |
2638
| `OK` | The operation has been validated by an Application developer or Operator to have completed successfully. | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |
2739

40+
## OTel Component Attributes
41+
42+
Attributes used for OpenTelemetry component self-monitoring
43+
44+
| Attribute | Type | Description | Examples | Stability |
45+
|---|---|---|---|---|
46+
| <a id="otel-component-name" href="#otel-component-name">`otel.component.name`</a> | string | A name uniquely identifying the instance of the OpenTelemetry component within its containing SDK instance. [1] | `otlp_grpc_span_exporter/0`; `custom-name` | ![Development](https://img.shields.io/badge/-development-blue) |
47+
| <a id="otel-component-type" href="#otel-component-type">`otel.component.type`</a> | string | A name identifying the type of the OpenTelemetry component. [2] | `batching_span_processor`; `com.example.MySpanExporter` | ![Development](https://img.shields.io/badge/-development-blue) |
48+
49+
**[1] `otel.component.name`:** Implementations SHOULD ensure a low cardinality for this attribute, even across application or SDK restarts.
50+
E.g. implementations MUST NOT use UUIDs as values for this attribute.
51+
52+
Implementations MAY achieve these goals by following a `<otel.component.type>/<instance-counter>` pattern, e.g. `batching_span_processor/0`.
53+
Hereby `otel.component.type` refers to the corresponding attribute value of the component.
54+
55+
The value of `instance-counter` MAY be automatically assigned by the component and uniqueness within the enclosing SDK instance MUST be guaranteed.
56+
For example, `<instance-counter>` MAY be implemented by using a monotonically increasing counter (starting with `0`), which is incremented every time an
57+
instance of the given component type is started.
58+
59+
With this implementation, for example the first Batching Span Processor would have `batching_span_processor/0`
60+
as `otel.component.name`, the second one `batching_span_processor/1` and so on.
61+
These values will therefore be reused in the case of an application restart.
62+
63+
**[2] `otel.component.type`:** If none of the standardized values apply, implementations SHOULD use the language-defined name of the type.
64+
E.g. for Java the fully qualified classname SHOULD be used in this case.
65+
66+
---
67+
68+
`otel.component.type` 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.
69+
70+
| Value | Description | Stability |
71+
|---|---|---|
72+
| `batching_span_processor` | The builtin SDK Batching Span Processor | ![Development](https://img.shields.io/badge/-development-blue) |
73+
| `otlp_grpc_span_exporter` | OTLP span exporter over gRPC with protobuf serialization | ![Development](https://img.shields.io/badge/-development-blue) |
74+
| `otlp_http_json_span_exporter` | OTLP span exporter over HTTP with JSON serialization | ![Development](https://img.shields.io/badge/-development-blue) |
75+
| `otlp_http_span_exporter` | OTLP span exporter over HTTP with protobuf serialization | ![Development](https://img.shields.io/badge/-development-blue) |
76+
| `simple_span_processor` | The builtin SDK Simple Span Processor | ![Development](https://img.shields.io/badge/-development-blue) |
77+
2878
## OTel Scope Attributes
2979

3080
Attributes used by non-OTLP exporters to represent OpenTelemetry Scope's concepts.

docs/general/metrics.md

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ The following semantic conventions surrounding metrics are defined:
3434
* [K8s](/docs/system/k8s-metrics.md): For K8s metrics.
3535
* [Process](/docs/system/process-metrics.md): For standard process metrics.
3636
* [Runtime Environment](/docs/runtime/README.md#metrics): For runtime environment metrics.
37+
* [OTel SDK Telemetry](/docs/otel/sdk-metrics.md): Metrics emitted by the OpenTelemetry SDK components.
3738

3839
Apart from semantic conventions for metrics, [traces](trace.md), [logs](logs.md), and [events](events.md), OpenTelemetry also
3940
defines the concept of overarching [Resources](https://github.com/open-telemetry/opentelemetry-specification/tree/v1.41.0/specification/resource/sdk.md) with

0 commit comments

Comments
 (0)