-
Notifications
You must be signed in to change notification settings - Fork 929
opentelemetry-exporter-otlp-common: remove dependence on incubating attributes from OTLP exporters #5387
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
Open
herin049
wants to merge
3
commits into
open-telemetry:main
Choose a base branch
from
herin049:fix/exporter-metrics
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.
+208
−73
Open
opentelemetry-exporter-otlp-common: remove dependence on incubating attributes from OTLP exporters #5387
Changes from all commits
Commits
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 hidden or 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 @@ | ||
| `opentelemetry-exporter-otlp-common`: remove dependency on incubating attributes from OTLP exporters |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
117 changes: 117 additions & 0 deletions
117
...-exporter-otlp-common/src/opentelemetry/exporter/otlp/common/_exporter_metrics/semconv.py
This file contains hidden or 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,117 @@ | ||
| # Copyright The OpenTelemetry Authors | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| # TODO: This file should be removed once the exporter specific | ||
| # metrics become stable (i.e. they are no longer incubating) | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| from enum import Enum | ||
| from typing import TYPE_CHECKING, Final | ||
|
|
||
| if TYPE_CHECKING: | ||
| from opentelemetry.metrics import Counter, Histogram, Meter, UpDownCounter | ||
|
|
||
| # TODO: Remove these attributes once "opentelemetry-semantic-conventions" | ||
| # becomes stable (i.e. reaches 1.x.y) | ||
| _ERROR_TYPE: Final[str] = "error.type" | ||
| _SERVER_ADDRESS: Final[str] = "server.address" | ||
| _SERVER_PORT: Final[str] = "server.port" | ||
|
|
||
|
|
||
| class OtelComponentTypeValues(Enum): | ||
| OTLP_GRPC_SPAN_EXPORTER = "otlp_grpc_span_exporter" | ||
| OTLP_HTTP_SPAN_EXPORTER = "otlp_http_span_exporter" | ||
| OTLP_HTTP_JSON_SPAN_EXPORTER = "otlp_http_json_span_exporter" | ||
| ZIPKIN_HTTP_SPAN_EXPORTER = "zipkin_http_span_exporter" | ||
| OTLP_GRPC_LOG_EXPORTER = "otlp_grpc_log_exporter" | ||
| OTLP_HTTP_LOG_EXPORTER = "otlp_http_log_exporter" | ||
| OTLP_HTTP_JSON_LOG_EXPORTER = "otlp_http_json_log_exporter" | ||
| OTLP_GRPC_METRIC_EXPORTER = "otlp_grpc_metric_exporter" | ||
| OTLP_HTTP_METRIC_EXPORTER = "otlp_http_metric_exporter" | ||
| OTLP_HTTP_JSON_METRIC_EXPORTER = "otlp_http_json_metric_exporter" | ||
| PROMETHEUS_HTTP_TEXT_METRIC_EXPORTER = ( | ||
| "prometheus_http_text_metric_exporter" | ||
| ) | ||
|
|
||
|
|
||
| _OTEL_COMPONENT_NAME: Final[str] = "otel.component.name" | ||
| _OTEL_COMPONENT_TYPE: Final[str] = "otel.component.type" | ||
|
|
||
| _OTEL_SDK_EXPORTER_SPAN_EXPORTED: Final[str] = ( | ||
| "otel.sdk.exporter.span.exported" | ||
| ) | ||
| _OTEL_SDK_EXPORTER_SPAN_INFLIGHT: Final[str] = ( | ||
| "otel.sdk.exporter.span.inflight" | ||
| ) | ||
| _OTEL_SDK_EXPORTER_LOG_EXPORTED: Final[str] = "otel.sdk.exporter.log.exported" | ||
| _OTEL_SDK_EXPORTER_LOG_INFLIGHT: Final[str] = "otel.sdk.exporter.log.inflight" | ||
| _OTEL_SDK_EXPORTER_METRIC_DATA_POINT_EXPORTED: Final[str] = ( | ||
| "otel.sdk.exporter.metric_data_point.exported" | ||
| ) | ||
| _OTEL_SDK_EXPORTER_METRIC_DATA_POINT_INFLIGHT: Final[str] = ( | ||
| "otel.sdk.exporter.metric_data_point.inflight" | ||
| ) | ||
| _OTEL_SDK_EXPORTER_OPERATION_DURATION: Final[str] = ( | ||
| "otel.sdk.exporter.operation.duration" | ||
| ) | ||
|
|
||
|
|
||
| def _create_otel_sdk_exporter_span_exported(meter: Meter) -> Counter: | ||
| return meter.create_counter( | ||
| name=_OTEL_SDK_EXPORTER_SPAN_EXPORTED, | ||
| description="The number of spans for which the export has finished, either successful or failed.", | ||
| unit="{span}", | ||
| ) | ||
|
|
||
|
|
||
| def _create_otel_sdk_exporter_span_inflight(meter: Meter) -> UpDownCounter: | ||
| return meter.create_up_down_counter( | ||
| name=_OTEL_SDK_EXPORTER_SPAN_INFLIGHT, | ||
| description="The number of spans which were passed to the exporter, but that have not been exported yet (neither successful, nor failed).", | ||
| unit="{span}", | ||
| ) | ||
|
|
||
|
|
||
| def _create_otel_sdk_exporter_log_exported(meter: Meter) -> Counter: | ||
| return meter.create_counter( | ||
| name=_OTEL_SDK_EXPORTER_LOG_EXPORTED, | ||
| description="The number of log records for which the export has finished, either successful or failed.", | ||
| unit="{log_record}", | ||
| ) | ||
|
|
||
|
|
||
| def _create_otel_sdk_exporter_log_inflight(meter: Meter) -> UpDownCounter: | ||
| return meter.create_up_down_counter( | ||
| name=_OTEL_SDK_EXPORTER_LOG_INFLIGHT, | ||
| description="The number of log records which were passed to the exporter, but that have not been exported yet (neither successful, nor failed).", | ||
| unit="{log_record}", | ||
| ) | ||
|
|
||
|
|
||
| def _create_otel_sdk_exporter_metric_data_point_exported( | ||
| meter: Meter, | ||
| ) -> Counter: | ||
| return meter.create_counter( | ||
| name=_OTEL_SDK_EXPORTER_METRIC_DATA_POINT_EXPORTED, | ||
| description="The number of metric data points for which the export has finished, either successful or failed.", | ||
| unit="{data_point}", | ||
| ) | ||
|
|
||
|
|
||
| def _create_otel_sdk_exporter_metric_data_point_inflight( | ||
| meter: Meter, | ||
| ) -> UpDownCounter: | ||
| return meter.create_up_down_counter( | ||
| name=_OTEL_SDK_EXPORTER_METRIC_DATA_POINT_INFLIGHT, | ||
| description="The number of metric data points which were passed to the exporter, but that have not been exported yet (neither successful, nor failed).", | ||
| unit="{data_point}", | ||
| ) | ||
|
|
||
|
|
||
| def _create_otel_sdk_exporter_operation_duration(meter: Meter) -> Histogram: | ||
| return meter.create_histogram( | ||
| name=_OTEL_SDK_EXPORTER_OPERATION_DURATION, | ||
| description="The duration of exporting a batch of telemetry records.", | ||
| unit="s", | ||
| ) |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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.
Uh oh!
There was an error while loading. Please reload this page.