Skip to content

Commit

Permalink
[Issue open-telemetry#1107] Add environment variable support for gzip…
Browse files Browse the repository at this point in the history
… compression
  • Loading branch information
wilguo committed Sep 24, 2020
1 parent a88df17 commit 2c358f3
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import enum
import logging
import os
from abc import ABC, abstractmethod
from collections.abc import Mapping, Sequence
from time import sleep
Expand Down Expand Up @@ -145,10 +146,17 @@ def __init__(
self._metadata = metadata
self._collector_span_kwargs = None

if compression is GRPCCompression.NO_COMPRESSION:
compression_algorithm = Compression.NoCompression
elif compression is GRPCCompression.GZIP:
compression_str = os.environ.get(
"OTEL_EXPORTER_OTLP_COMPRESSION", None
)

if compression_str == "gzip":
compression_algorithm = Compression.Gzip
else:
if compression is GRPCCompression.NO_COMPRESSION:
compression_algorithm = Compression.NoCompression
elif compression is GRPCCompression.GZIP:
compression_algorithm = Compression.Gzip

if credentials is None:
self._client = self._stub(
Expand Down

0 comments on commit 2c358f3

Please sign in to comment.