Skip to content

Commit 89c1dc4

Browse files
committed
feat(http_exporter): only retry on connection error
1 parent 1724e40 commit 89c1dc4

File tree

3 files changed

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

3 files changed

+12
-3
lines changed

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

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

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

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

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

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

0 commit comments

Comments
 (0)