client/
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_GRPC_CREATE_TABLE: Histogram =
20        register_histogram!("greptime_grpc_create_table", "grpc create table").unwrap();
21    pub static ref METRIC_GRPC_PROMQL_RANGE_QUERY: Histogram = register_histogram!(
22        "greptime_grpc_promql_range_query",
23        "grpc promql range query"
24    )
25    .unwrap();
26    pub static ref METRIC_GRPC_INSERT: Histogram =
27        register_histogram!("greptime_grpc_insert", "grpc insert").unwrap();
28    pub static ref METRIC_GRPC_DELETE: Histogram =
29        register_histogram!("greptime_grpc_delete", "grpc delete").unwrap();
30    pub static ref METRIC_GRPC_SQL: Histogram =
31        register_histogram!("greptime_grpc_sql", "grpc sql").unwrap();
32    pub static ref METRIC_GRPC_LOGICAL_PLAN: Histogram =
33        register_histogram!("greptime_grpc_logical_plan", "grpc logical plan").unwrap();
34    pub static ref METRIC_GRPC_ALTER: Histogram =
35        register_histogram!("greptime_grpc_alter", "grpc alter").unwrap();
36    pub static ref METRIC_GRPC_DROP_TABLE: Histogram =
37        register_histogram!("greptime_grpc_drop_table", "grpc drop table").unwrap();
38    pub static ref METRIC_GRPC_TRUNCATE_TABLE: Histogram =
39        register_histogram!("greptime_grpc_truncate_table", "grpc truncate table").unwrap();
40    pub static ref METRIC_GRPC_DO_GET: Histogram =
41        register_histogram!("greptime_grpc_do_get", "grpc do get").unwrap();
42    pub static ref METRIC_REGION_REQUEST_GRPC: HistogramVec = register_histogram_vec!(
43        "greptime_grpc_region_request",
44        "grpc region request",
45        &["request_type"]
46    )
47    .unwrap();
48}