Skip to content
This repository was archived by the owner on Apr 1, 2026. It is now read-only.

Commit e3ac131

Browse files
committed
pulled out operation logic
1 parent 07b3295 commit e3ac131

2 files changed

Lines changed: 0 additions & 50 deletions

File tree

google/cloud/bigtable/data/_async/metrics_interceptor.py

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -34,32 +34,6 @@ class AsyncBigtableMetricsInterceptor(
3434
An async gRPC interceptor to add client metadata and print server metadata.
3535
"""
3636

37-
def __init__(self):
38-
super().__init__()
39-
self.operation_map = {}
40-
41-
def register_operation(self, operation):
42-
"""
43-
Register an operation object to be tracked my the interceptor
44-
45-
When registered, the operation will receive metadata updates:
46-
- start_attempt if attempt not started when rpc is being sent
47-
- add_response_metadata after call is complete
48-
- end_attempt_with_status if attempt receives an error
49-
50-
The interceptor will register itself as a handeler for the operation,
51-
so it can unregister the operation when it is complete
52-
"""
53-
self.operation_map[operation.uuid] = operation
54-
operation.handlers.append(self)
55-
56-
def on_operation_complete(self, op):
57-
if op.uuid in self.operation_map:
58-
del self.operation_map[op.uuid]
59-
60-
def on_operation_cancelled(self, op):
61-
self.on_operation_complete(op)
62-
6337
@CrossSync.convert
6438
async def intercept_unary_unary(self, continuation, client_call_details, request):
6539
try:

google/cloud/bigtable/data/_sync_autogen/metrics_interceptor.py

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -26,30 +26,6 @@ class BigtableMetricsInterceptor(
2626
An async gRPC interceptor to add client metadata and print server metadata.
2727
"""
2828

29-
def __init__(self):
30-
super().__init__()
31-
self.operation_map = {}
32-
33-
def register_operation(self, operation):
34-
"""Register an operation object to be tracked my the interceptor
35-
36-
When registered, the operation will receive metadata updates:
37-
- start_attempt if attempt not started when rpc is being sent
38-
- add_response_metadata after call is complete
39-
- end_attempt_with_status if attempt receives an error
40-
41-
The interceptor will register itself as a handeler for the operation,
42-
so it can unregister the operation when it is complete"""
43-
self.operation_map[operation.uuid] = operation
44-
operation.handlers.append(self)
45-
46-
def on_operation_complete(self, op):
47-
if op.uuid in self.operation_map:
48-
del self.operation_map[op.uuid]
49-
50-
def on_operation_cancelled(self, op):
51-
self.on_operation_complete(op)
52-
5329
def intercept_unary_unary(self, continuation, client_call_details, request):
5430
try:
5531
call = continuation(client_call_details, request)

0 commit comments

Comments
 (0)