Skip to content

Commit

Permalink
Updating export result enums (#590)
Browse files Browse the repository at this point in the history
  • Loading branch information
hectorhdzg authored Apr 20, 2020
1 parent 03292aa commit 920b4b4
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def export(
pass

except grpc.RpcError:
return MetricsExportResult.FAILED_RETRYABLE
return MetricsExportResult.FAILURE

return MetricsExportResult.SUCCESS

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def export(self, spans: Sequence[Span]) -> SpanExportResult:
pass

except grpc.RpcError:
return SpanExportResult.FAILED_NOT_RETRYABLE
return SpanExportResult.FAILURE

return SpanExportResult.SUCCESS

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ def export(self, spans: Sequence[Span]) -> SpanExportResult:
)

if self.retry:
return SpanExportResult.FAILED_RETRYABLE
return SpanExportResult.FAILED_NOT_RETRYABLE
return SpanExportResult.FAILURE
return SpanExportResult.FAILURE
return SpanExportResult.SUCCESS

def _translate_to_zipkin(self, spans: Sequence[Span]):
Expand Down
2 changes: 1 addition & 1 deletion ext/opentelemetry-ext-zipkin/tests/test_zipkin_exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,4 +242,4 @@ def test_invalid_response(self, mock_post):
spans = []
exporter = ZipkinSpanExporter("test-service")
status = exporter.export(spans)
self.assertEqual(SpanExportResult.FAILED_NOT_RETRYABLE, status)
self.assertEqual(SpanExportResult.FAILURE, status)
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@

class MetricsExportResult(Enum):
SUCCESS = 0
FAILED_RETRYABLE = 1
FAILED_NOT_RETRYABLE = 2
FAILURE = 1


class MetricRecord:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@

class SpanExportResult(Enum):
SUCCESS = 0
FAILED_RETRYABLE = 1
FAILED_NOT_RETRYABLE = 2
FAILURE = 1


class SpanExporter:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def get_finished_spans(self):
def export(self, spans: typing.Sequence[Span]) -> SpanExportResult:
"""Stores a list of spans in memory."""
if self._stopped:
return SpanExportResult.FAILED_NOT_RETRYABLE
return SpanExportResult.FAILURE
with self._lock:
self._finished_spans.extend(spans)
return SpanExportResult.SUCCESS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,4 @@ def test_return_code(self):

# after shutdown export should fail
ret = memory_exporter.export(span_list)
self.assertEqual(ret, export.SpanExportResult.FAILED_NOT_RETRYABLE)
self.assertEqual(ret, export.SpanExportResult.FAILURE)

0 comments on commit 920b4b4

Please sign in to comment.