This repository was archived by the owner on Apr 1, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
google/cloud/bigtable/data/_metrics Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -365,27 +365,12 @@ def end_with_success(self):
365365 """
366366 return self .end_with_status (StatusCode .OK )
367367
368- def build_wrapped_predicate (
369- self , inner_predicate : Callable [[Exception ], bool ]
370- ) -> Callable [[Exception ], bool ]:
368+ def cancel (self ):
371369 """
372- Wrapps a predicate to include metrics tracking. Any call to the resulting predicate
373- is assumed to be an rpc failure, and will either mark the end of the active attempt
374- or the end of the operation.
375-
376- Args:
377- - predicate: The predicate to wrap.
370+ Called to cancel an operation without processing emitting it.
378371 """
379-
380- def wrapped_predicate (exc : Exception ) -> bool :
381- inner_result = inner_predicate (exc )
382- if inner_result :
383- self .end_attempt_with_status (exc )
384- else :
385- self .end_with_status (exc )
386- return inner_result
387-
388- return wrapped_predicate
372+ for handler in self .handlers :
373+ handler .on_operation_canceled (self )
389374
390375 @staticmethod
391376 def _exc_to_status (exc : Exception ) -> StatusCode :
Original file line number Diff line number Diff line change @@ -29,7 +29,10 @@ def __init__(self, **kwargs):
2929 def on_operation_complete (self , op : CompletedOperationMetric ) -> None :
3030 pass
3131
32+ def on_operation_canceled (self , op : ActiveOperationMetric ) -> None :
33+ pass
34+
3235 def on_attempt_complete (
3336 self , attempt : CompletedAttemptMetric , op : ActiveOperationMetric
3437 ) -> None :
35- pass
38+ pass
You can’t perform that action at this time.
0 commit comments