Skip to content

Commit 7373f33

Browse files
committed
Fixing tracer factory metric names and used constants
1 parent 32a351a commit 7373f33

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

google/cloud/spanner_v1/metrics/metrics_tracer_factory.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@
1818
from google.cloud.spanner_v1.metrics.metrics_tracer import MetricsTracer
1919

2020
from google.cloud.spanner_v1.metrics.constants import (
21+
METRIC_NAME_OPERATION_LATENCIES,
2122
MONITORED_RES_LABEL_KEY_PROJECT,
23+
METRIC_NAME_ATTEMPT_LATENCIES,
24+
METRIC_NAME_OPERATION_COUNT,
25+
METRIC_NAME_ATTEMPT_COUNT,
2226
MONITORED_RES_LABEL_KEY_INSTANCE,
2327
MONITORED_RES_LABEL_KEY_INSTANCE_CONFIG,
2428
MONITORED_RES_LABEL_KEY_LOCATION,
@@ -281,25 +285,25 @@ def _create_metric_instruments(self, service_name: str) -> None:
281285
)
282286

283287
self._instrument_attempt_latency = meter.create_histogram(
284-
name=f"{service_name}/attempt_latency",
288+
name=METRIC_NAME_ATTEMPT_LATENCIES,
285289
unit="ms",
286290
description="Time an individual attempt took.",
287291
)
288292

289293
self._instrument_attempt_counter = meter.create_counter(
290-
name=f"{service_name}/attempt_count",
294+
name=METRIC_NAME_ATTEMPT_COUNT,
291295
unit="1",
292296
description="Number of attempts.",
293297
)
294298

295299
self._instrument_operation_latency = meter.create_histogram(
296-
name=f"{service_name}/operation_latency",
300+
name=METRIC_NAME_OPERATION_LATENCIES,
297301
unit="ms",
298302
description="Total time until final operation success or failure, including retries and backoff.",
299303
)
300304

301305
self._instrument_operation_counter = meter.create_counter(
302-
name=f"{service_name}/operation_count",
306+
name=METRIC_NAME_OPERATION_COUNT,
303307
unit="1",
304308
description="Number of operations.",
305309
)

0 commit comments

Comments
 (0)