-
Notifications
You must be signed in to change notification settings - Fork 191
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
Add SDK span telemetry metrics #1631
Open
JonasKunz
wants to merge
53
commits into
open-telemetry:main
Choose a base branch
from
JonasKunz:sdk-telemetry
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
53 commits
Select commit
Hold shift + click to select a range
8f2b666
Added SDK span telemetry metrics
JonasKunz 8b2a1db
Fix formatting
JonasKunz 8bbea82
Fix yamllint
JonasKunz e15696f
Merge remote-tracking branch 'otel/main' into sdk-telemetry
JonasKunz cef63f2
Changelog
JonasKunz c24bccc
Reuse error.type
JonasKunz 34e56e7
Use enum for processor and exporter type attributes
JonasKunz 4248917
Renamed trace to span namespace
JonasKunz 2174d24
Fixed invalid metric name
JonasKunz 0e54b96
fix lots of dumb mistakes
JonasKunz c62be64
Added queue_capacity metric
JonasKunz 2f491df
Clarified meaning of submitted
JonasKunz 1388eac
replaced spans_failed with spans_processed metric
JonasKunz 2c60a71
Tried clarifying elemetry.sdk.component.id
JonasKunz 0cfb94d
Merge branch 'main' into sdk-telemetry
JonasKunz 15b37aa
Merge branch 'main' into sdk-telemetry
JonasKunz 8ae4b58
Merge branch 'main' into sdk-telemetry
JonasKunz 67ab2d0
Moved from telemetry. to otel. namespace
JonasKunz 598636f
mend
JonasKunz b0fd83d
Rename spans_submitted to spans_exported
JonasKunz 27f7690
Cleanup metrics with review suggestions
JonasKunz f1e1404
Clarify rejected data handling
JonasKunz 4db7605
removed type in favor of component.name
JonasKunz 26e21b2
Use {span} as unit
JonasKunz 0ce6583
Merge branch 'main' into sdk-telemetry
JonasKunz 820c5c6
Lint fixes
JonasKunz ef5bd53
Remove trailing empty line
JonasKunz 8c10557
Merge branch 'main' into sdk-telemetry
JonasKunz ff663de
Merge branch 'main' into sdk-telemetry
JonasKunz 833352b
Fix attribute registry name
JonasKunz 226b42f
Renamed otel.is_sampled to otel.span.is_sampled
JonasKunz a5374c3
Merge branch 'main' into sdk-telemetry
JonasKunz e9aa0ee
Merge branch 'main' into sdk-telemetry
JonasKunz 53ecd6c
Merge branch 'main' into sdk-telemetry
AlexanderWert 1a82268
Remove leftover unused attributes
JonasKunz 37d5810
Merge branch 'main' into sdk-telemetry
JonasKunz e737b7d
Added back reworked otel.sdk.component.type attribute
JonasKunz 772d29a
Fix lint
JonasKunz c99e3ae
Merge branch 'main' into sdk-telemetry
JonasKunz 935c01c
Fix otel.sdk.component.type enum value descriptions
JonasKunz 04c0085
Fix missing _span prefixes
JonasKunz 667028d
Fix another missing _span prefix
JonasKunz 9794c79
Merge branch 'main' into sdk-telemetry
JonasKunz cc3c66d
Merge branch 'main' into sdk-telemetry
JonasKunz 02a4ca6
remove spans-created metric
JonasKunz df27efd
make queue capacity an updowncounter
JonasKunz 33cf4b3
Replace is_sampled with sampling_result
JonasKunz a89cc1f
Clarify unrecorded spans handling
JonasKunz 0070795
Fix example typo
JonasKunz 1f73e44
Replace underscores with dots in metric names
JonasKunz 48b62c8
Rename exporter metrics
JonasKunz 830edfb
Add server.* attributes to exporter metrics
JonasKunz f5f18c2
Merge branch 'main' into sdk-telemetry
JonasKunz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: Adds SDK self-monitoring metrics for span processing | ||
|
||
# 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: [1631] | ||
|
||
# (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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -5,6 +5,7 @@ | |||
|
||||
- [OTel Attributes](#otel-attributes) | ||||
- [OTel Scope Attributes](#otel-scope-attributes) | ||||
- [OTel SDK Telemetry Attributes](#otel-sdk-telemetry-attributes) | ||||
- [Deprecated OTel Library Attributes](#deprecated-otel-library-attributes) | ||||
|
||||
## OTel Attributes | ||||
|
@@ -13,11 +14,22 @@ Attributes reserved for OpenTelemetry | |||
|
||||
| Attribute | Type | Description | Examples | Stability | | ||||
|---|---|---|---|---| | ||||
| <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` | ![Experimental](https://img.shields.io/badge/-experimental-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.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 | | ||||
|---|---|---| | ||||
| `DROP` | The span is not sampled and not recording | ![Experimental](https://img.shields.io/badge/-experimental-blue) | | ||||
| `RECORD_AND_SAMPLE` | The span is sampled and recording | ![Experimental](https://img.shields.io/badge/-experimental-blue) | | ||||
| `RECORD_ONLY` | The span is not sampled, but recording | ![Experimental](https://img.shields.io/badge/-experimental-blue) | | ||||
|
||||
--- | ||||
|
||||
`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. | ||||
|
||||
| Value | Description | Stability | | ||||
|
@@ -34,6 +46,44 @@ Attributes used by non-OTLP exporters to represent OpenTelemetry Scope's concept | |||
| <a id="otel-scope-name" href="#otel-scope-name">`otel.scope.name`</a> | string | The name of the instrumentation scope - (`InstrumentationScope.Name` in OTLP). | `io.opentelemetry.contrib.mongodb` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | | ||||
| <a id="otel-scope-version" href="#otel-scope-version">`otel.scope.version`</a> | string | The version of the instrumentation scope - (`InstrumentationScope.Version` in OTLP). | `1.0.0` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | | ||||
|
||||
## OTel SDK Telemetry Attributes | ||||
|
||||
Attributes used for OpenTelemetry SDK self-monitoring | ||||
|
||||
| Attribute | Type | Description | Examples | Stability | | ||||
|---|---|---|---|---| | ||||
| <a id="otel-sdk-component-name" href="#otel-sdk-component-name">`otel.sdk.component.name`</a> | string | A name uniquely identifying the instance of the OpenTelemetry SDK component within its containing SDK instance. [1] | `otlp_grpc_span_exporter/0`; `custom-name` | ![Experimental](https://img.shields.io/badge/-experimental-blue) | | ||||
| <a id="otel-sdk-component-type" href="#otel-sdk-component-type">`otel.sdk.component.type`</a> | string | A name identifying the type of the OpenTelemetry SDK component. [2] | `batching_span_processor`; `com.example.MySpanExporter` | ![Experimental](https://img.shields.io/badge/-experimental-blue) | | ||||
|
||||
**[1] `otel.sdk.component.name`:** Implementations SHOULD ensure a low cardinality for this attribute, even across application or SDK restarts. | ||||
E.g. implementations MUST NOT use UUIDs as values for this attribute. | ||||
|
||||
Implementations MAY achieve these goals by following a `<otel.sdk.component.type>/<instance-counter>` pattern, e.g. `batching_span_processor/0`. | ||||
reyang marked this conversation as resolved.
Show resolved
Hide resolved
|
||||
Hereby `otel.sdk.component.type` refers to the corresponding attribute value of the component. | ||||
|
||||
The value of `instance-counter` MAY be automatically assigned by the component and uniqueness within the enclosing SDK instance MUST be guaranteed. | ||||
For example, `<instance-counter>` MAY be implemented by using a monotonically increasing counter (starting with `0`), which is incremented every time an | ||||
instance of the given component type is started. | ||||
|
||||
With this implementation, for example the first Batching Span Processor would have `batching_span_processor/0` | ||||
as `otel.sdk.component.name`, the second one `batching_span_processor/1` and so on. | ||||
These values will therefore be reused in the case of an application restart. | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there some information to tell the application restart? (e.g. PID + start_time) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we have uptime metric for this -
|
||||
|
||||
**[2] `otel.sdk.component.type`:** If none of the standardized values apply, implementations SHOULD use the language-defined name of the type. | ||||
E.g. for Java the fully qualified classname SHOULD be used in this case. | ||||
|
||||
--- | ||||
|
||||
`otel.sdk.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. | ||||
|
||||
| Value | Description | Stability | | ||||
|---|---|---| | ||||
| `batching_span_processor` | The builtin SDK Batching Span Processor | ![Experimental](https://img.shields.io/badge/-experimental-blue) | | ||||
| `otlp_grpc_span_exporter` | OTLP span exporter over gRPC with protobuf serialization | ![Experimental](https://img.shields.io/badge/-experimental-blue) | | ||||
| `otlp_http_json_span_exporter` | OTLP span exporter over HTTP with JSON serialization | ![Experimental](https://img.shields.io/badge/-experimental-blue) | | ||||
| `otlp_http_span_exporter` | OTLP span exporter over HTTP with protobuf serialization | ![Experimental](https://img.shields.io/badge/-experimental-blue) | | ||||
| `simple_span_processor` | The builtin SDK Simple Span Processor | ![Experimental](https://img.shields.io/badge/-experimental-blue) | | ||||
|
||||
## Deprecated OTel Library Attributes | ||||
|
||||
Describes deprecated otel.library attributes. | ||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we allow each language implementations to have additional attributes that are language specific?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see a reason why implementations shouldn't be allowed to add additional attributes. I would expect this to be the general case for all semconv metrics? Metrics are aggregateable, so they can be analyzed and presented as if those additional attributes weren't present.
There are two caveats I can think of: