Skip to content

Commit 491c5f9

Browse files
committed
fix mypy issues
1 parent 24731d8 commit 491c5f9

3 files changed

Lines changed: 11 additions & 4 deletions

File tree

packages/google-cloud-bigtable/google/cloud/bigtable/data/_async/mutations_batcher.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ async def _flush_internal(self, new_entries: list[RowMutationEntry]):
379379
# flush new entries
380380
in_process_requests: list[CrossSync.Future[list[FailedMutationEntryError]]] = []
381381
async for batch, metric in self._flow_control.add_to_flow_with_metrics(
382-
new_entries, self._target._metrics
382+
new_entries, self._target.client._metrics
383383
):
384384
batch_task = CrossSync.create_task(
385385
self._execute_mutate_rows,

packages/google-cloud-bigtable/google/cloud/bigtable/data/_metrics/handlers/gcp_exporter.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
from google.protobuf.timestamp_pb2 import Timestamp
3434
from opentelemetry.sdk.metrics import MeterProvider, view
3535
from opentelemetry.sdk.metrics.export import (
36+
ExponentialHistogramDataPoint,
3637
HistogramDataPoint,
3738
MetricExporter,
3839
MetricExportResult,
@@ -262,7 +263,9 @@ def _batch_write(
262263
write_ind += max_batch_size
263264

264265
@staticmethod
265-
def _to_point(data_point: NumberDataPoint | HistogramDataPoint) -> Point:
266+
def _to_point(
267+
data_point: NumberDataPoint | HistogramDataPoint | ExponentialHistogramDataPoint,
268+
) -> Point:
266269
"""
267270
Adapted from CloudMonitoringMetricsExporter
268271
https://github.com/GoogleCloudPlatform/opentelemetry-operations-python/blob/3668dfe7ce3b80dd01f42af72428de957b58b316/opentelemetry-exporter-gcp-monitoring/src/opentelemetry/exporter/cloud_monitoring/__init__.py#L82
@@ -281,11 +284,15 @@ def _to_point(data_point: NumberDataPoint | HistogramDataPoint) -> Point:
281284
),
282285
)
283286
)
284-
else:
287+
elif isinstance(data_point, NumberDataPoint):
285288
if isinstance(data_point.value, int):
286289
point_value = TypedValue(int64_value=data_point.value)
287290
else:
288291
point_value = TypedValue(double_value=data_point.value)
292+
else:
293+
raise NotImplementedError(
294+
f"Unsupported OTel data point type: {type(data_point)}"
295+
)
289296
start_time = Timestamp()
290297
start_time.FromNanoseconds(data_point.start_time_unix_nano)
291298
end_time = Timestamp()

packages/google-cloud-bigtable/google/cloud/bigtable/data/_sync_autogen/mutations_batcher.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ def _flush_internal(self, new_entries: list[RowMutationEntry]):
329329
CrossSync._Sync_Impl.Future[list[FailedMutationEntryError]]
330330
] = []
331331
for batch, metric in self._flow_control.add_to_flow_with_metrics(
332-
new_entries, self._target._metrics
332+
new_entries, self._target.client._metrics
333333
):
334334
batch_task = CrossSync._Sync_Impl.create_task(
335335
self._execute_mutate_rows,

0 commit comments

Comments
 (0)