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

Commit f5e057e

Browse files
committed
gave each operation a uuid
1 parent f8e6603 commit f5e057e

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ def register_operation(self, operation):
9292
operation.handlers.append(self)
9393

9494
def on_operation_complete(self, op):
95-
del self.operation_map[op.uuid]
95+
if op.uuid in self.operation_map:
96+
del self.operation_map[op.uuid]
9697

9798
def on_operation_cancelled(self, op):
9899
self.on_operation_complete(op)

google/cloud/bigtable/data/_metrics/data_model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ class ActiveOperationMetric:
143143
"""
144144

145145
op_type: OperationType
146-
uuid: str = str(uuid.uuid4())
146+
uuid: str = field(default_factory=lambda: str(uuid.uuid4()))
147147
backoff_generator: TrackedBackoffGenerator | None = None
148148
# keep monotonic timestamps for active operations
149149
start_time_ns: int = field(default_factory=time.monotonic_ns)

0 commit comments

Comments
 (0)