Skip to content

Commit ebfe97d

Browse files
committed
Lint
Signed-off-by: Abhilash Gnan <abhilashgnan@gmail.com>
1 parent f2dd93b commit ebfe97d

4 files changed

Lines changed: 29 additions & 17 deletions

File tree

exporter/opentelemetry-exporter-otlp/src/opentelemetry/exporter/otlp/metrics_exporter/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,10 @@ def __init__(
166166
if insecure is None:
167167
insecure = Configuration().EXPORTER_OTLP_METRIC_INSECURE
168168

169-
if not insecure and Configuration().EXPORTER_OTLP_METRIC_CERTIFICATE is not None:
169+
if (
170+
not insecure
171+
and Configuration().EXPORTER_OTLP_METRIC_CERTIFICATE is not None
172+
):
170173
credentials = credentials or _load_credential_from_file(
171174
Configuration().EXPORTER_OTLP_METRIC_CERTIFICATE
172175
)

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,10 @@ def __init__(
7373
if insecure is None:
7474
insecure = Configuration().EXPORTER_OTLP_SPAN_INSECURE
7575

76-
if not insecure and Configuration().EXPORTER_OTLP_SPAN_CERTIFICATE is not None:
76+
if (
77+
not insecure
78+
and Configuration().EXPORTER_OTLP_SPAN_CERTIFICATE is not None
79+
):
7780
credentials = credentials or _load_credential_from_file(
7881
Configuration().EXPORTER_OTLP_SPAN_CERTIFICATE
7982
)

exporter/opentelemetry-exporter-otlp/tests/test_otlp_metric_exporter.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@
1515
from collections import OrderedDict
1616
from unittest import TestCase
1717
from unittest.mock import patch
18-
from opentelemetry.configuration import Configuration
18+
1919
from grpc import ChannelCredentials
2020

21+
from opentelemetry.configuration import Configuration
2122
from opentelemetry.exporter.otlp.metrics_exporter import OTLPMetricsExporter
2223
from opentelemetry.proto.collector.metrics.v1.metrics_service_pb2 import (
2324
ExportMetricsServiceRequest,
@@ -71,11 +72,14 @@ def setUp(self):
7172
def tearDown(self):
7273
Configuration._reset() # pylint: disable=protected-access
7374

74-
@patch.dict("os.environ", {
75-
"OTEL_EXPORTER_OTLP_METRIC_ENDPOINT": "collector:55680",
76-
"OTEL_EXPORTER_OTLP_METRIC_HEADERS": "key1:value1;key2:value2",
77-
"OTEL_EXPORTER_OTLP_METRIC_CERTIFICATE": "fixtures/test.cert",
78-
})
75+
@patch.dict(
76+
"os.environ",
77+
{
78+
"OTEL_EXPORTER_OTLP_METRIC_ENDPOINT": "collector:55680",
79+
"OTEL_EXPORTER_OTLP_METRIC_HEADERS": "key1:value1;key2:value2",
80+
"OTEL_EXPORTER_OTLP_METRIC_CERTIFICATE": "fixtures/test.cert",
81+
},
82+
)
7983
@patch("opentelemetry.exporter.otlp.exporter.OTLPExporterMixin.__init__")
8084
def test_env_variables(self, mock_exporter_mixin):
8185
OTLPMetricsExporter()

exporter/opentelemetry-exporter-otlp/tests/test_otlp_trace_exporter.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,17 @@
1414

1515
import os
1616
from collections import OrderedDict
17-
from opentelemetry.configuration import Configuration
18-
1917
from concurrent.futures import ThreadPoolExecutor
2018
from unittest import TestCase
2119
from unittest.mock import Mock, PropertyMock, patch
2220

2321
from google.protobuf.duration_pb2 import Duration
2422
from google.rpc.error_details_pb2 import RetryInfo
25-
from grpc import StatusCode, server, ChannelCredentials
23+
from grpc import ChannelCredentials, StatusCode, server
2624

27-
from opentelemetry.exporter.otlp.trace_exporter import OTLPSpanExporter
25+
from opentelemetry.configuration import Configuration
2826
from opentelemetry.exporter.otlp.exporter import OTLPExporterMixin
27+
from opentelemetry.exporter.otlp.trace_exporter import OTLPSpanExporter
2928
from opentelemetry.proto.collector.trace.v1.trace_service_pb2 import (
3029
ExportTraceServiceRequest,
3130
ExportTraceServiceResponse,
@@ -165,11 +164,14 @@ def tearDown(self):
165164
self.server.stop(None)
166165
Configuration._reset() # pylint: disable=protected-access
167166

168-
@patch.dict("os.environ", {
169-
"OTEL_EXPORTER_OTLP_SPAN_ENDPOINT": "collector:55680",
170-
"OTEL_EXPORTER_OTLP_SPAN_HEADERS": "key1:value1;key2:value2",
171-
"OTEL_EXPORTER_OTLP_SPAN_CERTIFICATE": "fixtures/test.cert",
172-
})
167+
@patch.dict(
168+
"os.environ",
169+
{
170+
"OTEL_EXPORTER_OTLP_SPAN_ENDPOINT": "collector:55680",
171+
"OTEL_EXPORTER_OTLP_SPAN_HEADERS": "key1:value1;key2:value2",
172+
"OTEL_EXPORTER_OTLP_SPAN_CERTIFICATE": "fixtures/test.cert",
173+
},
174+
)
173175
@patch("opentelemetry.exporter.otlp.exporter.OTLPExporterMixin.__init__")
174176
def test_env_variables(self, mock_exporter_mixin):
175177
OTLPSpanExporter()

0 commit comments

Comments
 (0)