|
| 1 | +# Copyright 2025 Google LLC |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | +BUILT_IN_METRICS_METER_NAME = "gax-python" |
| 16 | +NATIVE_METRICS_PREFIX = "spanner.googleapis.com/internal/client" |
| 17 | +SPANNER_RESOURCE_TYPE = "spanner_instance_client" |
| 18 | + |
| 19 | +# Monitored resource labels |
| 20 | +MONITORED_RES_LABEL_KEY_PROJECT = "project_id" |
| 21 | +MONITORED_RES_LABEL_KEY_INSTANCE = "instance_id" |
| 22 | +MONITORED_RES_LABEL_KEY_INSTANCE_CONFIG = "instance_config" |
| 23 | +MONITORED_RES_LABEL_KEY_LOCATION = "location" |
| 24 | +MONITORED_RES_LABEL_KEY_CLIENT_HASH = "client_hash" |
| 25 | +MONITORED_RESOURCE_LABELS = [ |
| 26 | + MONITORED_RES_LABEL_KEY_PROJECT, |
| 27 | + MONITORED_RES_LABEL_KEY_INSTANCE, |
| 28 | + MONITORED_RES_LABEL_KEY_INSTANCE_CONFIG, |
| 29 | + MONITORED_RES_LABEL_KEY_LOCATION, |
| 30 | + MONITORED_RES_LABEL_KEY_CLIENT_HASH, |
| 31 | +] |
| 32 | + |
| 33 | +# Metric labels |
| 34 | +METRIC_LABEL_KEY_CLIENT_UID = "client_uid" |
| 35 | +METRIC_LABEL_KEY_CLIENT_NAME = "client_name" |
| 36 | +METRIC_LABEL_KEY_DATABASE = "database" |
| 37 | +METRIC_LABEL_KEY_METHOD = "method" |
| 38 | +METRIC_LABEL_KEY_STATUS = "status" |
| 39 | +METRIC_LABEL_KEY_DIRECT_PATH_ENABLED = "directpath_enabled" |
| 40 | +METRIC_LABEL_KEY_DIRECT_PATH_USED = "directpath_used" |
| 41 | +METRIC_LABELS = [ |
| 42 | + METRIC_LABEL_KEY_CLIENT_UID, |
| 43 | + METRIC_LABEL_KEY_CLIENT_NAME, |
| 44 | + METRIC_LABEL_KEY_DATABASE, |
| 45 | + METRIC_LABEL_KEY_METHOD, |
| 46 | + METRIC_LABEL_KEY_STATUS, |
| 47 | + METRIC_LABEL_KEY_DIRECT_PATH_ENABLED, |
| 48 | + METRIC_LABEL_KEY_DIRECT_PATH_USED, |
| 49 | +] |
| 50 | + |
| 51 | +# Metric names |
| 52 | +METRIC_NAME_OPERATION_LATENCIES = "operation_latencies" |
| 53 | +METRIC_NAME_ATTEMPT_LATENCIES = "attempt_latencies" |
| 54 | +METRIC_NAME_OPERATION_COUNT = "operation_count" |
| 55 | +METRIC_NAME_ATTEMPT_COUNT = "attempt_count" |
| 56 | +METRIC_NAME_GFE_LATENCY = "gfe_latency" |
| 57 | +METRIC_NAME_GFE_MISSING_HEADER_COUNT = "gfe_missing_header_count" |
| 58 | +METRIC_NAMES = [ |
| 59 | + METRIC_NAME_OPERATION_LATENCIES, |
| 60 | + METRIC_NAME_ATTEMPT_LATENCIES, |
| 61 | + METRIC_NAME_OPERATION_COUNT, |
| 62 | + METRIC_NAME_ATTEMPT_COUNT, |
| 63 | +] |
0 commit comments