catalog/
metrics.rs

1// Copyright 2023 Greptime Team
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
15pub(crate) const METRIC_DB_LABEL: &str = "db";
16
17use lazy_static::lazy_static;
18use prometheus::*;
19
20lazy_static! {
21    pub static ref METRIC_CATALOG_MANAGER_CATALOG_COUNT: IntGauge =
22        register_int_gauge!("greptime_catalog_catalog_count", "catalog catalog count").unwrap();
23    pub static ref METRIC_CATALOG_MANAGER_SCHEMA_COUNT: IntGauge =
24        register_int_gauge!("greptime_catalog_schema_count", "catalog schema count").unwrap();
25    pub static ref METRIC_CATALOG_MANAGER_TABLE_COUNT: IntGaugeVec = register_int_gauge_vec!(
26        "greptime_catalog_table_count",
27        "catalog table count",
28        &[METRIC_DB_LABEL]
29    )
30    .unwrap();
31    pub static ref METRIC_CATALOG_KV_REMOTE_GET: Histogram =
32        register_histogram!("greptime_catalog_kv_get_remote", "catalog kv get remote").unwrap();
33    pub static ref METRIC_CATALOG_KV_GET: Histogram =
34        register_histogram!("greptime_catalog_kv_get", "catalog kv get").unwrap();
35    pub static ref METRIC_CATALOG_KV_BATCH_GET: Histogram =
36        register_histogram!("greptime_catalog_kv_batch_get", "catalog kv batch get").unwrap();
37}