object_store/
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//! object-store metrics
16
17/// Cache hit counter, no matter what the cache result is.
18use lazy_static::lazy_static;
19use prometheus::*;
20
21lazy_static! {
22    /// Cache hit counter, no matter what the cache result is.
23    pub static ref OBJECT_STORE_LRU_CACHE_HIT: IntCounterVec = register_int_counter_vec!(
24        "greptime_object_store_lru_cache_hit",
25        "object store lru cache hit",
26        &["result"]
27    )
28    .unwrap();
29    /// Cache miss counter
30    pub static ref OBJECT_STORE_LRU_CACHE_MISS: IntCounter =
31        register_int_counter!("greptime_object_store_lru_cache_miss", "object store lru cache miss")
32            .unwrap();
33    /// Object store read error counter
34    pub static ref OBJECT_STORE_READ_ERROR: IntCounterVec = register_int_counter_vec!(
35        "greptime_object_store_read_errors",
36        "object store read errors",
37        &["kind"]
38    )
39    .unwrap();
40
41    /// Cache entry number
42    pub static ref OBJECT_STORE_LRU_CACHE_ENTRIES: IntGauge =
43        register_int_gauge!("greptime_object_store_lru_cache_entries", "object store lru cache entries")
44            .unwrap();
45
46    /// Cache size in bytes
47    pub static ref OBJECT_STORE_LRU_CACHE_BYTES: IntGauge =
48        register_int_gauge!("greptime_object_store_lru_cache_bytes",  "object store lru cache bytes")
49            .unwrap();
50}