Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c11d551

Browse files
authored
Fix headers types mismatch for OTLP Exporters (open-telemetry#3226)
1 parent 7e67d52 commit c11d551

File tree

5 files changed

+19
-7
lines changed

5 files changed

+19
-7
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## Unreleased
99

10+
- Fix headers types mismatch for OTLP Exporters
11+
([#3226](https://github.com/open-telemetry/opentelemetry-python/pull/3226))
1012
- Fix suppress instrumentation for log batch processor
1113
([#3223](https://github.com/open-telemetry/opentelemetry-python/pull/3223))
1214

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
from dataclasses import replace
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)