Skip to content

Commit 64c04f0

Browse files
committed
Modified all OTLPExporters with correct type signatures and resolved header concatenation issue
1 parent a70e4a0 commit 64c04f0

File tree

4 files changed

+17
-7
lines changed

4 files changed

+17
-7
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
# limitations under the License.
1313

1414
from os import environ
15-
from typing import Optional, Sequence
15+
from typing import Dict, Optional, Tuple, Union, Sequence
16+
from typing import Sequence as TypingSequence
1617
from grpc import ChannelCredentials, Compression
1718
from opentelemetry.exporter.otlp.proto.grpc.exporter import (
1819
OTLPExporterMixin,
@@ -60,7 +61,9 @@ def __init__(
6061
endpoint: Optional[str] = None,
6162
insecure: Optional[bool] = None,
6263
credentials: Optional[ChannelCredentials] = None,
63-
headers: Optional[Sequence] = None,
64+
headers: Optional[
65+
Union[TypingSequence[Tuple[str, str]], Dict[str, str], str]
66+
] = None,
6467
timeout: Optional[int] = None,
6568
compression: Optional[Compression] = None,
6669
):

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ def __init__(
256256
if self._headers is None:
257257
self._headers = tuple(_OTLP_GRPC_HEADERS)
258258
else:
259-
self._headers = self._headers + tuple(_OTLP_GRPC_HEADERS)
259+
self._headers = tuple(self._headers) + tuple(_OTLP_GRPC_HEADERS)
260260

261261
self._timeout = timeout or int(
262262
environ.get(OTEL_EXPORTER_OTLP_TIMEOUT, 10)

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
import dataclasses
1515
from logging import getLogger
1616
from os import environ
17-
from typing import Dict, Iterable, List, Optional, Sequence
17+
from typing import Dict, Iterable, List, Optional, Tuple, Union
18+
from typing import Sequence as TypingSequence
1819
from grpc import ChannelCredentials, Compression
1920
from opentelemetry.sdk.metrics._internal.aggregation import Aggregation
2021
from opentelemetry.exporter.otlp.proto.grpc.exporter import (
@@ -87,7 +88,9 @@ def __init__(
8788
endpoint: Optional[str] = None,
8889
insecure: Optional[bool] = None,
8990
credentials: Optional[ChannelCredentials] = None,
90-
headers: Optional[Sequence] = None,
91+
headers: Optional[
92+
Union[TypingSequence[Tuple[str, str]], Dict[str, str], str]
93+
] = None,
9194
timeout: Optional[int] = None,
9295
compression: Optional[Compression] = None,
9396
preferred_temporality: Dict[type, AggregationTemporality] = None,

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515

1616
import logging
1717
from os import environ
18-
from typing import Optional, Sequence
18+
from typing import Dict, Optional, Sequence, Tuple, Union
19+
from typing import Sequence as TypingSequence
20+
1921

2022
from grpc import ChannelCredentials, Compression
2123

@@ -80,7 +82,9 @@ def __init__(
8082
endpoint: Optional[str] = None,
8183
insecure: Optional[bool] = None,
8284
credentials: Optional[ChannelCredentials] = None,
83-
headers: Optional[Sequence] = None,
85+
headers: Optional[
86+
Union[TypingSequence[Tuple[str, str]], Dict[str, str], str]
87+
] = None,
8488
timeout: Optional[int] = None,
8589
compression: Optional[Compression] = None,
8690
):

0 commit comments

Comments
 (0)