|
18 | 18 | from google.cloud.spanner_v1.metrics.metrics_tracer import MetricsTracer |
19 | 19 |
|
20 | 20 | from google.cloud.spanner_v1.metrics.constants import ( |
| 21 | + METRIC_NAME_OPERATION_LATENCIES, |
21 | 22 | MONITORED_RES_LABEL_KEY_PROJECT, |
| 23 | + METRIC_NAME_ATTEMPT_LATENCIES, |
| 24 | + METRIC_NAME_OPERATION_COUNT, |
| 25 | + METRIC_NAME_ATTEMPT_COUNT, |
22 | 26 | MONITORED_RES_LABEL_KEY_INSTANCE, |
23 | 27 | MONITORED_RES_LABEL_KEY_INSTANCE_CONFIG, |
24 | 28 | MONITORED_RES_LABEL_KEY_LOCATION, |
@@ -281,25 +285,25 @@ def _create_metric_instruments(self, service_name: str) -> None: |
281 | 285 | ) |
282 | 286 |
|
283 | 287 | self._instrument_attempt_latency = meter.create_histogram( |
284 | | - name=f"{service_name}/attempt_latency", |
| 288 | + name=METRIC_NAME_ATTEMPT_LATENCIES, |
285 | 289 | unit="ms", |
286 | 290 | description="Time an individual attempt took.", |
287 | 291 | ) |
288 | 292 |
|
289 | 293 | self._instrument_attempt_counter = meter.create_counter( |
290 | | - name=f"{service_name}/attempt_count", |
| 294 | + name=METRIC_NAME_ATTEMPT_COUNT, |
291 | 295 | unit="1", |
292 | 296 | description="Number of attempts.", |
293 | 297 | ) |
294 | 298 |
|
295 | 299 | self._instrument_operation_latency = meter.create_histogram( |
296 | | - name=f"{service_name}/operation_latency", |
| 300 | + name=METRIC_NAME_OPERATION_LATENCIES, |
297 | 301 | unit="ms", |
298 | 302 | description="Total time until final operation success or failure, including retries and backoff.", |
299 | 303 | ) |
300 | 304 |
|
301 | 305 | self._instrument_operation_counter = meter.create_counter( |
302 | | - name=f"{service_name}/operation_count", |
| 306 | + name=METRIC_NAME_OPERATION_COUNT, |
303 | 307 | unit="1", |
304 | 308 | description="Number of operations.", |
305 | 309 | ) |
0 commit comments