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

Commit 98e4006

Browse files
committed
remove async with for metrics
1 parent 4684a72 commit 98e4006

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ async def start(self):
127127
Raises:
128128
MutationsExceptionGroup: if any mutations failed
129129
"""
130-
async with self._operation_metric:
130+
with self._operation_metric:
131131
try:
132132
# trigger mutate_rows
133133
await self._operation()

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,7 +1020,7 @@ async def read_rows_stream(
10201020
)
10211021
retryable_excs = _get_retryable_errors(retryable_errors, self)
10221022

1023-
async with self._metrics.create_operation(
1023+
with self._metrics.create_operation(
10241024
OperationType.READ_ROWS, streaming=True
10251025
) as operation_metric:
10261026
row_merger = CrossSync._ReadRowsOperation(
@@ -1129,7 +1129,7 @@ async def read_row(
11291129
)
11301130
retryable_excs = _get_retryable_errors(retryable_errors, self)
11311131

1132-
async with self._metrics.create_operation(
1132+
with self._metrics.create_operation(
11331133
OperationType.READ_ROWS, streaming=False
11341134
) as operation_metric:
11351135
row_merger = CrossSync._ReadRowsOperation(
@@ -1345,7 +1345,7 @@ async def sample_row_keys(
13451345
retryable_excs = _get_retryable_errors(retryable_errors, self)
13461346
predicate = retries.if_exception_type(*retryable_excs)
13471347

1348-
async with self._metrics.create_operation(
1348+
with self._metrics.create_operation(
13491349
OperationType.SAMPLE_ROW_KEYS
13501350
) as operation_metric:
13511351

@@ -1477,7 +1477,7 @@ async def mutate_row(
14771477
# mutations should not be retried
14781478
predicate = retries.if_exception_type()
14791479

1480-
async with self._metrics.create_operation(
1480+
with self._metrics.create_operation(
14811481
OperationType.MUTATE_ROW
14821482
) as operation_metric:
14831483
target = partial(
@@ -1612,7 +1612,7 @@ async def check_and_mutate_row(
16121612
false_case_mutations = [false_case_mutations]
16131613
false_case_list = [m._to_pb() for m in false_case_mutations or []]
16141614

1615-
async with self._metrics.create_operation(OperationType.CHECK_AND_MUTATE):
1615+
with self._metrics.create_operation(OperationType.CHECK_AND_MUTATE):
16161616
result = await self.client._gapic_client.check_and_mutate_row(
16171617
request=CheckAndMutateRowRequest(
16181618
true_mutations=true_case_list,
@@ -1670,7 +1670,7 @@ async def read_modify_write_row(
16701670
if not rules:
16711671
raise ValueError("rules must contain at least one item")
16721672

1673-
async with self._metrics.create_operation(OperationType.READ_MODIFY_WRITE):
1673+
with self._metrics.create_operation(OperationType.READ_MODIFY_WRITE):
16741674
result = await self.client._gapic_client.read_modify_write_row(
16751675
request=ReadModifyWriteRowRequest(
16761676
rules=[rule._to_pb() for rule in rules],

0 commit comments

Comments
 (0)