Skip to content

Commit

Permalink
Modified all OTLPExporters with correct type signatures and resolved …
Browse files Browse the repository at this point in the history
…header concatenation issue
  • Loading branch information
sreejitkar committed Mar 20, 2023
1 parent a70e4a0 commit 64c04f0
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
# limitations under the License.

from os import environ
from typing import Optional, Sequence
from typing import Dict, Optional, Tuple, Union, Sequence
from typing import Sequence as TypingSequence
from grpc import ChannelCredentials, Compression
from opentelemetry.exporter.otlp.proto.grpc.exporter import (
OTLPExporterMixin,
Expand Down Expand Up @@ -60,7 +61,9 @@ def __init__(
endpoint: Optional[str] = None,
insecure: Optional[bool] = None,
credentials: Optional[ChannelCredentials] = None,
headers: Optional[Sequence] = None,
headers: Optional[
Union[TypingSequence[Tuple[str, str]], Dict[str, str], str]
] = None,
timeout: Optional[int] = None,
compression: Optional[Compression] = None,
):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ def __init__(
if self._headers is None:
self._headers = tuple(_OTLP_GRPC_HEADERS)
else:
self._headers = self._headers + tuple(_OTLP_GRPC_HEADERS)
self._headers = tuple(self._headers) + tuple(_OTLP_GRPC_HEADERS)

self._timeout = timeout or int(
environ.get(OTEL_EXPORTER_OTLP_TIMEOUT, 10)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
import dataclasses
from logging import getLogger
from os import environ
from typing import Dict, Iterable, List, Optional, Sequence
from typing import Dict, Iterable, List, Optional, Tuple, Union
from typing import Sequence as TypingSequence
from grpc import ChannelCredentials, Compression
from opentelemetry.sdk.metrics._internal.aggregation import Aggregation
from opentelemetry.exporter.otlp.proto.grpc.exporter import (
Expand Down Expand Up @@ -87,7 +88,9 @@ def __init__(
endpoint: Optional[str] = None,
insecure: Optional[bool] = None,
credentials: Optional[ChannelCredentials] = None,
headers: Optional[Sequence] = None,
headers: Optional[
Union[TypingSequence[Tuple[str, str]], Dict[str, str], str]
] = None,
timeout: Optional[int] = None,
compression: Optional[Compression] = None,
preferred_temporality: Dict[type, AggregationTemporality] = None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@

import logging
from os import environ
from typing import Optional, Sequence
from typing import Dict, Optional, Sequence, Tuple, Union
from typing import Sequence as TypingSequence


from grpc import ChannelCredentials, Compression

Expand Down Expand Up @@ -80,7 +82,9 @@ def __init__(
endpoint: Optional[str] = None,
insecure: Optional[bool] = None,
credentials: Optional[ChannelCredentials] = None,
headers: Optional[Sequence] = None,
headers: Optional[
Union[TypingSequence[Tuple[str, str]], Dict[str, str], str]
] = None,
timeout: Optional[int] = None,
compression: Optional[Compression] = None,
):
Expand Down

0 comments on commit 64c04f0

Please sign in to comment.