common_runtime/
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
15//! Runtime metrics
16use lazy_static::lazy_static;
17use prometheus::*;
18
19pub const THREAD_NAME_LABEL: &str = "thread_name";
20
21lazy_static! {
22    pub static ref METRIC_RUNTIME_THREADS_ALIVE: IntGaugeVec = register_int_gauge_vec!(
23        "greptime_runtime_threads_alive",
24        "runtime threads alive",
25        &[THREAD_NAME_LABEL]
26    )
27    .unwrap();
28    pub static ref METRIC_RUNTIME_THREADS_IDLE: IntGaugeVec = register_int_gauge_vec!(
29        "greptime_runtime_threads_idle",
30        "runtime threads idle",
31        &[THREAD_NAME_LABEL]
32    )
33    .unwrap();
34}