Skip to content

Commit e11bbbf

Browse files
committed
Fix typecheck and lint
1 parent 5f6a63b commit e11bbbf

File tree

4 files changed

+14
-17
lines changed

4 files changed

+14
-17
lines changed

dev-requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
pylint==3.3.4
22
httpretty==1.1.4
3-
pyright==1.1.400
3+
pyright==1.1.405
44
sphinx==7.1.2
55
sphinx-rtd-theme==2.0.0rc4
66
sphinx-autodoc-typehints==1.25.2

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def __init__(
6262
] = None,
6363
timeout: Optional[float] = None,
6464
compression: Optional[Compression] = None,
65-
channel_options: Optional[TypingSequence[Tuple[str, str]]] = None,
65+
channel_options: Optional[list[Tuple[str, str]]] = None,
6666
):
6767
insecure_logs = environ.get(OTEL_EXPORTER_OTLP_LOGS_INSECURE)
6868
if insecure is None and insecure_logs is not None:

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

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,6 @@
5656
from opentelemetry.exporter.otlp.proto.grpc import (
5757
_OTLP_GRPC_CHANNEL_OPTIONS,
5858
)
59-
from opentelemetry.exporter.otlp.proto.grpc import (
60-
_OTLP_GRPC_HEADERS,
61-
)
6259
from opentelemetry.proto.collector.logs.v1.logs_service_pb2 import (
6360
ExportLogsServiceRequest,
6461
)
@@ -288,7 +285,7 @@ def __init__(
288285
] = None,
289286
timeout: Optional[float] = None,
290287
compression: Optional[Compression] = None,
291-
channel_options: Optional[TypingSequence[Tuple[str, str]]] = None,
288+
channel_options: Optional[list[Tuple[str, str]]] = None,
292289
):
293290
super().__init__()
294291
self._result = result
@@ -330,7 +327,7 @@ def __init__(
330327
for opt_name, opt_value in _OTLP_GRPC_CHANNEL_OPTIONS
331328
if opt_name not in overridden_options
332329
]
333-
self._channel_options = tuple(default_options) + channel_options
330+
self._channel_options = default_options + channel_options
334331
else:
335332
self._channel_options = tuple(_OTLP_GRPC_CHANNEL_OPTIONS)
336333

@@ -396,10 +393,10 @@ def _export(
396393
metadata=self._headers,
397394
timeout=deadline_sec - time(),
398395
)
399-
return self._result.SUCCESS # type: ignore [reportReturnType]
396+
return self._result.SUCCESS # type: ignore [reportReturnType]
400397
except RpcError as error:
401-
retry_info_bin = dict(error.trailing_metadata()).get(
402-
"google.rpc.retryinfo-bin"
398+
retry_info_bin = dict(error.trailing_metadata()).get( # type: ignore [reportAttributeAccessIssue]
399+
"google.rpc.retryinfo-bin" # type: ignore [reportArgumentType]
403400
)
404401
# multiplying by a random number between .8 and 1.2 introduces a +/20% jitter to each backoff.
405402
backoff_seconds = 2**retry_num * random.uniform(0.8, 1.2)
@@ -411,7 +408,7 @@ def _export(
411408
+ retry_info.retry_delay.nanos / 1.0e9
412409
)
413410
if (
414-
error.code() not in _RETRYABLE_ERROR_CODES
411+
error.code() not in _RETRYABLE_ERROR_CODES # type: ignore [reportAttributeAccessIssue]
415412
or retry_num + 1 == _MAX_RETRYS
416413
or backoff_seconds > (deadline_sec - time())
417414
or self._shutdown
@@ -420,13 +417,13 @@ def _export(
420417
"Failed to export %s to %s, error code: %s",
421418
self._exporting,
422419
self._endpoint,
423-
error.code(),
424-
exc_info=error.code() == StatusCode.UNKNOWN,
420+
error.code(), # type: ignore [reportAttributeAccessIssue]
421+
exc_info=error.code() == StatusCode.UNKNOWN, # type: ignore [reportAttributeAccessIssue]
425422
)
426-
return self._result.FAILURE # type: ignore [reportReturnType]
423+
return self._result.FAILURE # type: ignore [reportReturnType]
427424
logger.warning(
428425
"Transient error %s encountered while exporting %s to %s, retrying in %.2fs.",
429-
error.code(),
426+
error.code(), # type: ignore [reportAttributeAccessIssue]
430427
self._exporting,
431428
self._endpoint,
432429
backoff_seconds,
@@ -436,7 +433,7 @@ def _export(
436433
logger.warning("Shutdown in progress, aborting retry.")
437434
break
438435
# Not possible to reach here but the linter is complaining.
439-
return self._result.FAILURE # type: ignore [reportReturnType]
436+
return self._result.FAILURE # type: ignore [reportReturnType]
440437

441438
def shutdown(self, timeout_millis: float = 30_000, **kwargs) -> None:
442439
if self._shutdown:

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def __init__(
108108
| None = None,
109109
preferred_aggregation: dict[type, Aggregation] | None = None,
110110
max_export_batch_size: int | None = None,
111-
channel_options: TypingSequence[Tuple[str, str]] | None = None,
111+
channel_options: list[Tuple[str, str]] | None = None,
112112
):
113113
insecure_metrics = environ.get(OTEL_EXPORTER_OTLP_METRICS_INSECURE)
114114
if insecure is None and insecure_metrics is not None:

0 commit comments

Comments
 (0)