Skip to content

Commit 9e80c6a

Browse files
committed
Cleanup
1 parent 223b516 commit 9e80c6a

File tree

5 files changed

+19
-14
lines changed

5 files changed

+19
-14
lines changed

exporter/opentelemetry-exporter-otlp-proto-common/src/opentelemetry/exporter/otlp/proto/common/_exporter_metrics.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
from opentelemetry.semconv._incubating.attributes.otel_attributes import (
2323
OTEL_COMPONENT_NAME,
2424
OTEL_COMPONENT_TYPE,
25+
OtelComponentTypeValues,
2526
)
2627
from opentelemetry.semconv._incubating.metrics.otel_metrics import (
2728
create_otel_sdk_exporter_log_exported,
@@ -50,15 +51,15 @@
5051
class ExporterMetrics:
5152
def __init__(
5253
self,
53-
component_type: str,
54-
signal: Literal["span", "log", "metric_data_point"],
54+
component_type: OtelComponentTypeValues | None,
55+
signal: Literal["traces", "metrics", "logs"],
5556
endpoint: UrlParseResult,
5657
meter_provider: MeterProvider | None,
5758
) -> None:
58-
if signal == "span":
59+
if signal == "traces":
5960
create_exported = create_otel_sdk_exporter_span_exported
6061
create_inflight = create_otel_sdk_exporter_span_inflight
61-
elif signal == "log":
62+
elif signal == "logs":
6263
create_exported = create_otel_sdk_exporter_log_exported
6364
create_inflight = create_otel_sdk_exporter_log_inflight
6465
else:
@@ -76,6 +77,7 @@ def __init__(
7677
elif endpoint.scheme == "http":
7778
port = 80
7879

80+
component_type = (component_type or OtelComponentTypeValues("unknown_otlp_exporter")).value
7981
count = _component_counter[component_type]
8082
_component_counter[component_type] = count + 1
8183
self._standard_attrs: dict[str, AttributeValue] = {

exporter/opentelemetry-exporter-otlp-proto-grpc/src/opentelemetry/exporter/otlp/proto/grpc/_log_exporter/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ def __init__(
111111
stub=LogsServiceStub,
112112
result=LogRecordExportResult,
113113
channel_options=channel_options,
114-
component_type=OtelComponentTypeValues.OTLP_GRPC_LOG_EXPORTER.value,
115-
signal="log",
114+
component_type=OtelComponentTypeValues.OTLP_GRPC_LOG_EXPORTER,
115+
signal="logs",
116116
meter_provider=meter_provider,
117117
)
118118

exporter/opentelemetry-exporter-otlp-proto-grpc/src/opentelemetry/exporter/otlp/proto/grpc/exporter.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@
108108
from opentelemetry.sdk.resources import Resource as SDKResource
109109
from opentelemetry.sdk.trace import ReadableSpan
110110
from opentelemetry.sdk.trace.export import SpanExportResult
111+
from opentelemetry.semconv._incubating.attributes.otel_attributes import (
112+
OtelComponentTypeValues,
113+
)
111114
from opentelemetry.semconv._incubating.attributes.rpc_attributes import (
112115
RPC_RESPONSE_STATUS_CODE,
113116
)
@@ -307,8 +310,8 @@ def __init__(
307310
compression: Optional[Compression] = None,
308311
channel_options: Optional[Tuple[Tuple[str, str]]] = None,
309312
*,
310-
component_type: Optional[str] = None,
311-
signal: Literal["span", "log", "metric_data_point"] = "span",
313+
component_type: Union[OtelComponentTypeValues, None] = None,
314+
signal: Literal["traces", "metrics", "logs"] = "traces",
312315
meter_provider: Optional[MeterProvider] = None,
313316
):
314317
super().__init__()
@@ -383,8 +386,8 @@ def __init__(
383386
OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE,
384387
)
385388

386-
self._component_type = component_type or type(self).__qualname__
387-
self._signal: Literal["span", "log", "metric_data_point"] = signal
389+
self._component_type = component_type
390+
self._signal: Literal["traces", "metrics", "logs"] = signal
388391
self._parsed_url = parsed_url
389392
self._metrics = ExporterMetrics(
390393
self._component_type,

exporter/opentelemetry-exporter-otlp-proto-grpc/src/opentelemetry/exporter/otlp/proto/grpc/metric_exporter/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,8 @@ def __init__(
159159
timeout=timeout or environ_timeout,
160160
compression=compression,
161161
channel_options=channel_options,
162-
component_type=OtelComponentTypeValues.OTLP_GRPC_METRIC_EXPORTER.value,
163-
signal="metric_data_point",
162+
component_type=OtelComponentTypeValues.OTLP_GRPC_METRIC_EXPORTER,
163+
signal="metrics",
164164
meter_provider=meter_provider,
165165
)
166166

exporter/opentelemetry-exporter-otlp-proto-grpc/src/opentelemetry/exporter/otlp/proto/grpc/trace_exporter/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@ def __init__(
141141
timeout=timeout or environ_timeout,
142142
compression=compression,
143143
channel_options=channel_options,
144-
component_type=OtelComponentTypeValues.OTLP_GRPC_SPAN_EXPORTER.value,
145-
signal="span",
144+
component_type=OtelComponentTypeValues.OTLP_GRPC_SPAN_EXPORTER,
145+
signal="traces",
146146
meter_provider=meter_provider,
147147
)
148148

0 commit comments

Comments
 (0)