common_meta/
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_META_TXN_REQUEST: HistogramVec = register_histogram_vec!(
20        "greptime_meta_txn_request",
21        "meta txn request",
22        &["target", "op"]
23    )
24    .unwrap();
25    pub static ref METRIC_META_CREATE_CATALOG: Histogram =
26        register_histogram!("greptime_meta_create_catalog", "meta create catalog").unwrap();
27    pub static ref METRIC_META_CREATE_CATALOG_COUNTER: IntCounter = register_int_counter!(
28        "greptime_meta_create_catalog_counter",
29        "meta create catalog"
30    )
31    .unwrap();
32    pub static ref METRIC_META_CREATE_SCHEMA: Histogram =
33        register_histogram!("greptime_meta_create_schema", "meta create schema").unwrap();
34    pub static ref METRIC_META_CREATE_SCHEMA_COUNTER: IntCounter =
35        register_int_counter!("greptime_meta_create_schema_counter", "meta create schema").unwrap();
36    pub static ref METRIC_META_PROCEDURE_CREATE_TABLE: HistogramVec = register_histogram_vec!(
37        "greptime_meta_procedure_create_table",
38        "meta procedure create table",
39        &["step"]
40    )
41    .unwrap();
42    pub static ref METRIC_META_PROCEDURE_CREATE_VIEW: HistogramVec = register_histogram_vec!(
43        "greptime_meta_procedure_create_view",
44        "meta procedure create view",
45        &["step"]
46    )
47    .unwrap();
48    pub static ref METRIC_META_PROCEDURE_CREATE_FLOW: HistogramVec = register_histogram_vec!(
49        "greptime_meta_procedure_create_flow",
50        "meta procedure create flow",
51        &["step"]
52    )
53    .unwrap();
54    pub static ref METRIC_META_PROCEDURE_DROP_FLOW: HistogramVec = register_histogram_vec!(
55        "greptime_meta_procedure_drop_flow",
56        "meta procedure drop flow",
57        &["step"]
58    )
59        .unwrap();
60    pub static ref METRIC_META_PROCEDURE_DROP_VIEW: HistogramVec = register_histogram_vec!(
61        "greptime_meta_procedure_drop_view",
62        "meta procedure drop view",
63        &["step"]
64    )
65    .unwrap();
66    pub static ref METRIC_META_PROCEDURE_CREATE_TABLES: HistogramVec = register_histogram_vec!(
67        "greptime_meta_procedure_create_tables",
68        "meta procedure create tables",
69        &["step"]
70    )
71    .unwrap();
72    pub static ref METRIC_META_PROCEDURE_DROP_TABLE: HistogramVec = register_histogram_vec!(
73        "greptime_meta_procedure_drop_table",
74        "meta procedure drop table",
75        &["step"]
76    )
77    .unwrap();
78    pub static ref METRIC_META_PROCEDURE_ALTER_TABLE: HistogramVec = register_histogram_vec!(
79        "greptime_meta_procedure_alter_table",
80        "meta procedure alter table",
81        &["step"]
82    )
83    .unwrap();
84    pub static ref METRIC_META_PROCEDURE_TRUNCATE_TABLE: HistogramVec = register_histogram_vec!(
85        "greptime_meta_procedure_truncate_table",
86        "meta procedure truncate table",
87        &["step"]
88    )
89    .unwrap();
90    /// Cache container cache get counter.
91    pub static ref CACHE_CONTAINER_CACHE_GET: IntCounterVec = register_int_counter_vec!(
92        "greptime_meta_cache_container_cache_get",
93        "cache container cache get",
94        &["name"]
95    )
96    .unwrap();
97    /// Cache container cache miss counter.
98    pub static ref CACHE_CONTAINER_CACHE_MISS: IntCounterVec = register_int_counter_vec!(
99        "greptime_meta_cache_container_cache_miss",
100        "cache container cache miss",
101        &["name"]
102    )
103    .unwrap();
104    /// Cache container load cache timer
105    pub static ref CACHE_CONTAINER_LOAD_CACHE: HistogramVec = register_histogram_vec!(
106        "greptime_meta_cache_container_load_cache",
107        "cache container load cache",
108        &["name"]
109    )
110    .unwrap();
111}