Skip to content

Commit fcd3aaa

Browse files
committed
fixed lint
1 parent 89c5216 commit fcd3aaa

File tree

6 files changed

+255
-85
lines changed

6 files changed

+255
-85
lines changed

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@
2727
from dataclasses import field
2828
from grpc import StatusCode
2929

30-
import google.cloud.bigtable.data.exceptions as bt_exceptions
30+
from google.cloud.bigtable.data.exceptions import MutationsExceptionGroup
31+
from google.cloud.bigtable.data.exceptions import ShardedReadRowsExceptionGroup
32+
from google.cloud.bigtable.data.exceptions import RetryExceptionGroup
3133
from google.cloud.bigtable_v2.types.response_params import ResponseParams
3234
from google.protobuf.message import DecodeError
3335

@@ -411,10 +413,13 @@ def _exc_to_status(exc: Exception) -> StatusCode:
411413
- exc: The exception to extract the status code from.
412414
"""
413415
# parse bigtable custom exceptions
414-
if isinstance(exc, (bt_exceptions.MutationsExceptionGroup, bt_exceptions.ShardedReadRowsExceptionGroup)) and exc.exceptions:
416+
if (
417+
isinstance(exc, (MutationsExceptionGroup, ShardedReadRowsExceptionGroup))
418+
and exc.exceptions
419+
):
415420
# grab the RetryExceptionGroup from the most last failed mutation/shard
416421
exc = exc.exceptions[-1].__cause__
417-
if isinstance(exc, bt_exceptions.RetryExceptionGroup):
422+
if isinstance(exc, RetryExceptionGroup):
418423
# grab the last exception in the retry group
419424
exc = exc.exceptions[-1]
420425
# parse grpc exceptions

google/cloud/bigtable/data/_metrics/handlers/opentelemetry.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,8 @@ def on_attempt_complete(
212212
combined_throttling += op.flow_throttling_time_ms
213213
self.otel.throttling_latencies.record(combined_throttling, labels)
214214
self.otel.application_latencies.record(
215-
attempt.application_blocking_time_ms + attempt.backoff_before_attempt_ms, labels
215+
attempt.application_blocking_time_ms + attempt.backoff_before_attempt_ms,
216+
labels,
216217
)
217218
if (
218219
op.op_type == OperationType.READ_ROWS
@@ -229,6 +230,4 @@ def on_attempt_complete(
229230
else:
230231
# gfe headers not attached. Record a connectivity error.
231232
# TODO: this should not be recorded as an error when direct path is enabled
232-
self.otel.connectivity_error_count.add(
233-
1, {"status": status, **labels}
234-
)
233+
self.otel.connectivity_error_count.add(1, {"status": status, **labels})

0 commit comments

Comments
 (0)