Skip to content

Commit

Permalink
added setting of code and details in case of cancel
Browse files Browse the repository at this point in the history
  • Loading branch information
Corvin Lasogga authored and CoLa5 committed Aug 14, 2022
1 parent 28a9c59 commit de325c0
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,17 @@ def time_remaining(self, *args, **kwargs):
return self._servicer_context.time_remaining(*args, **kwargs)

def cancel(self, *args, **kwargs):
self._code = grpc.StatusCode.CANCELLED
self._details = self._code.value[1]
self._active_span.set_attribute(
SpanAttributes.RPC_GRPC_STATUS_CODE, self._code.value[0]
)
self._active_span.set_status(
Status(
status_code=StatusCode.ERROR,
description=f"{self._code}: {self._details}",
)
)
return self._servicer_context.cancel(*args, **kwargs)

def add_callback(self, *args, **kwargs):
Expand Down

0 comments on commit de325c0

Please sign in to comment.