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
15use lazy_static::lazy_static;
16use prometheus::*;
17
18lazy_static! {
19    pub static ref METRIC_CATALOG_MANAGER_CATALOG_COUNT: IntGauge =
20        register_int_gauge!("greptime_catalog_catalog_count", "catalog catalog count").unwrap();
21    pub static ref METRIC_CATALOG_MANAGER_SCHEMA_COUNT: IntGauge =
22        register_int_gauge!("greptime_catalog_schema_count", "catalog schema count").unwrap();
23    pub static ref METRIC_CATALOG_MANAGER_TABLE_COUNT: IntGaugeVec = register_int_gauge_vec!(
24        "greptime_catalog_table_count",
25        "catalog table count",
26        &["db"]
27    )
28    .unwrap();
29    pub static ref METRIC_CATALOG_KV_REMOTE_GET: Histogram =
30        register_histogram!("greptime_catalog_kv_get_remote", "catalog kv get remote").unwrap();
31    pub static ref METRIC_CATALOG_KV_GET: Histogram =
32        register_histogram!("greptime_catalog_kv_get", "catalog kv get").unwrap();
33    pub static ref METRIC_CATALOG_KV_BATCH_GET: Histogram =
34        register_histogram!("greptime_catalog_kv_batch_get", "catalog kv batch get").unwrap();
35
36    /// Count of running process in each catalog.
37    pub static ref PROCESS_LIST_COUNT: IntGaugeVec = register_int_gauge_vec!(
38        "greptime_process_list_count",
39        "Running process count per catalog",
40        &["catalog"]
41    )
42    .unwrap();
43
44    /// Count of killed process in each catalog.
45    pub static ref PROCESS_KILL_COUNT: IntCounterVec = register_int_counter_vec!(
46        "greptime_process_kill_count",
47        "Completed kill process requests count",
48        &["catalog"]
49    )
50    .unwrap();
51}