Coverage Report

Created: 2026-08-25 11:49

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/root/doris/cloud/src/common/bvars.h
Line
Count
Source
1
// Licensed to the Apache Software Foundation (ASF) under one
2
// or more contributor license agreements.  See the NOTICE file
3
// distributed with this work for additional information
4
// regarding copyright ownership.  The ASF licenses this file
5
// to you under the Apache License, Version 2.0 (the
6
// "License"); you may not use this file except in compliance
7
// with the License.  You may obtain a copy of the License at
8
//
9
//   http://www.apache.org/licenses/LICENSE-2.0
10
//
11
// Unless required by applicable law or agreed to in writing,
12
// software distributed under the License is distributed on an
13
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
// KIND, either express or implied.  See the License for the
15
// specific language governing permissions and limitations
16
// under the License.
17
18
#pragma once
19
20
#include <aws/core/external/cjson/cJSON.h>
21
#include <bthread/bthread.h>
22
#include <bthread/mutex.h>
23
#include <bthread/unstable.h>
24
#include <bvar/bvar.h>
25
#include <bvar/latency_recorder.h>
26
#include <bvar/multi_dimension.h>
27
#include <bvar/passive_status.h>
28
#include <bvar/reducer.h>
29
#include <bvar/status.h>
30
#include <cpp/sync_point.h>
31
#include <gmock/gmock-actions.h>
32
33
#include <atomic>
34
#include <cstdint>
35
#include <initializer_list>
36
#include <map>
37
#include <memory>
38
#include <mutex>
39
#include <string>
40
#include <type_traits>
41
#include <utility>
42
43
#include "common/logging.h"
44
45
/**
46
 * Manage bvars that with similar names (identical prefix)
47
 * ${module}_${name}_${tag}
48
 * where `tag` is added automatically when calling `get` or `put`
49
 */
50
template <typename Bvar, bool is_status = false>
51
class BvarWithTag {
52
public:
53
    BvarWithTag(std::string module, std::string name)
54
3.79k
            : module_(std::move(module)), name_(std::move(name)) {}
_ZN11BvarWithTagIN4bvar15LatencyRecorderELb0EEC2ENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_
Line
Count
Source
54
2.64k
            : module_(std::move(module)), name_(std::move(name)) {}
_ZN11BvarWithTagIN4bvar6StatusIlvEELb1EEC2ENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES9_
Line
Count
Source
54
1.15k
            : module_(std::move(module)), name_(std::move(name)) {}
55
56
    template <typename ValType>
57
        requires std::is_integral_v<ValType>
58
197k
    void put(const std::string& tag, ValType value) {
59
197k
        std::shared_ptr<Bvar> instance = nullptr;
60
197k
        {
61
197k
            std::lock_guard<bthread::Mutex> l(mutex_);
62
197k
            auto it = bvar_map_.find(tag);
63
197k
            if (it == bvar_map_.end()) {
64
1.43k
                instance = std::make_shared<Bvar>(module_, name_ + "_" + tag, ValType());
65
1.43k
                bvar_map_[tag] = instance;
66
195k
            } else {
67
195k
                instance = it->second;
68
195k
            }
69
197k
        }
70
        // FIXME(gavin): check bvar::Adder and more
71
197k
        if constexpr (std::is_same_v<Bvar, bvar::LatencyRecorder>) {
72
197k
            (*instance) << value;
73
197k
        } else if constexpr (is_status) {
74
320
            instance->set_value(value);
75
        } else {
76
            // This branch mean to be unreachable, add an assert(false) here to
77
            // prevent missing branch match.
78
            // Postpone deduction of static_assert by evaluating sizeof(T)
79
            static_assert(!sizeof(Bvar), "all types must be matched with if constexpr");
80
        }
81
197k
    }
_ZN11BvarWithTagIN4bvar15LatencyRecorderELb0EE3putIlQsr3stdE13is_integral_vITL0__EEEvRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEET_
Line
Count
Source
58
197k
    void put(const std::string& tag, ValType value) {
59
197k
        std::shared_ptr<Bvar> instance = nullptr;
60
197k
        {
61
197k
            std::lock_guard<bthread::Mutex> l(mutex_);
62
197k
            auto it = bvar_map_.find(tag);
63
197k
            if (it == bvar_map_.end()) {
64
1.25k
                instance = std::make_shared<Bvar>(module_, name_ + "_" + tag, ValType());
65
1.25k
                bvar_map_[tag] = instance;
66
195k
            } else {
67
195k
                instance = it->second;
68
195k
            }
69
197k
        }
70
        // FIXME(gavin): check bvar::Adder and more
71
197k
        if constexpr (std::is_same_v<Bvar, bvar::LatencyRecorder>) {
72
197k
            (*instance) << value;
73
        } else if constexpr (is_status) {
74
            instance->set_value(value);
75
        } else {
76
            // This branch mean to be unreachable, add an assert(false) here to
77
            // prevent missing branch match.
78
            // Postpone deduction of static_assert by evaluating sizeof(T)
79
            static_assert(!sizeof(Bvar), "all types must be matched with if constexpr");
80
        }
81
197k
    }
_ZN11BvarWithTagIN4bvar6StatusIlvEELb1EE3putIlQsr3stdE13is_integral_vITL0__EEEvRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEET_
Line
Count
Source
58
285
    void put(const std::string& tag, ValType value) {
59
285
        std::shared_ptr<Bvar> instance = nullptr;
60
285
        {
61
285
            std::lock_guard<bthread::Mutex> l(mutex_);
62
285
            auto it = bvar_map_.find(tag);
63
285
            if (it == bvar_map_.end()) {
64
164
                instance = std::make_shared<Bvar>(module_, name_ + "_" + tag, ValType());
65
164
                bvar_map_[tag] = instance;
66
164
            } else {
67
121
                instance = it->second;
68
121
            }
69
285
        }
70
        // FIXME(gavin): check bvar::Adder and more
71
        if constexpr (std::is_same_v<Bvar, bvar::LatencyRecorder>) {
72
            (*instance) << value;
73
285
        } else if constexpr (is_status) {
74
285
            instance->set_value(value);
75
        } else {
76
            // This branch mean to be unreachable, add an assert(false) here to
77
            // prevent missing branch match.
78
            // Postpone deduction of static_assert by evaluating sizeof(T)
79
            static_assert(!sizeof(Bvar), "all types must be matched with if constexpr");
80
        }
81
285
    }
_ZN11BvarWithTagIN4bvar6StatusIlvEELb1EE3putImQsr3stdE13is_integral_vITL0__EEEvRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEET_
Line
Count
Source
58
11
    void put(const std::string& tag, ValType value) {
59
11
        std::shared_ptr<Bvar> instance = nullptr;
60
11
        {
61
11
            std::lock_guard<bthread::Mutex> l(mutex_);
62
11
            auto it = bvar_map_.find(tag);
63
11
            if (it == bvar_map_.end()) {
64
11
                instance = std::make_shared<Bvar>(module_, name_ + "_" + tag, ValType());
65
11
                bvar_map_[tag] = instance;
66
11
            } else {
67
0
                instance = it->second;
68
0
            }
69
11
        }
70
        // FIXME(gavin): check bvar::Adder and more
71
        if constexpr (std::is_same_v<Bvar, bvar::LatencyRecorder>) {
72
            (*instance) << value;
73
11
        } else if constexpr (is_status) {
74
11
            instance->set_value(value);
75
        } else {
76
            // This branch mean to be unreachable, add an assert(false) here to
77
            // prevent missing branch match.
78
            // Postpone deduction of static_assert by evaluating sizeof(T)
79
            static_assert(!sizeof(Bvar), "all types must be matched with if constexpr");
80
        }
81
11
    }
_ZN11BvarWithTagIN4bvar6StatusIlvEELb1EE3putIiQsr3stdE13is_integral_vITL0__EEEvRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEET_
Line
Count
Source
58
24
    void put(const std::string& tag, ValType value) {
59
24
        std::shared_ptr<Bvar> instance = nullptr;
60
24
        {
61
24
            std::lock_guard<bthread::Mutex> l(mutex_);
62
24
            auto it = bvar_map_.find(tag);
63
24
            if (it == bvar_map_.end()) {
64
8
                instance = std::make_shared<Bvar>(module_, name_ + "_" + tag, ValType());
65
8
                bvar_map_[tag] = instance;
66
16
            } else {
67
16
                instance = it->second;
68
16
            }
69
24
        }
70
        // FIXME(gavin): check bvar::Adder and more
71
        if constexpr (std::is_same_v<Bvar, bvar::LatencyRecorder>) {
72
            (*instance) << value;
73
24
        } else if constexpr (is_status) {
74
24
            instance->set_value(value);
75
        } else {
76
            // This branch mean to be unreachable, add an assert(false) here to
77
            // prevent missing branch match.
78
            // Postpone deduction of static_assert by evaluating sizeof(T)
79
            static_assert(!sizeof(Bvar), "all types must be matched with if constexpr");
80
        }
81
24
    }
82
83
1.00k
    std::shared_ptr<Bvar> get(const std::string& tag) {
84
1.00k
        std::shared_ptr<Bvar> instance = nullptr;
85
1.00k
        std::lock_guard<bthread::Mutex> l(mutex_);
86
87
1.00k
        auto it = bvar_map_.find(tag);
88
1.00k
        if (it == bvar_map_.end()) {
89
2
            instance = std::make_shared<Bvar>(module_, name_ + "_" + tag);
90
2
            bvar_map_[tag] = instance;
91
2
            return instance;
92
2
        }
93
1.00k
        return it->second;
94
1.00k
    }
95
96
    void remove(const std::string& tag) {
97
        std::lock_guard<bthread::Mutex> l(mutex_);
98
        bvar_map_.erase(tag);
99
    }
100
101
private:
102
    bthread::Mutex mutex_;
103
    std::string module_;
104
    std::string name_;
105
    std::map<std::string, std::shared_ptr<Bvar>> bvar_map_;
106
};
107
108
using BvarLatencyRecorderWithTag = BvarWithTag<bvar::LatencyRecorder>;
109
110
template <typename T>
111
    requires std::is_integral_v<T>
112
using BvarStatusWithTag = BvarWithTag<bvar::Status<T>, true>;
113
114
/**
115
@brief: A wrapper class for multidimensional bvar metrics.
116
This template class provides a convenient interface for managing multidimensional
117
bvar metrics. It supports various bvar types including Adder, IntRecorder,
118
LatencyRecorder, Maxer, and Status.
119
@param: BvarType The type of bvar metric to use (must be one of the supported types)
120
@output: Based on the bvar multidimensional counter implementation,
121
the metrics output format would typically follow this structure:
122
{metric_name}{dimension1="value1",dimension2="value2",...} value
123
@example: Basic usage with an Adder:
124
// Create a 2-dimensional counter with dimensions "region" and "service"
125
mBvarWrapper<bvar::Adder<int>> request_counter("xxx_request_count", {"region", "service"});
126
// Increment the counter for specific dimension values
127
request_counter.put({"east", "login"}, 1);
128
request_counter.put({"west", "search"}, 1);
129
request_counter.put({"east", "login"}, 1); // Now east/login has value 2
130
// the output of above metrics:
131
xxx_request_count{region="east",service="login"} 2
132
xxx_request_count{region="west",service="search"} 1
133
@note: The dimensions provided in the constructor and the values provided to
134
put() and get() methods must match in count. Also, all supported bvar types
135
have different behaviors for how values are processed and retrieved.
136
*/
137
138
template <typename T>
139
struct is_valid_bvar_type : std::false_type {};
140
template <typename T>
141
struct is_valid_bvar_type<bvar::Adder<T>> : std::true_type {};
142
template <>
143
struct is_valid_bvar_type<bvar::IntRecorder> : std::true_type {};
144
template <typename T>
145
struct is_valid_bvar_type<bvar::Maxer<T>> : std::true_type {};
146
template <typename T>
147
struct is_valid_bvar_type<bvar::Status<T>> : std::true_type {};
148
template <>
149
struct is_valid_bvar_type<bvar::LatencyRecorder> : std::true_type {};
150
template <typename T>
151
struct is_bvar_status : std::false_type {};
152
template <typename T>
153
struct is_bvar_status<bvar::Status<T>> : std::true_type {};
154
155
template <typename BvarType>
156
class mBvarWrapper {
157
public:
158
    mBvarWrapper(const std::string& metric_name,
159
                 const std::initializer_list<std::string>& dim_names)
160
10.2k
            : counter_(metric_name, std::list<std::string>(dim_names)) {
161
10.2k
        static_assert(is_valid_bvar_type<BvarType>::value,
162
10.2k
                      "BvarType must be one of the supported bvar types (Adder, IntRecorder, "
163
10.2k
                      "LatencyRecorder, Maxer, Status)");
164
10.2k
    }
_ZN12mBvarWrapperIN4bvar5AdderIiEEEC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt16initializer_listIS9_E
Line
Count
Source
160
396
            : counter_(metric_name, std::list<std::string>(dim_names)) {
161
396
        static_assert(is_valid_bvar_type<BvarType>::value,
162
396
                      "BvarType must be one of the supported bvar types (Adder, IntRecorder, "
163
396
                      "LatencyRecorder, Maxer, Status)");
164
396
    }
_ZN12mBvarWrapperIN4bvar6StatusIlvEEEC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt16initializer_listIS9_E
Line
Count
Source
160
660
            : counter_(metric_name, std::list<std::string>(dim_names)) {
161
660
        static_assert(is_valid_bvar_type<BvarType>::value,
162
660
                      "BvarType must be one of the supported bvar types (Adder, IntRecorder, "
163
660
                      "LatencyRecorder, Maxer, Status)");
164
660
    }
_ZN12mBvarWrapperIN4bvar6StatusIdvEEEC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt16initializer_listIS9_E
Line
Count
Source
160
165
            : counter_(metric_name, std::list<std::string>(dim_names)) {
161
165
        static_assert(is_valid_bvar_type<BvarType>::value,
162
165
                      "BvarType must be one of the supported bvar types (Adder, IntRecorder, "
163
165
                      "LatencyRecorder, Maxer, Status)");
164
165
    }
_ZN12mBvarWrapperIN4bvar5AdderIlEEEC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt16initializer_listIS9_E
Line
Count
Source
160
9.04k
            : counter_(metric_name, std::list<std::string>(dim_names)) {
161
9.04k
        static_assert(is_valid_bvar_type<BvarType>::value,
162
9.04k
                      "BvarType must be one of the supported bvar types (Adder, IntRecorder, "
163
9.04k
                      "LatencyRecorder, Maxer, Status)");
164
9.04k
    }
165
166
    template <typename ValType>
167
937k
    void put(const std::initializer_list<std::string>& dim_values, ValType value) {
168
937k
        BvarType* stats = counter_.get_stats(std::list<std::string>(dim_values));
169
937k
        if (stats) {
170
937k
            if constexpr (is_bvar_status<BvarType>::value) {
171
5.17k
                stats->set_value(value);
172
932k
            } else {
173
932k
                *stats << value;
174
932k
            }
175
937k
        }
176
937k
    }
_ZN12mBvarWrapperIN4bvar5AdderIlEEE3putImEEvRKSt16initializer_listINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEET_
Line
Count
Source
167
6
    void put(const std::initializer_list<std::string>& dim_values, ValType value) {
168
6
        BvarType* stats = counter_.get_stats(std::list<std::string>(dim_values));
169
6
        if (stats) {
170
            if constexpr (is_bvar_status<BvarType>::value) {
171
                stats->set_value(value);
172
6
            } else {
173
6
                *stats << value;
174
6
            }
175
6
        }
176
6
    }
_ZN12mBvarWrapperIN4bvar5AdderIlEEE3putIlEEvRKSt16initializer_listINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEET_
Line
Count
Source
167
930k
    void put(const std::initializer_list<std::string>& dim_values, ValType value) {
168
930k
        BvarType* stats = counter_.get_stats(std::list<std::string>(dim_values));
169
930k
        if (stats) {
170
            if constexpr (is_bvar_status<BvarType>::value) {
171
                stats->set_value(value);
172
930k
            } else {
173
930k
                *stats << value;
174
930k
            }
175
930k
        }
176
930k
    }
_ZN12mBvarWrapperIN4bvar6StatusIdvEEE3putIdEEvRKSt16initializer_listINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEET_
Line
Count
Source
167
2.37k
    void put(const std::initializer_list<std::string>& dim_values, ValType value) {
168
2.37k
        BvarType* stats = counter_.get_stats(std::list<std::string>(dim_values));
169
2.37k
        if (stats) {
170
2.37k
            if constexpr (is_bvar_status<BvarType>::value) {
171
2.37k
                stats->set_value(value);
172
            } else {
173
                *stats << value;
174
            }
175
2.37k
        }
176
2.37k
    }
_ZN12mBvarWrapperIN4bvar5AdderIiEEE3putIiEEvRKSt16initializer_listINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEET_
Line
Count
Source
167
805
    void put(const std::initializer_list<std::string>& dim_values, ValType value) {
168
805
        BvarType* stats = counter_.get_stats(std::list<std::string>(dim_values));
169
806
        if (stats) {
170
            if constexpr (is_bvar_status<BvarType>::value) {
171
                stats->set_value(value);
172
806
            } else {
173
806
                *stats << value;
174
806
            }
175
806
        }
176
805
    }
_ZN12mBvarWrapperIN4bvar5AdderIlEEE3putIyEEvRKSt16initializer_listINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEET_
Line
Count
Source
167
698
    void put(const std::initializer_list<std::string>& dim_values, ValType value) {
168
698
        BvarType* stats = counter_.get_stats(std::list<std::string>(dim_values));
169
698
        if (stats) {
170
            if constexpr (is_bvar_status<BvarType>::value) {
171
                stats->set_value(value);
172
698
            } else {
173
698
                *stats << value;
174
698
            }
175
698
        }
176
698
    }
_ZN12mBvarWrapperIN4bvar6StatusIlvEEE3putIyEEvRKSt16initializer_listINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEET_
Line
Count
Source
167
2.42k
    void put(const std::initializer_list<std::string>& dim_values, ValType value) {
168
2.42k
        BvarType* stats = counter_.get_stats(std::list<std::string>(dim_values));
169
2.43k
        if (stats) {
170
2.43k
            if constexpr (is_bvar_status<BvarType>::value) {
171
2.43k
                stats->set_value(value);
172
            } else {
173
                *stats << value;
174
            }
175
2.43k
        }
176
2.42k
    }
_ZN12mBvarWrapperIN4bvar6StatusIlvEEE3putIlEEvRKSt16initializer_listINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEET_
Line
Count
Source
167
370
    void put(const std::initializer_list<std::string>& dim_values, ValType value) {
168
370
        BvarType* stats = counter_.get_stats(std::list<std::string>(dim_values));
169
370
        if (stats) {
170
370
            if constexpr (is_bvar_status<BvarType>::value) {
171
370
                stats->set_value(value);
172
            } else {
173
                *stats << value;
174
            }
175
370
        }
176
370
    }
_ZN12mBvarWrapperIN4bvar5AdderIiEEE3putIlEEvRKSt16initializer_listINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEET_
Line
Count
Source
167
256
    void put(const std::initializer_list<std::string>& dim_values, ValType value) {
168
256
        BvarType* stats = counter_.get_stats(std::list<std::string>(dim_values));
169
256
        if (stats) {
170
            if constexpr (is_bvar_status<BvarType>::value) {
171
                stats->set_value(value);
172
256
            } else {
173
256
                *stats << value;
174
256
            }
175
256
        }
176
256
    }
Unexecuted instantiation: _ZN12mBvarWrapperIN4bvar6StatusIlvEEE3putImEEvRKSt16initializer_listINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEET_
177
178
275
    auto get(const std::initializer_list<std::string>& dim_values) {
179
275
        BvarType* stats = counter_.get_stats(std::list<std::string>(dim_values));
180
275
        using ReturnType = decltype(stats->get_value());
181
275
        if (stats) {
182
275
            return stats->get_value();
183
275
        }
184
0
        return ReturnType {};
185
275
    }
_ZN12mBvarWrapperIN4bvar6StatusIlvEEE3getERKSt16initializer_listINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEE
Line
Count
Source
178
8
    auto get(const std::initializer_list<std::string>& dim_values) {
179
8
        BvarType* stats = counter_.get_stats(std::list<std::string>(dim_values));
180
8
        using ReturnType = decltype(stats->get_value());
181
8
        if (stats) {
182
8
            return stats->get_value();
183
8
        }
184
0
        return ReturnType {};
185
8
    }
_ZN12mBvarWrapperIN4bvar6StatusIdvEEE3getERKSt16initializer_listINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEE
Line
Count
Source
178
58
    auto get(const std::initializer_list<std::string>& dim_values) {
179
58
        BvarType* stats = counter_.get_stats(std::list<std::string>(dim_values));
180
58
        using ReturnType = decltype(stats->get_value());
181
58
        if (stats) {
182
58
            return stats->get_value();
183
58
        }
184
0
        return ReturnType {};
185
58
    }
_ZN12mBvarWrapperIN4bvar5AdderIiEEE3getERKSt16initializer_listINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEE
Line
Count
Source
178
7
    auto get(const std::initializer_list<std::string>& dim_values) {
179
7
        BvarType* stats = counter_.get_stats(std::list<std::string>(dim_values));
180
7
        using ReturnType = decltype(stats->get_value());
181
7
        if (stats) {
182
7
            return stats->get_value();
183
7
        }
184
0
        return ReturnType {};
185
7
    }
_ZN12mBvarWrapperIN4bvar5AdderIlEEE3getERKSt16initializer_listINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEE
Line
Count
Source
178
202
    auto get(const std::initializer_list<std::string>& dim_values) {
179
202
        BvarType* stats = counter_.get_stats(std::list<std::string>(dim_values));
180
202
        using ReturnType = decltype(stats->get_value());
181
202
        if (stats) {
182
202
            return stats->get_value();
183
202
        }
184
0
        return ReturnType {};
185
202
    }
186
187
private:
188
    bvar::MultiDimension<BvarType> counter_;
189
};
190
/**
191
 * @class BvarLatencyRecorderWithStatus
192
 * @brief A latency recorder with auto-exposed max and average metrics
193
 *
194
 * This class wraps a bvar::LatencyRecorder and automatically creates two
195
 * additional PassiveStatus metrics to expose the maximum and average latency.
196
 * This makes it convenient to track these key metrics in monitoring systems.
197
 * 
198
 * @tparam N Window size in seconds for the latency recorder, defaults to 60 seconds
199
 *
200
 * @note Unlike mBvarLatencyRecorderWithStatus, this class doesn't support multi-dimensional
201
 * metrics and doesn't use a timer to update status. It uses PassiveStatus to calculate
202
 * statistics in real-time when queried.
203
 *
204
 * @example Basic usage:
205
 *   // Create a latency recorder
206
 *   BvarLatencyRecorderWithStatus<> my_latency("my_service_latency");
207
 *   // Record a latency value (in microseconds)
208
 *   my_latency << 1500;  // or my_latency.put(1500);
209
 *   // This will create three metrics:
210
 *   // - The original latency recorder (hidden)
211
 *   // - my_service_latency_max (showing maximum latency)
212
 *   // - my_service_latency_avg (showing average latency)
213
 */
214
template <int N = 60>
215
class BvarLatencyRecorderWithStatus {
216
public:
217
    /**
218
     * @brief Constructor
219
     * @param metric_name Base name for the metrics, _max and _avg suffixes will be added
220
     */
221
    BvarLatencyRecorderWithStatus(const std::string& metric_name)
222
66
            : recorder_(N),
223
66
              max_status_(metric_name + "_max", get_max_latency, this),
224
66
              avg_status_(metric_name + "_avg", get_avg_latency, this),
225
66
              count_status_(metric_name + "_count", get_count_latency, this) {
226
66
        recorder_.hide();
227
66
    }
228
229
    /**
230
     * @brief Constructor with prefix
231
     * @param prefix Prefix for the metric name
232
     * @param metric_name Base name for the metrics
233
     */
234
    BvarLatencyRecorderWithStatus(const std::string& prefix, const std::string& metric_name)
235
66
            : BvarLatencyRecorderWithStatus(prefix + "_" + metric_name) {}
236
237
    /**
238
     * @brief Record a latency value
239
     * @param value Latency value to record (in microseconds)
240
     */
241
    void put(int64_t value) { recorder_ << value; }
242
243
    /**
244
     * @brief Stream operator for recording latency values
245
     * @param value Latency value to record (in microseconds)
246
     */
247
1.12k
    void operator<<(int64_t value) { recorder_ << value; }
248
249
    int64_t max() const { return recorder_.max_latency(); }
250
251
    int64_t avg() const { return recorder_.latency(); }
252
253
    int64_t count() const { return recorder_.count(); }
254
255
private:
256
    bvar::LatencyRecorder recorder_;            // The underlying latency recorder
257
    bvar::PassiveStatus<int64_t> max_status_;   // Passive status for maximum latency
258
    bvar::PassiveStatus<int64_t> avg_status_;   // Passive status for average latency
259
    bvar::PassiveStatus<int64_t> count_status_; // Passive status for count latency
260
261
    /**
262
     * @brief Callback function to get maximum latency
263
     * @param arg Pointer to the BvarLatencyRecorderWithStatus instance
264
     * @return Maximum latency value, or 0 if negative
265
     */
266
1.61k
    static int64_t get_max_latency(void* arg) {
267
1.61k
        auto* self = static_cast<BvarLatencyRecorderWithStatus*>(arg);
268
1.61k
        int64_t value = self->recorder_.max_latency();
269
1.61k
        return value >= 0 ? value : 0;
270
1.61k
    }
271
272
    /**
273
     * @brief Callback function to get average latency
274
     * @param arg Pointer to the BvarLatencyRecorderWithStatus instance
275
     * @return Average latency value, or 0 if negative
276
     */
277
1.61k
    static int64_t get_avg_latency(void* arg) {
278
1.61k
        auto* self = static_cast<BvarLatencyRecorderWithStatus*>(arg);
279
1.61k
        int64_t value = self->recorder_.latency();
280
1.61k
        return value >= 0 ? value : 0;
281
1.61k
    }
282
283
    /**
284
     * @brief Callback function to get count latency
285
     * @param arg Pointer to the BvarLatencyRecorderWithStatus instance
286
     * @return Count latency value, or 0 if negative
287
     */
288
1.61k
    static int64_t get_count_latency(void* arg) {
289
1.61k
        auto* self = static_cast<BvarLatencyRecorderWithStatus*>(arg);
290
1.61k
        int64_t value = self->recorder_.count();
291
1.61k
        return value >= 0 ? value : 0;
292
1.61k
    }
293
};
294
295
/**
296
 * @class MBvarLatencyRecorderWithStatus
297
 * @brief A multi-dimensional latency recorder with status metrics
298
 * 
299
 * This class provides a way to record latency metrics across multiple dimensions and
300
 * automatically update status metrics (max and average) at regular intervals.
301
 * It leverages bvar's MultiDimension capability to track metrics per dimension combination.
302
 * 
303
 * @tparam N Window size in seconds for the latency recorder (default: 60)
304
 */
305
template <int N = 60>
306
class MBvarLatencyRecorderWithStatus {
307
private:
308
    /**
309
    * @class ScheduledLatencyUpdater
310
    * @brief A helper class to schedule deferred execution of tasks using bthread timer.
311
    * 
312
    * This class provides a way to execute a callback function after a specified time interval.
313
    * It takes care of safely managing the lifecycle of the timer and ensures the callback
314
    * is only executed if the timer and its arguments are still valid.
315
    * 
316
    * @note This class requires bthread to be initialized before use. If bthread is not
317
    * initialized, timer creation will fail.
318
    */
319
    class ScheduledLatencyUpdater : public bvar::LatencyRecorder {
320
    public:
321
        /**
322
        * @brief Constructor for ScheduledLatencyUpdater
323
        * 
324
        * @param interval_s The time interval in seconds after which the callback should be executed
325
        * @param arg Optional argument to pass to the callback function
326
        */
327
        ScheduledLatencyUpdater(size_t interval_s, void* arg = nullptr)
328
336
                : bvar::LatencyRecorder(interval_s), _interval_s(interval_s), _arg(arg) {
329
336
            hide();
330
336
        }
331
332
        /**
333
        * @brief Destructor
334
        * 
335
        * Stops the timer if it's still running to prevent any callbacks after destruction
336
        */
337
200
        ~ScheduledLatencyUpdater() { stop(); }
338
339
        /**
340
        * @brief Start the timer
341
        * 
342
        * Schedules the callback function to be executed after the specified interval.
343
        * Does nothing if the timer has already been started.
344
        * 
345
        * @return true if the timer was successfully started, false otherwise
346
        */
347
41.0k
        bool start() {
348
41.0k
            if (!_started.load()) {
349
364
                {
350
364
                    std::lock_guard<bthread::Mutex> l(init_mutex_);
351
364
                    if (!_started.load()) {
352
336
                        if (!schedule()) {
353
0
                            return false;
354
0
                        }
355
336
                        _started.store(true);
356
336
                    }
357
364
                    return true;
358
364
                }
359
364
            }
360
40.6k
            return true;
361
41.0k
        }
362
363
        /*** @brief Reschedule the timer
364
        * 
365
        * Scheduling a one-time task.
366
        * This is useful if you want to reset the timer interval.
367
        */
368
764
        bool schedule() {
369
764
            if (bthread_timer_add(&_timer, butil::seconds_from_now(_interval_s), update, this) !=
370
764
                0) {
371
0
                LOG(WARNING) << "Failed to add bthread timer for ScheduledLatencyUpdater";
372
0
                return false;
373
0
            }
374
764
            return true;
375
764
        }
376
377
        /**
378
        * @brief Background update function
379
        * 
380
        * This function is called periodically by the timer to update the status metrics
381
        * with the current values from the latency recorders.
382
        * 
383
        * @param arg Pointer to the mBvarLatencyRecorderWithStatus instance
384
        */
385
428
        static void update(void* arg) {
386
428
            auto* latency_updater = static_cast<ScheduledLatencyUpdater*>(arg);
387
428
            if (!latency_updater || !latency_updater->_started) {
388
0
                LOG(WARNING) << "Invalid ScheduledLatencyUpdater in timer callback";
389
0
                return;
390
0
            }
391
392
428
            VLOG_DEBUG << "Timer triggered for ScheduledLatencyUpdater, interval: "
393
0
                       << latency_updater->_interval_s << "s";
394
395
428
            auto* parent = static_cast<MBvarLatencyRecorderWithStatus*>(latency_updater->_arg);
396
428
            if (!parent) {
397
0
                LOG(WARNING) << "Invalid parent container in timer callback";
398
0
                return;
399
0
            }
400
401
428
            std::list<std::string> current_dim_list;
402
428
            {
403
428
                std::lock_guard<bthread::Mutex> l(parent->recorder_mutex_);
404
20.2k
                for (const auto& it : parent->recorder_) {
405
20.2k
                    if (it.second.get() == latency_updater) {
406
428
                        current_dim_list = it.first;
407
428
                        break;
408
428
                    }
409
20.2k
                }
410
428
            }
411
412
428
            if (current_dim_list.empty()) {
413
0
                LOG(WARNING) << "Could not find dimension for ScheduledLatencyUpdater";
414
0
                return;
415
0
            }
416
417
428
            {
418
428
                std::lock_guard<bthread::Mutex> l(parent->timer_mutex_);
419
420
428
                bvar::Status<int64_t>* max_status = parent->max_status_.get_stats(current_dim_list);
421
428
                bvar::Status<int64_t>* avg_status = parent->avg_status_.get_stats(current_dim_list);
422
428
                bvar::Status<int64_t>* count_status =
423
428
                        parent->count_status_.get_stats(current_dim_list);
424
425
428
                VLOG_DEBUG << "Updating latency recorder status for dimension, "
426
0
                           << "max_latency: " << latency_updater->max_latency()
427
0
                           << ", avg_latency: " << latency_updater->latency();
428
428
                TEST_SYNC_POINT("mBvarLatencyRecorderWithStatus::update");
429
430
428
                if (max_status) {
431
428
                    max_status->set_value(latency_updater->max_latency());
432
428
                }
433
428
                if (avg_status) {
434
428
                    avg_status->set_value(latency_updater->latency());
435
428
                }
436
428
                if (count_status) {
437
428
                    count_status->set_value(latency_updater->count());
438
428
                }
439
428
            }
440
441
428
            if (latency_updater->_started && !latency_updater->schedule()) {
442
0
                LOG(WARNING) << "Failed to reschedule timer for ScheduledLatencyUpdater";
443
0
                latency_updater->_started = false;
444
0
            }
445
428
        }
446
447
        /**
448
        * @brief Stop the timer
449
        * 
450
        * Cancels the timer if it's running and marks arguments as invalid to prevent
451
        * any pending callbacks from accessing potentially freed resources.
452
        */
453
200
        void stop() {
454
200
            if (_started.load()) {
455
200
                bthread_timer_del(_timer);
456
200
                _started = false;
457
200
            }
458
200
        }
459
460
    private:
461
        int _interval_s;                   // Timer interval in seconds
462
        void* _arg;                        // Argument to pass to the callback
463
        bthread_timer_t _timer;            // The bthread timer handle
464
        std::atomic_bool _started {false}; // Whether the timer has been started
465
        bthread::Mutex init_mutex_;        // Mutex for timer_map_
466
    };
467
468
public:
469
    /**
470
     * @brief Constructor
471
     * 
472
     * @param metric_name Base name for the metrics
473
     * @param dim_names List of dimension names
474
     */
475
    MBvarLatencyRecorderWithStatus(const std::string& metric_name,
476
                                   const std::initializer_list<std::string>& dim_names)
477
68
            : _metric_name(metric_name),
478
68
              max_status_(metric_name + "_max", std::list<std::string>(dim_names)),
479
68
              avg_status_(metric_name + "_avg", std::list<std::string>(dim_names)),
480
68
              count_status_(metric_name + "_count", std::list<std::string>(dim_names)) {}
481
482
    MBvarLatencyRecorderWithStatus(const std::string& prefix, const std::string& metric_name,
483
                                   const std::initializer_list<std::string>& dim_names)
484
66
            : MBvarLatencyRecorderWithStatus(prefix + "_" + metric_name, dim_names) {}
485
486
    /**
487
     * @brief Record a latency value
488
     * 
489
     * @param dim_values List of dimension values (must match the number of dimensions)
490
     * @param value The latency value to record
491
     */
492
41.0k
    void put(const std::initializer_list<std::string>& dim_values, int64_t value) {
493
41.0k
        std::list<std::string> dim_list(dim_values);
494
41.0k
        std::shared_ptr<ScheduledLatencyUpdater> latency = nullptr;
495
41.0k
        {
496
41.0k
            std::lock_guard<bthread::Mutex> l(recorder_mutex_);
497
41.0k
            auto it = recorder_.find(dim_list);
498
41.0k
            if (it == recorder_.end()) {
499
336
                int inteval_s = N;
500
336
                TEST_SYNC_POINT_CALLBACK("mBvarLatencyRecorderWithStatus::put", &inteval_s);
501
336
                latency = std::make_shared<ScheduledLatencyUpdater>(inteval_s, this);
502
336
                recorder_[dim_list] = latency;
503
40.7k
            } else {
504
40.7k
                latency = it->second;
505
40.7k
            }
506
41.0k
        }
507
508
41.0k
        auto* latency_ptr = latency.get();
509
41.0k
        latency->start();
510
41.0k
        *latency_ptr << value;
511
41.0k
    }
512
513
39.6k
    int64_t get_max(const std::initializer_list<std::string>& dim_values) {
514
39.6k
        return max_status_.get_stats(std::list<std::string>(dim_values))->get_value();
515
39.6k
    }
516
517
39.6k
    int64_t get_avg(const std::initializer_list<std::string>& dim_values) {
518
39.6k
        return avg_status_.get_stats(std::list<std::string>(dim_values))->get_value();
519
39.6k
    }
520
521
39.7k
    int64_t get_count(const std::initializer_list<std::string>& dim_values) {
522
39.7k
        return count_status_.get_stats(std::list<std::string>(dim_values))->get_value();
523
39.7k
    }
524
525
private:
526
    std::string _metric_name;
527
    // dim_names -> recorder
528
    std::map<std::list<std::string>, std::shared_ptr<ScheduledLatencyUpdater>> recorder_;
529
    bvar::MultiDimension<bvar::Status<int64_t>> max_status_;
530
    bvar::MultiDimension<bvar::Status<int64_t>> avg_status_;
531
    bvar::MultiDimension<bvar::Status<int64_t>> count_status_;
532
    bthread::Mutex recorder_mutex_; // Mutex for recorder_
533
    bthread::Mutex timer_mutex_;    // Mutex for timer_map_
534
};
535
536
using mBvarIntAdder = mBvarWrapper<bvar::Adder<int>>;
537
using mBvarInt64Adder = mBvarWrapper<bvar::Adder<int64_t>>;
538
using mBvarDoubleAdder = mBvarWrapper<bvar::Adder<double>>;
539
using mBvarIntRecorder = mBvarWrapper<bvar::IntRecorder>;
540
using mBvarLatencyRecorder = mBvarWrapper<bvar::LatencyRecorder>;
541
using mBvarIntMaxer = mBvarWrapper<bvar::Maxer<int>>;
542
using mBvarDoubleMaxer = mBvarWrapper<bvar::Maxer<double>>;
543
template <typename T>
544
using mBvarStatus = mBvarWrapper<bvar::Status<T>>;
545
546
// meta-service's bvars
547
extern BvarLatencyRecorderWithTag g_bvar_ms_begin_txn;
548
extern BvarLatencyRecorderWithTag g_bvar_ms_precommit_txn;
549
extern BvarLatencyRecorderWithTag g_bvar_ms_commit_txn;
550
extern BvarLatencyRecorderWithTag g_bvar_ms_commit_txn_eventually;
551
extern BvarLatencyRecorderWithTag g_bvar_ms_abort_txn;
552
extern BvarLatencyRecorderWithTag g_bvar_ms_get_txn;
553
extern BvarLatencyRecorderWithTag g_bvar_ms_get_current_max_txn_id;
554
extern BvarLatencyRecorderWithTag g_bvar_ms_create_meta_sync_point;
555
extern BvarLatencyRecorderWithTag g_bvar_ms_check_txn_conflict;
556
extern BvarLatencyRecorderWithTag g_bvar_ms_abort_txn_with_coordinator;
557
extern BvarLatencyRecorderWithTag g_bvar_ms_get_prepare_txn_by_coordinator;
558
extern BvarLatencyRecorderWithTag g_bvar_ms_begin_sub_txn;
559
extern BvarLatencyRecorderWithTag g_bvar_ms_abort_sub_txn;
560
extern BvarLatencyRecorderWithTag g_bvar_ms_clean_txn_label;
561
extern BvarLatencyRecorderWithTag g_bvar_ms_get_version;
562
extern BvarLatencyRecorderWithTag g_bvar_ms_get_table_stream_offset;
563
extern BvarLatencyRecorderWithTag g_bvar_ms_batch_get_version;
564
extern BvarLatencyRecorderWithTag g_bvar_ms_create_tablets;
565
extern BvarLatencyRecorderWithTag g_bvar_ms_update_tablet;
566
extern BvarLatencyRecorderWithTag g_bvar_ms_get_tablet;
567
extern BvarLatencyRecorderWithTag g_bvar_ms_prepare_rowset;
568
extern BvarLatencyRecorderWithTag g_bvar_ms_commit_rowset;
569
extern BvarLatencyRecorderWithTag g_bvar_ms_update_tmp_rowset;
570
extern BvarLatencyRecorderWithTag g_bvar_ms_get_rowset;
571
extern BvarLatencyRecorderWithTag g_bvar_ms_drop_index;
572
extern BvarLatencyRecorderWithTag g_bvar_ms_prepare_index;
573
extern BvarLatencyRecorderWithTag g_bvar_ms_commit_index;
574
extern BvarLatencyRecorderWithTag g_bvar_ms_prepare_partition;
575
extern BvarLatencyRecorderWithTag g_bvar_ms_commit_partition;
576
extern BvarLatencyRecorderWithTag g_bvar_ms_drop_partition;
577
extern BvarLatencyRecorderWithTag g_bvar_ms_prepare_restore_job;
578
extern BvarLatencyRecorderWithTag g_bvar_ms_commit_restore_job;
579
extern BvarLatencyRecorderWithTag g_bvar_ms_finish_restore_job;
580
extern BvarLatencyRecorderWithTag g_bvar_ms_get_tablet_stats;
581
extern BvarLatencyRecorderWithTag g_bvar_ms_get_obj_store_info;
582
extern BvarLatencyRecorderWithTag g_bvar_ms_alter_obj_store_info;
583
extern BvarLatencyRecorderWithTag g_bvar_ms_alter_storage_vault;
584
extern BvarLatencyRecorderWithTag g_bvar_ms_create_instance;
585
extern BvarLatencyRecorderWithTag g_bvar_ms_alter_instance;
586
extern BvarLatencyRecorderWithTag g_bvar_ms_alter_cluster;
587
extern BvarLatencyRecorderWithTag g_bvar_ms_get_cluster;
588
extern BvarLatencyRecorderWithTag g_bvar_ms_create_stage;
589
extern BvarLatencyRecorderWithTag g_bvar_ms_get_stage;
590
extern BvarLatencyRecorderWithTag g_bvar_ms_drop_stage;
591
extern BvarLatencyRecorderWithTag g_bvar_ms_get_iam;
592
extern BvarLatencyRecorderWithTag g_bvar_ms_update_ak_sk;
593
extern BvarLatencyRecorderWithTag g_bvar_ms_alter_iam;
594
extern BvarLatencyRecorderWithTag g_bvar_ms_alter_ram_user;
595
extern BvarLatencyRecorderWithTag g_bvar_ms_begin_copy;
596
extern BvarLatencyRecorderWithTag g_bvar_ms_finish_copy;
597
extern BvarLatencyRecorderWithTag g_bvar_ms_get_copy_job;
598
extern BvarLatencyRecorderWithTag g_bvar_ms_get_copy_files;
599
extern BvarLatencyRecorderWithTag g_bvar_ms_filter_copy_files;
600
extern BvarLatencyRecorderWithTag g_bvar_ms_start_tablet_job;
601
extern BvarLatencyRecorderWithTag g_bvar_ms_finish_tablet_job;
602
extern BvarLatencyRecorderWithTag g_bvar_ms_update_delete_bitmap;
603
extern BvarLatencyRecorderWithTag g_bvar_ms_get_delete_bitmap;
604
extern BvarLatencyRecorderWithTag g_bvar_ms_get_delete_bitmap_update_lock;
605
extern BvarLatencyRecorderWithTag g_bvar_ms_remove_delete_bitmap;
606
extern BvarLatencyRecorderWithTag g_bvar_ms_remove_delete_bitmap_update_lock;
607
extern BvarLatencyRecorderWithTag g_bvar_ms_get_cluster_status;
608
extern BvarLatencyRecorderWithTag g_bvar_ms_set_cluster_status;
609
extern BvarLatencyRecorderWithTag g_bvar_ms_get_instance;
610
extern BvarLatencyRecorderWithTag g_bvar_ms_get_rl_task_commit_attach;
611
extern BvarLatencyRecorderWithTag g_bvar_ms_get_streaming_task_commit_attach;
612
extern BvarLatencyRecorderWithTag g_bvar_ms_delete_streaming_job;
613
extern BvarLatencyRecorderWithTag g_bvar_ms_reset_streaming_job_offset;
614
extern BvarLatencyRecorderWithTag g_bvar_ms_reset_rl_progress;
615
extern BvarLatencyRecorderWithTag g_bvar_ms_get_txn_id;
616
extern BvarLatencyRecorderWithTag g_bvar_ms_check_kv;
617
extern BvarLatencyRecorderWithTag g_bvar_ms_get_schema_dict;
618
extern BvarLatencyRecorderWithTag g_bvar_ms_begin_snapshot;
619
extern BvarLatencyRecorderWithTag g_bvar_ms_update_snapshot;
620
extern BvarLatencyRecorderWithTag g_bvar_ms_commit_snapshot;
621
extern BvarLatencyRecorderWithTag g_bvar_ms_abort_snapshot;
622
extern BvarLatencyRecorderWithTag g_bvar_ms_drop_snapshot;
623
extern BvarLatencyRecorderWithTag g_bvar_ms_list_snapshot;
624
extern BvarLatencyRecorderWithTag g_bvar_ms_clone_instance;
625
extern BvarLatencyRecorderWithTag g_bvar_ms_compact_snapshot;
626
extern BvarLatencyRecorderWithTag g_bvar_ms_update_packed_file_info;
627
extern bvar::Adder<int64_t> g_bvar_ms_rate_limit_trigger_fdb_cluster;
628
extern bvar::Adder<int64_t> g_bvar_ms_rate_limit_trigger_fdb_client_thread;
629
extern bvar::Adder<int64_t> g_bvar_ms_rate_limit_trigger_ms_resource;
630
extern bvar::Adder<int64_t> g_bvar_ms_rate_limit_trigger_test_injection;
631
extern bvar::Status<int64_t> g_bvar_ms_cpu_usage_percent;
632
extern bvar::Status<int64_t> g_bvar_ms_memory_usage_percent;
633
extern bvar::Adder<int64_t> g_bvar_update_delete_bitmap_fail_counter;
634
extern bvar::Adder<int64_t> g_bvar_get_delete_bitmap_fail_counter;
635
extern BvarLatencyRecorderWithStatus<60> g_bvar_ms_txn_commit_with_tablet_count;
636
extern BvarLatencyRecorderWithStatus<60> g_bvar_ms_txn_commit_with_partition_count;
637
extern MBvarLatencyRecorderWithStatus<60> g_bvar_instance_txn_commit_with_partition_count;
638
extern MBvarLatencyRecorderWithStatus<60> g_bvar_instance_txn_commit_with_tablet_count;
639
extern bvar::LatencyRecorder g_bvar_ms_scan_instance_update;
640
extern bvar::LatencyRecorder g_bvar_txn_lazy_committer_waiting_duration;
641
extern bvar::LatencyRecorder g_bvar_txn_lazy_committer_committing_duration;
642
extern bvar::LatencyRecorder g_bvar_txn_lazy_committer_commit_partition_duration;
643
extern bvar::Adder<int64_t> g_bvar_txn_lazy_committer_submitted;
644
extern bvar::Adder<int64_t> g_bvar_txn_lazy_committer_finished;
645
646
// recycler's bvars
647
extern BvarStatusWithTag<int64_t> g_bvar_recycler_recycle_index_earlest_ts;
648
extern BvarStatusWithTag<int64_t> g_bvar_recycler_recycle_partition_earlest_ts;
649
extern BvarStatusWithTag<int64_t> g_bvar_recycler_recycle_rowset_earlest_ts;
650
extern BvarStatusWithTag<int64_t> g_bvar_recycler_recycle_tmp_rowset_earlest_ts;
651
extern BvarStatusWithTag<int64_t> g_bvar_recycler_recycle_expired_txn_label_earlest_ts;
652
extern BvarStatusWithTag<int64_t> g_bvar_recycler_recycle_restore_job_earlest_ts;
653
654
// recycler's mbvars
655
extern bvar::Status<int64_t> g_bvar_recycler_task_max_concurrency;
656
extern mBvarIntAdder g_bvar_recycler_instance_recycle_task_status;
657
extern mBvarStatus<int64_t> g_bvar_recycler_instance_last_round_recycle_duration;
658
extern mBvarStatus<int64_t> g_bvar_recycler_instance_next_ts;
659
extern mBvarStatus<int64_t> g_bvar_recycler_instance_recycle_start_ts;
660
extern mBvarStatus<int64_t> g_bvar_recycler_instance_recycle_end_ts;
661
extern mBvarStatus<int64_t> g_bvar_recycler_instance_recycle_last_success_ts;
662
663
extern mBvarIntAdder g_bvar_recycler_vault_recycle_task_status;
664
extern mBvarStatus<int64_t> g_bvar_recycler_instance_last_round_recycled_num;
665
extern mBvarStatus<int64_t> g_bvar_recycler_instance_last_round_to_recycle_num;
666
extern mBvarStatus<int64_t> g_bvar_recycler_instance_last_round_recycled_bytes;
667
extern mBvarStatus<int64_t> g_bvar_recycler_instance_last_round_to_recycle_bytes;
668
extern mBvarStatus<double> g_bvar_recycler_instance_last_round_recycle_elpased_ts;
669
extern mBvarInt64Adder g_bvar_recycler_instance_recycle_total_num_since_started;
670
extern mBvarInt64Adder g_bvar_recycler_instance_recycle_total_bytes_since_started;
671
extern mBvarIntAdder g_bvar_recycler_instance_recycle_round;
672
extern mBvarStatus<double> g_bvar_recycler_instance_recycle_time_per_resource;
673
extern mBvarStatus<double> g_bvar_recycler_instance_recycle_bytes_per_ms;
674
extern BvarStatusWithTag<int64_t> g_bvar_recycler_packed_file_recycled_kv_num;
675
extern BvarStatusWithTag<int64_t> g_bvar_recycler_packed_file_recycled_kv_bytes;
676
extern BvarStatusWithTag<int64_t> g_bvar_recycler_packed_file_recycle_cost_ms;
677
extern BvarStatusWithTag<int64_t> g_bvar_recycler_packed_file_scanned_kv_num;
678
extern BvarStatusWithTag<int64_t> g_bvar_recycler_packed_file_corrected_kv_num;
679
extern BvarStatusWithTag<int64_t> g_bvar_recycler_packed_file_recycled_object_num;
680
681
extern BvarStatusWithTag<int64_t> g_bvar_recycler_batch_delete_rowset_plan_count;
682
extern BvarStatusWithTag<int64_t> g_bvar_recycler_batch_delete_failures;
683
extern BvarStatusWithTag<int64_t> g_bvar_recycler_packed_file_bytes_object_deleted;
684
extern BvarStatusWithTag<int64_t> g_bvar_recycler_packed_file_rowset_scanned_num;
685
686
// Operation Log Recycler BVars
687
// Note: generic metrics (last_round_to_recycle_num/bytes, last_round_recycled_num/bytes, etc.)
688
// are reported by RecyclerMetricsContext with operation_type = "recycle_operation_logs".
689
extern mBvarStatus<int64_t> g_bvar_recycler_oplog_last_round_total_num;
690
extern mBvarStatus<int64_t> g_bvar_recycler_oplog_last_round_not_recycled_num;
691
extern mBvarIntAdder g_bvar_recycler_oplog_recycle_failed_num;
692
extern mBvarStatus<int64_t> g_bvar_recycler_oplog_last_round_recycled_commit_partition_num;
693
extern mBvarStatus<int64_t> g_bvar_recycler_oplog_last_round_recycled_drop_partition_num;
694
extern mBvarStatus<int64_t> g_bvar_recycler_oplog_last_round_recycled_commit_index_num;
695
extern mBvarStatus<int64_t> g_bvar_recycler_oplog_last_round_recycled_drop_index_num;
696
extern mBvarStatus<int64_t> g_bvar_recycler_oplog_last_round_recycled_update_tablet_num;
697
extern mBvarStatus<int64_t> g_bvar_recycler_oplog_last_round_recycled_compaction_num;
698
extern mBvarStatus<int64_t> g_bvar_recycler_oplog_last_round_recycled_schema_change_num;
699
extern mBvarStatus<int64_t> g_bvar_recycler_oplog_last_round_recycled_commit_txn_num;
700
extern mBvarIntAdder g_bvar_recycler_oplog_recycled_commit_partition_num;
701
extern mBvarIntAdder g_bvar_recycler_oplog_recycled_drop_partition_num;
702
extern mBvarIntAdder g_bvar_recycler_oplog_recycled_commit_index_num;
703
extern mBvarIntAdder g_bvar_recycler_oplog_recycled_drop_index_num;
704
extern mBvarIntAdder g_bvar_recycler_oplog_recycled_update_tablet_num;
705
extern mBvarIntAdder g_bvar_recycler_oplog_recycled_compaction_num;
706
extern mBvarIntAdder g_bvar_recycler_oplog_recycled_schema_change_num;
707
extern mBvarIntAdder g_bvar_recycler_oplog_recycled_commit_txn_num;
708
709
// txn_kv's bvars
710
extern bvar::LatencyRecorder g_bvar_txn_kv_get;
711
extern bvar::LatencyRecorder g_bvar_txn_kv_range_get;
712
extern bvar::LatencyRecorder g_bvar_txn_kv_put;
713
extern bvar::LatencyRecorder g_bvar_txn_kv_commit;
714
extern bvar::LatencyRecorder g_bvar_txn_kv_watch_key;
715
extern bvar::LatencyRecorder g_bvar_txn_kv_atomic_set_ver_key;
716
extern bvar::LatencyRecorder g_bvar_txn_kv_atomic_set_ver_value;
717
extern bvar::LatencyRecorder g_bvar_txn_kv_atomic_add;
718
extern bvar::LatencyRecorder g_bvar_txn_kv_remove;
719
extern bvar::LatencyRecorder g_bvar_txn_kv_range_remove;
720
extern bvar::LatencyRecorder g_bvar_txn_kv_get_read_version;
721
extern bvar::LatencyRecorder g_bvar_txn_kv_get_committed_version;
722
extern bvar::LatencyRecorder g_bvar_txn_kv_batch_get;
723
724
extern bvar::Adder<int64_t> g_bvar_txn_kv_commit_error_counter;
725
extern bvar::Adder<int64_t> g_bvar_txn_kv_commit_conflict_counter;
726
extern bvar::Adder<int64_t> g_bvar_txn_kv_get_count_normalized;
727
728
extern bvar::Adder<int64_t> g_bvar_delete_bitmap_lock_txn_put_conflict_counter;
729
extern bvar::Adder<int64_t> g_bvar_delete_bitmap_lock_txn_remove_conflict_by_fail_counter;
730
extern bvar::Adder<int64_t> g_bvar_delete_bitmap_lock_txn_remove_conflict_by_load_counter;
731
extern bvar::Adder<int64_t>
732
        g_bvar_delete_bitmap_lock_txn_remove_conflict_by_compaction_commit_counter;
733
extern bvar::Adder<int64_t>
734
        g_bvar_delete_bitmap_lock_txn_remove_conflict_by_compaction_lease_counter;
735
extern bvar::Adder<int64_t>
736
        g_bvar_delete_bitmap_lock_txn_remove_conflict_by_compaction_abort_counter;
737
738
extern const int64_t BVAR_FDB_INVALID_VALUE;
739
extern bvar::Status<int64_t> g_bvar_fdb_client_count;
740
extern bvar::Status<int64_t> g_bvar_fdb_configuration_coordinators_count;
741
extern bvar::Status<int64_t> g_bvar_fdb_configuration_usable_regions;
742
extern bvar::Status<int64_t> g_bvar_fdb_coordinators_unreachable_count;
743
extern bvar::Status<int64_t> g_bvar_fdb_fault_tolerance_count;
744
extern bvar::Status<int64_t> g_bvar_fdb_data_average_partition_size_bytes;
745
extern bvar::Status<int64_t> g_bvar_fdb_data_log_server_space_bytes;
746
extern bvar::Status<int64_t> g_bvar_fdb_data_moving_data_highest_priority;
747
extern bvar::Status<int64_t> g_bvar_fdb_data_moving_data_in_flight_bytes;
748
extern bvar::Status<int64_t> g_bvar_fdb_data_moving_data_in_queue_bytes;
749
extern bvar::Status<int64_t> g_bvar_fdb_data_moving_total_written_bytes;
750
extern bvar::Status<int64_t> g_bvar_fdb_data_partition_count;
751
extern bvar::Status<int64_t> g_bvar_fdb_data_storage_server_space_bytes;
752
extern bvar::Status<int64_t> g_bvar_fdb_data_state_min_replicas_remaining;
753
extern bvar::Status<int64_t> g_bvar_fdb_data_total_kv_size_bytes;
754
extern bvar::Status<int64_t> g_bvar_fdb_data_total_disk_used_bytes;
755
extern bvar::Status<int64_t> g_bvar_fdb_generation;
756
extern bvar::Status<int64_t> g_bvar_fdb_incompatible_connections;
757
extern bvar::Status<int64_t> g_bvar_fdb_latency_probe_transaction_start_ns;
758
extern bvar::Status<int64_t> g_bvar_fdb_latency_probe_commit_ns;
759
extern bvar::Status<int64_t> g_bvar_fdb_latency_probe_read_ns;
760
extern bvar::Status<int64_t> g_bvar_fdb_performance_limited_by_name;
761
extern bvar::Status<int64_t> g_bvar_fdb_machines_count;
762
extern bvar::Status<int64_t> g_bvar_fdb_process_count;
763
extern bvar::Status<int64_t> g_bvar_fdb_qos_worst_data_lag_storage_server_ns;
764
extern bvar::Status<int64_t> g_bvar_fdb_qos_worst_durability_lag_storage_server_ns;
765
extern bvar::Status<int64_t> g_bvar_fdb_qos_worst_log_server_queue_bytes;
766
extern bvar::Status<int64_t> g_bvar_fdb_qos_worst_storage_server_queue_bytes;
767
extern bvar::Status<int64_t> g_bvar_fdb_client_thread_busyness_percent;
768
extern mBvarStatus<double> g_bvar_fdb_cluster_processes;
769
extern mBvarStatus<double> g_bvar_fdb_cluster_workload;
770
771
// checker
772
extern BvarStatusWithTag<long> g_bvar_checker_num_scanned;
773
extern BvarStatusWithTag<long> g_bvar_checker_num_scanned_with_segment;
774
extern BvarStatusWithTag<long> g_bvar_checker_num_check_failed;
775
extern BvarStatusWithTag<long> g_bvar_checker_check_cost_s;
776
extern BvarStatusWithTag<long> g_bvar_checker_enqueue_cost_s;
777
extern BvarStatusWithTag<long> g_bvar_checker_last_success_time_ms;
778
extern BvarStatusWithTag<long> g_bvar_checker_instance_volume;
779
extern BvarStatusWithTag<long> g_bvar_inverted_checker_num_scanned;
780
extern BvarStatusWithTag<long> g_bvar_inverted_checker_num_check_failed;
781
782
extern BvarStatusWithTag<int64_t> g_bvar_inverted_checker_leaked_delete_bitmaps;
783
extern BvarStatusWithTag<int64_t> g_bvar_inverted_checker_abnormal_delete_bitmaps;
784
extern BvarStatusWithTag<int64_t> g_bvar_inverted_checker_delete_bitmaps_scanned;
785
extern BvarStatusWithTag<int64_t> g_bvar_max_rowsets_with_useless_delete_bitmap_version;
786
787
extern BvarStatusWithTag<int64_t> g_bvar_checker_restore_job_prepared_state;
788
extern BvarStatusWithTag<int64_t> g_bvar_checker_restore_job_committed_state;
789
extern BvarStatusWithTag<int64_t> g_bvar_checker_restore_job_dropped_state;
790
extern BvarStatusWithTag<int64_t> g_bvar_checker_restore_job_completed_state;
791
extern BvarStatusWithTag<int64_t> g_bvar_checker_restore_job_recycling_state;
792
extern BvarStatusWithTag<int64_t> g_bvar_checker_restore_job_cost_many_time;
793
794
// rpc kv
795
extern mBvarInt64Adder g_bvar_rpc_kv_get_rowset_get_counter;
796
extern mBvarInt64Adder g_bvar_rpc_kv_get_version_get_counter;
797
extern mBvarInt64Adder g_bvar_rpc_kv_get_table_stream_offset_get_counter;
798
extern mBvarInt64Adder g_bvar_rpc_kv_get_schema_dict_get_counter;
799
extern mBvarInt64Adder g_bvar_rpc_kv_create_tablets_get_counter;
800
extern mBvarInt64Adder g_bvar_rpc_kv_create_tablets_put_counter;
801
extern mBvarInt64Adder g_bvar_rpc_kv_update_tablet_get_counter;
802
extern mBvarInt64Adder g_bvar_rpc_kv_update_tablet_put_counter;
803
extern mBvarInt64Adder g_bvar_rpc_kv_get_tablet_get_counter;
804
extern mBvarInt64Adder g_bvar_rpc_kv_prepare_rowset_get_counter;
805
extern mBvarInt64Adder g_bvar_rpc_kv_prepare_rowset_put_counter;
806
extern mBvarInt64Adder g_bvar_rpc_kv_commit_rowset_get_counter;
807
extern mBvarInt64Adder g_bvar_rpc_kv_commit_rowset_put_counter;
808
extern mBvarInt64Adder g_bvar_rpc_kv_commit_rowset_del_counter;
809
extern mBvarInt64Adder g_bvar_rpc_kv_update_tmp_rowset_get_counter;
810
extern mBvarInt64Adder g_bvar_rpc_kv_update_tmp_rowset_put_counter;
811
extern mBvarInt64Adder g_bvar_rpc_kv_get_tablet_stats_get_counter;
812
extern mBvarInt64Adder g_bvar_rpc_kv_update_delete_bitmap_get_counter;
813
extern mBvarInt64Adder g_bvar_rpc_kv_update_delete_bitmap_put_counter;
814
extern mBvarInt64Adder g_bvar_rpc_kv_update_delete_bitmap_del_counter;
815
extern mBvarInt64Adder g_bvar_rpc_kv_get_delete_bitmap_get_counter;
816
extern mBvarInt64Adder g_bvar_rpc_kv_get_delete_bitmap_update_lock_get_counter;
817
extern mBvarInt64Adder g_bvar_rpc_kv_get_delete_bitmap_update_lock_put_counter;
818
extern mBvarInt64Adder g_bvar_rpc_kv_get_delete_bitmap_update_lock_del_counter;
819
extern mBvarInt64Adder g_bvar_rpc_kv_remove_delete_bitmap_update_lock_get_counter;
820
extern mBvarInt64Adder g_bvar_rpc_kv_remove_delete_bitmap_update_lock_put_counter;
821
extern mBvarInt64Adder g_bvar_rpc_kv_remove_delete_bitmap_update_lock_del_counter;
822
extern mBvarInt64Adder g_bvar_rpc_kv_remove_delete_bitmap_del_counter;
823
extern mBvarInt64Adder g_bvar_rpc_kv_start_tablet_job_get_counter;
824
extern mBvarInt64Adder g_bvar_rpc_kv_start_tablet_job_put_counter;
825
extern mBvarInt64Adder g_bvar_rpc_kv_finish_tablet_job_get_counter;
826
extern mBvarInt64Adder g_bvar_rpc_kv_finish_tablet_job_put_counter;
827
extern mBvarInt64Adder g_bvar_rpc_kv_finish_tablet_job_del_counter;
828
extern mBvarInt64Adder g_bvar_rpc_kv_prepare_index_get_counter;
829
extern mBvarInt64Adder g_bvar_rpc_kv_prepare_index_put_counter;
830
extern mBvarInt64Adder g_bvar_rpc_kv_commit_index_get_counter;
831
extern mBvarInt64Adder g_bvar_rpc_kv_commit_index_put_counter;
832
extern mBvarInt64Adder g_bvar_rpc_kv_commit_index_del_counter;
833
extern mBvarInt64Adder g_bvar_rpc_kv_drop_index_get_counter;
834
extern mBvarInt64Adder g_bvar_rpc_kv_drop_index_put_counter;
835
extern mBvarInt64Adder g_bvar_rpc_kv_prepare_partition_get_counter;
836
extern mBvarInt64Adder g_bvar_rpc_kv_prepare_partition_put_counter;
837
extern mBvarInt64Adder g_bvar_rpc_kv_commit_partition_get_counter;
838
extern mBvarInt64Adder g_bvar_rpc_kv_commit_partition_put_counter;
839
extern mBvarInt64Adder g_bvar_rpc_kv_commit_partition_del_counter;
840
extern mBvarInt64Adder g_bvar_rpc_kv_drop_partition_get_counter;
841
extern mBvarInt64Adder g_bvar_rpc_kv_drop_partition_put_counter;
842
extern mBvarInt64Adder g_bvar_rpc_kv_prepare_restore_job_get_counter;
843
extern mBvarInt64Adder g_bvar_rpc_kv_prepare_restore_job_put_counter;
844
extern mBvarInt64Adder g_bvar_rpc_kv_commit_restore_job_get_counter;
845
extern mBvarInt64Adder g_bvar_rpc_kv_commit_restore_job_put_counter;
846
extern mBvarInt64Adder g_bvar_rpc_kv_finish_restore_job_get_counter;
847
extern mBvarInt64Adder g_bvar_rpc_kv_finish_restore_job_put_counter;
848
extern mBvarInt64Adder g_bvar_rpc_kv_check_kv_get_counter;
849
extern mBvarInt64Adder g_bvar_rpc_kv_get_obj_store_info_get_counter;
850
extern mBvarInt64Adder g_bvar_rpc_kv_alter_storage_vault_get_counter;
851
extern mBvarInt64Adder g_bvar_rpc_kv_alter_storage_vault_put_counter;
852
extern mBvarInt64Adder g_bvar_rpc_kv_alter_storage_vault_del_counter;
853
extern mBvarInt64Adder g_bvar_rpc_kv_alter_obj_store_info_get_counter;
854
extern mBvarInt64Adder g_bvar_rpc_kv_alter_obj_store_info_put_counter;
855
extern mBvarInt64Adder g_bvar_rpc_kv_update_ak_sk_get_counter;
856
extern mBvarInt64Adder g_bvar_rpc_kv_update_ak_sk_put_counter;
857
extern mBvarInt64Adder g_bvar_rpc_kv_create_instance_get_counter;
858
extern mBvarInt64Adder g_bvar_rpc_kv_create_instance_put_counter;
859
extern mBvarInt64Adder g_bvar_rpc_kv_get_instance_get_counter;
860
extern mBvarInt64Adder g_bvar_rpc_kv_alter_cluster_get_counter;
861
extern mBvarInt64Adder g_bvar_rpc_kv_get_cluster_get_counter;
862
extern mBvarInt64Adder g_bvar_rpc_kv_get_cluster_put_counter;
863
extern mBvarInt64Adder g_bvar_rpc_kv_create_stage_get_counter;
864
extern mBvarInt64Adder g_bvar_rpc_kv_create_stage_put_counter;
865
extern mBvarInt64Adder g_bvar_rpc_kv_get_stage_get_counter;
866
extern mBvarInt64Adder g_bvar_rpc_kv_get_iam_get_counter;
867
extern mBvarInt64Adder g_bvar_rpc_kv_alter_iam_get_counter;
868
extern mBvarInt64Adder g_bvar_rpc_kv_alter_iam_put_counter;
869
extern mBvarInt64Adder g_bvar_rpc_kv_alter_ram_user_get_counter;
870
extern mBvarInt64Adder g_bvar_rpc_kv_alter_ram_user_put_counter;
871
extern mBvarInt64Adder g_bvar_rpc_kv_begin_copy_get_counter;
872
extern mBvarInt64Adder g_bvar_rpc_kv_begin_copy_put_counter;
873
extern mBvarInt64Adder g_bvar_rpc_kv_finish_copy_get_counter;
874
extern mBvarInt64Adder g_bvar_rpc_kv_finish_copy_put_counter;
875
extern mBvarInt64Adder g_bvar_rpc_kv_finish_copy_del_counter;
876
extern mBvarInt64Adder g_bvar_rpc_kv_get_copy_job_get_counter;
877
extern mBvarInt64Adder g_bvar_rpc_kv_get_copy_files_get_counter;
878
extern mBvarInt64Adder g_bvar_rpc_kv_filter_copy_files_get_counter;
879
extern mBvarInt64Adder g_bvar_rpc_kv_get_cluster_status_get_counter;
880
extern mBvarInt64Adder g_bvar_rpc_kv_begin_txn_get_counter;
881
extern mBvarInt64Adder g_bvar_rpc_kv_begin_txn_put_counter;
882
extern mBvarInt64Adder g_bvar_rpc_kv_precommit_txn_get_counter;
883
extern mBvarInt64Adder g_bvar_rpc_kv_precommit_txn_put_counter;
884
extern mBvarInt64Adder g_bvar_rpc_kv_get_rl_task_commit_attach_get_counter;
885
extern mBvarInt64Adder g_bvar_rpc_kv_get_streaming_task_commit_attach_get_counter;
886
extern mBvarInt64Adder g_bvar_rpc_kv_delete_streaming_job_del_counter;
887
extern mBvarInt64Adder g_bvar_rpc_kv_reset_streaming_job_offset_get_counter;
888
extern mBvarInt64Adder g_bvar_rpc_kv_reset_streaming_job_offset_put_counter;
889
extern mBvarInt64Adder g_bvar_rpc_kv_reset_streaming_job_offset_del_counter;
890
extern mBvarInt64Adder g_bvar_rpc_kv_reset_rl_progress_get_counter;
891
extern mBvarInt64Adder g_bvar_rpc_kv_reset_rl_progress_put_counter;
892
extern mBvarInt64Adder g_bvar_rpc_kv_reset_rl_progress_del_counter;
893
extern mBvarInt64Adder g_bvar_rpc_kv_commit_txn_get_counter;
894
extern mBvarInt64Adder g_bvar_rpc_kv_commit_txn_put_counter;
895
extern mBvarInt64Adder g_bvar_rpc_kv_commit_txn_del_counter;
896
extern mBvarInt64Adder g_bvar_rpc_kv_abort_txn_get_counter;
897
extern mBvarInt64Adder g_bvar_rpc_kv_abort_txn_put_counter;
898
extern mBvarInt64Adder g_bvar_rpc_kv_abort_txn_del_counter;
899
extern mBvarInt64Adder g_bvar_rpc_kv_get_txn_get_counter;
900
extern mBvarInt64Adder g_bvar_rpc_kv_get_current_max_txn_id_get_counter;
901
extern mBvarInt64Adder g_bvar_rpc_kv_create_meta_sync_point_del_counter;
902
extern mBvarInt64Adder g_bvar_rpc_kv_begin_sub_txn_get_counter;
903
extern mBvarInt64Adder g_bvar_rpc_kv_begin_sub_txn_put_counter;
904
extern mBvarInt64Adder g_bvar_rpc_kv_begin_sub_txn_del_counter;
905
extern mBvarInt64Adder g_bvar_rpc_kv_abort_sub_txn_get_counter;
906
extern mBvarInt64Adder g_bvar_rpc_kv_abort_sub_txn_put_counter;
907
extern mBvarInt64Adder g_bvar_rpc_kv_abort_txn_with_coordinator_get_counter;
908
extern mBvarInt64Adder g_bvar_rpc_kv_get_prepare_txn_by_coordinator_get_counter;
909
extern mBvarInt64Adder g_bvar_rpc_kv_check_txn_conflict_get_counter;
910
extern mBvarInt64Adder g_bvar_rpc_kv_clean_txn_label_get_counter;
911
extern mBvarInt64Adder g_bvar_rpc_kv_clean_txn_label_put_counter;
912
extern mBvarInt64Adder g_bvar_rpc_kv_clean_txn_label_del_counter;
913
extern mBvarInt64Adder g_bvar_rpc_kv_get_txn_id_get_counter;
914
extern mBvarInt64Adder g_bvar_rpc_kv_begin_snapshot_get_counter;
915
extern mBvarInt64Adder g_bvar_rpc_kv_begin_snapshot_put_counter;
916
extern mBvarInt64Adder g_bvar_rpc_kv_begin_snapshot_del_counter;
917
extern mBvarInt64Adder g_bvar_rpc_kv_update_snapshot_get_counter;
918
extern mBvarInt64Adder g_bvar_rpc_kv_update_snapshot_put_counter;
919
extern mBvarInt64Adder g_bvar_rpc_kv_update_snapshot_del_counter;
920
extern mBvarInt64Adder g_bvar_rpc_kv_commit_snapshot_get_counter;
921
extern mBvarInt64Adder g_bvar_rpc_kv_commit_snapshot_put_counter;
922
extern mBvarInt64Adder g_bvar_rpc_kv_commit_snapshot_del_counter;
923
extern mBvarInt64Adder g_bvar_rpc_kv_abort_snapshot_get_counter;
924
extern mBvarInt64Adder g_bvar_rpc_kv_abort_snapshot_put_counter;
925
extern mBvarInt64Adder g_bvar_rpc_kv_abort_snapshot_del_counter;
926
extern mBvarInt64Adder g_bvar_rpc_kv_list_snapshot_get_counter;
927
extern mBvarInt64Adder g_bvar_rpc_kv_list_snapshot_put_counter;
928
extern mBvarInt64Adder g_bvar_rpc_kv_list_snapshot_del_counter;
929
extern mBvarInt64Adder g_bvar_rpc_kv_drop_snapshot_get_counter;
930
extern mBvarInt64Adder g_bvar_rpc_kv_drop_snapshot_put_counter;
931
extern mBvarInt64Adder g_bvar_rpc_kv_drop_snapshot_del_counter;
932
extern mBvarInt64Adder g_bvar_rpc_kv_clone_instance_get_counter;
933
extern mBvarInt64Adder g_bvar_rpc_kv_clone_instance_put_counter;
934
extern mBvarInt64Adder g_bvar_rpc_kv_clone_instance_del_counter;
935
extern mBvarInt64Adder g_bvar_rpc_kv_compact_snapshot_get_counter;
936
extern mBvarInt64Adder g_bvar_rpc_kv_compact_snapshot_put_counter;
937
938
extern mBvarInt64Adder g_bvar_rpc_kv_get_rowset_get_bytes;
939
extern mBvarInt64Adder g_bvar_rpc_kv_get_version_get_bytes;
940
extern mBvarInt64Adder g_bvar_rpc_kv_get_table_stream_offset_get_bytes;
941
extern mBvarInt64Adder g_bvar_rpc_kv_get_schema_dict_get_bytes;
942
extern mBvarInt64Adder g_bvar_rpc_kv_create_tablets_get_bytes;
943
extern mBvarInt64Adder g_bvar_rpc_kv_create_tablets_put_bytes;
944
extern mBvarInt64Adder g_bvar_rpc_kv_update_tablet_get_bytes;
945
extern mBvarInt64Adder g_bvar_rpc_kv_update_tablet_put_bytes;
946
extern mBvarInt64Adder g_bvar_rpc_kv_get_tablet_get_bytes;
947
extern mBvarInt64Adder g_bvar_rpc_kv_prepare_rowset_get_bytes;
948
extern mBvarInt64Adder g_bvar_rpc_kv_prepare_rowset_put_bytes;
949
extern mBvarInt64Adder g_bvar_rpc_kv_commit_rowset_get_bytes;
950
extern mBvarInt64Adder g_bvar_rpc_kv_commit_rowset_put_bytes;
951
extern mBvarInt64Adder g_bvar_rpc_kv_commit_rowset_del_bytes;
952
extern mBvarInt64Adder g_bvar_rpc_kv_update_tmp_rowset_get_bytes;
953
extern mBvarInt64Adder g_bvar_rpc_kv_update_tmp_rowset_put_bytes;
954
extern mBvarInt64Adder g_bvar_rpc_kv_get_tablet_stats_get_bytes;
955
extern mBvarInt64Adder g_bvar_rpc_kv_update_delete_bitmap_get_bytes;
956
extern mBvarInt64Adder g_bvar_rpc_kv_update_delete_bitmap_put_bytes;
957
extern mBvarInt64Adder g_bvar_rpc_kv_update_delete_bitmap_del_bytes;
958
extern mBvarInt64Adder g_bvar_rpc_kv_get_delete_bitmap_get_bytes;
959
extern mBvarInt64Adder g_bvar_rpc_kv_get_delete_bitmap_update_lock_get_bytes;
960
extern mBvarInt64Adder g_bvar_rpc_kv_get_delete_bitmap_update_lock_put_bytes;
961
extern mBvarInt64Adder g_bvar_rpc_kv_get_delete_bitmap_update_lock_del_bytes;
962
extern mBvarInt64Adder g_bvar_rpc_kv_remove_delete_bitmap_update_lock_get_bytes;
963
extern mBvarInt64Adder g_bvar_rpc_kv_remove_delete_bitmap_update_lock_put_bytes;
964
extern mBvarInt64Adder g_bvar_rpc_kv_remove_delete_bitmap_update_lock_del_bytes;
965
extern mBvarInt64Adder g_bvar_rpc_kv_remove_delete_bitmap_del_bytes;
966
extern mBvarInt64Adder g_bvar_rpc_kv_start_tablet_job_get_bytes;
967
extern mBvarInt64Adder g_bvar_rpc_kv_start_tablet_job_put_bytes;
968
extern mBvarInt64Adder g_bvar_rpc_kv_finish_tablet_job_get_bytes;
969
extern mBvarInt64Adder g_bvar_rpc_kv_finish_tablet_job_put_bytes;
970
extern mBvarInt64Adder g_bvar_rpc_kv_finish_tablet_job_del_bytes;
971
extern mBvarInt64Adder g_bvar_rpc_kv_prepare_index_get_bytes;
972
extern mBvarInt64Adder g_bvar_rpc_kv_prepare_index_put_bytes;
973
extern mBvarInt64Adder g_bvar_rpc_kv_commit_index_get_bytes;
974
extern mBvarInt64Adder g_bvar_rpc_kv_commit_index_put_bytes;
975
extern mBvarInt64Adder g_bvar_rpc_kv_commit_index_del_bytes;
976
extern mBvarInt64Adder g_bvar_rpc_kv_drop_index_get_bytes;
977
extern mBvarInt64Adder g_bvar_rpc_kv_drop_index_put_bytes;
978
extern mBvarInt64Adder g_bvar_rpc_kv_prepare_partition_get_bytes;
979
extern mBvarInt64Adder g_bvar_rpc_kv_prepare_partition_put_bytes;
980
extern mBvarInt64Adder g_bvar_rpc_kv_commit_partition_get_bytes;
981
extern mBvarInt64Adder g_bvar_rpc_kv_commit_partition_put_bytes;
982
extern mBvarInt64Adder g_bvar_rpc_kv_commit_partition_del_bytes;
983
extern mBvarInt64Adder g_bvar_rpc_kv_drop_partition_get_bytes;
984
extern mBvarInt64Adder g_bvar_rpc_kv_drop_partition_put_bytes;
985
extern mBvarInt64Adder g_bvar_rpc_kv_prepare_restore_job_get_bytes;
986
extern mBvarInt64Adder g_bvar_rpc_kv_prepare_restore_job_put_bytes;
987
extern mBvarInt64Adder g_bvar_rpc_kv_commit_restore_job_get_bytes;
988
extern mBvarInt64Adder g_bvar_rpc_kv_commit_restore_job_put_bytes;
989
extern mBvarInt64Adder g_bvar_rpc_kv_finish_restore_job_get_bytes;
990
extern mBvarInt64Adder g_bvar_rpc_kv_finish_restore_job_put_bytes;
991
extern mBvarInt64Adder g_bvar_rpc_kv_check_kv_get_bytes;
992
extern mBvarInt64Adder g_bvar_rpc_kv_get_obj_store_info_get_bytes;
993
extern mBvarInt64Adder g_bvar_rpc_kv_alter_storage_vault_get_bytes;
994
extern mBvarInt64Adder g_bvar_rpc_kv_alter_storage_vault_put_bytes;
995
extern mBvarInt64Adder g_bvar_rpc_kv_alter_storage_vault_del_bytes;
996
extern mBvarInt64Adder g_bvar_rpc_kv_alter_obj_store_info_get_bytes;
997
extern mBvarInt64Adder g_bvar_rpc_kv_alter_obj_store_info_put_bytes;
998
extern mBvarInt64Adder g_bvar_rpc_kv_update_ak_sk_get_bytes;
999
extern mBvarInt64Adder g_bvar_rpc_kv_update_ak_sk_put_bytes;
1000
extern mBvarInt64Adder g_bvar_rpc_kv_create_instance_get_bytes;
1001
extern mBvarInt64Adder g_bvar_rpc_kv_create_instance_put_bytes;
1002
extern mBvarInt64Adder g_bvar_rpc_kv_get_instance_get_bytes;
1003
extern mBvarInt64Adder g_bvar_rpc_kv_alter_cluster_get_bytes;
1004
extern mBvarInt64Adder g_bvar_rpc_kv_get_cluster_get_bytes;
1005
extern mBvarInt64Adder g_bvar_rpc_kv_get_cluster_put_bytes;
1006
extern mBvarInt64Adder g_bvar_rpc_kv_create_stage_get_bytes;
1007
extern mBvarInt64Adder g_bvar_rpc_kv_create_stage_put_bytes;
1008
extern mBvarInt64Adder g_bvar_rpc_kv_get_stage_get_bytes;
1009
extern mBvarInt64Adder g_bvar_rpc_kv_get_iam_get_bytes;
1010
extern mBvarInt64Adder g_bvar_rpc_kv_alter_iam_get_bytes;
1011
extern mBvarInt64Adder g_bvar_rpc_kv_alter_iam_put_bytes;
1012
extern mBvarInt64Adder g_bvar_rpc_kv_alter_ram_user_get_bytes;
1013
extern mBvarInt64Adder g_bvar_rpc_kv_alter_ram_user_put_bytes;
1014
extern mBvarInt64Adder g_bvar_rpc_kv_begin_copy_get_bytes;
1015
extern mBvarInt64Adder g_bvar_rpc_kv_begin_copy_put_bytes;
1016
extern mBvarInt64Adder g_bvar_rpc_kv_finish_copy_get_bytes;
1017
extern mBvarInt64Adder g_bvar_rpc_kv_finish_copy_put_bytes;
1018
extern mBvarInt64Adder g_bvar_rpc_kv_finish_copy_del_bytes;
1019
extern mBvarInt64Adder g_bvar_rpc_kv_get_copy_job_get_bytes;
1020
extern mBvarInt64Adder g_bvar_rpc_kv_get_copy_files_get_bytes;
1021
extern mBvarInt64Adder g_bvar_rpc_kv_filter_copy_files_get_bytes;
1022
extern mBvarInt64Adder g_bvar_rpc_kv_get_cluster_status_get_bytes;
1023
extern mBvarInt64Adder g_bvar_rpc_kv_begin_txn_get_bytes;
1024
extern mBvarInt64Adder g_bvar_rpc_kv_begin_txn_put_bytes;
1025
extern mBvarInt64Adder g_bvar_rpc_kv_precommit_txn_get_bytes;
1026
extern mBvarInt64Adder g_bvar_rpc_kv_precommit_txn_put_bytes;
1027
extern mBvarInt64Adder g_bvar_rpc_kv_get_rl_task_commit_attach_get_bytes;
1028
extern mBvarInt64Adder g_bvar_rpc_kv_get_streaming_task_commit_attach_get_bytes;
1029
extern mBvarInt64Adder g_bvar_rpc_kv_delete_streaming_job_del_bytes;
1030
extern mBvarInt64Adder g_bvar_rpc_kv_reset_streaming_job_offset_get_bytes;
1031
extern mBvarInt64Adder g_bvar_rpc_kv_reset_streaming_job_offset_put_bytes;
1032
extern mBvarInt64Adder g_bvar_rpc_kv_reset_streaming_job_offset_del_bytes;
1033
extern mBvarInt64Adder g_bvar_rpc_kv_reset_rl_progress_get_bytes;
1034
extern mBvarInt64Adder g_bvar_rpc_kv_reset_rl_progress_put_bytes;
1035
extern mBvarInt64Adder g_bvar_rpc_kv_reset_rl_progress_del_bytes;
1036
extern mBvarInt64Adder g_bvar_rpc_kv_commit_txn_get_bytes;
1037
extern mBvarInt64Adder g_bvar_rpc_kv_commit_txn_put_bytes;
1038
extern mBvarInt64Adder g_bvar_rpc_kv_commit_txn_del_bytes;
1039
extern mBvarInt64Adder g_bvar_rpc_kv_abort_txn_get_bytes;
1040
extern mBvarInt64Adder g_bvar_rpc_kv_abort_txn_put_bytes;
1041
extern mBvarInt64Adder g_bvar_rpc_kv_abort_txn_del_bytes;
1042
extern mBvarInt64Adder g_bvar_rpc_kv_get_txn_get_bytes;
1043
extern mBvarInt64Adder g_bvar_rpc_kv_get_current_max_txn_id_get_bytes;
1044
extern mBvarInt64Adder g_bvar_rpc_kv_create_meta_sync_point_del_bytes;
1045
extern mBvarInt64Adder g_bvar_rpc_kv_begin_sub_txn_get_bytes;
1046
extern mBvarInt64Adder g_bvar_rpc_kv_begin_sub_txn_put_bytes;
1047
extern mBvarInt64Adder g_bvar_rpc_kv_begin_sub_txn_del_bytes;
1048
extern mBvarInt64Adder g_bvar_rpc_kv_abort_sub_txn_get_bytes;
1049
extern mBvarInt64Adder g_bvar_rpc_kv_abort_sub_txn_put_bytes;
1050
extern mBvarInt64Adder g_bvar_rpc_kv_abort_txn_with_coordinator_get_bytes;
1051
extern mBvarInt64Adder g_bvar_rpc_kv_get_prepare_txn_by_coordinator_get_bytes;
1052
extern mBvarInt64Adder g_bvar_rpc_kv_check_txn_conflict_get_bytes;
1053
extern mBvarInt64Adder g_bvar_rpc_kv_clean_txn_label_get_bytes;
1054
extern mBvarInt64Adder g_bvar_rpc_kv_clean_txn_label_put_bytes;
1055
extern mBvarInt64Adder g_bvar_rpc_kv_clean_txn_label_del_bytes;
1056
extern mBvarInt64Adder g_bvar_rpc_kv_get_txn_id_get_bytes;
1057
extern mBvarInt64Adder g_bvar_rpc_kv_begin_snapshot_get_bytes;
1058
extern mBvarInt64Adder g_bvar_rpc_kv_begin_snapshot_put_bytes;
1059
extern mBvarInt64Adder g_bvar_rpc_kv_begin_snapshot_del_bytes;
1060
extern mBvarInt64Adder g_bvar_rpc_kv_update_snapshot_get_bytes;
1061
extern mBvarInt64Adder g_bvar_rpc_kv_update_snapshot_put_bytes;
1062
extern mBvarInt64Adder g_bvar_rpc_kv_update_snapshot_del_bytes;
1063
extern mBvarInt64Adder g_bvar_rpc_kv_commit_snapshot_get_bytes;
1064
extern mBvarInt64Adder g_bvar_rpc_kv_commit_snapshot_put_bytes;
1065
extern mBvarInt64Adder g_bvar_rpc_kv_commit_snapshot_del_bytes;
1066
extern mBvarInt64Adder g_bvar_rpc_kv_abort_snapshot_get_bytes;
1067
extern mBvarInt64Adder g_bvar_rpc_kv_abort_snapshot_put_bytes;
1068
extern mBvarInt64Adder g_bvar_rpc_kv_abort_snapshot_del_bytes;
1069
extern mBvarInt64Adder g_bvar_rpc_kv_drop_snapshot_get_bytes;
1070
extern mBvarInt64Adder g_bvar_rpc_kv_drop_snapshot_put_bytes;
1071
extern mBvarInt64Adder g_bvar_rpc_kv_drop_snapshot_del_bytes;
1072
extern mBvarInt64Adder g_bvar_rpc_kv_list_snapshot_get_bytes;
1073
extern mBvarInt64Adder g_bvar_rpc_kv_list_snapshot_put_bytes;
1074
extern mBvarInt64Adder g_bvar_rpc_kv_list_snapshot_del_bytes;
1075
extern mBvarInt64Adder g_bvar_rpc_kv_clone_instance_get_bytes;
1076
extern mBvarInt64Adder g_bvar_rpc_kv_clone_instance_put_bytes;
1077
extern mBvarInt64Adder g_bvar_rpc_kv_clone_instance_del_bytes;
1078
extern mBvarInt64Adder g_bvar_rpc_kv_compact_snapshot_get_bytes;
1079
extern mBvarInt64Adder g_bvar_rpc_kv_compact_snapshot_put_bytes;
1080
1081
// meta ranges
1082
extern mBvarStatus<int64_t> g_bvar_fdb_kv_ranges_count;