Skip to content

Commit ff5158d

Browse files
committed
refactor(http): simplify if statements
1 parent 1f3af45 commit ff5158d

File tree

3 files changed

+3
-12
lines changed
  • exporter/opentelemetry-exporter-otlp-proto-http/src/opentelemetry/exporter/otlp/proto/http

3 files changed

+3
-12
lines changed

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,10 +194,7 @@ def export(
194194
return LogExportResult.SUCCESS
195195
except requests.exceptions.RequestException as error:
196196
reason = str(error)
197-
if isinstance(error, ConnectionError):
198-
retryable = True
199-
else:
200-
retryable = False
197+
retryable = isinstance(error, ConnectionError)
201198
status_code = None
202199
else:
203200
reason = resp.reason

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,10 +239,7 @@ def export(
239239
return MetricExportResult.SUCCESS
240240
except requests.exceptions.RequestException as error:
241241
reason = str(error)
242-
if isinstance(error, ConnectionError):
243-
retryable = True
244-
else:
245-
retryable = False
242+
retryable = isinstance(error, ConnectionError)
246243
status_code = None
247244
else:
248245
reason = resp.reason

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,10 +187,7 @@ def export(self, spans: Sequence[ReadableSpan]) -> SpanExportResult:
187187
return SpanExportResult.SUCCESS
188188
except requests.exceptions.RequestException as error:
189189
reason = str(error)
190-
if isinstance(error, ConnectionError):
191-
retryable = True
192-
else:
193-
retryable = False
190+
retryable = isinstance(error, ConnectionError)
194191
status_code = None
195192
else:
196193
reason = resp.reason

0 commit comments

Comments
 (0)