Coverage Report

Created: 2026-03-14 18:33

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
be/src/common/metrics/doris_metrics.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 <jni.h>
21
22
#include <memory>
23
#include <set>
24
#include <string>
25
#include <vector>
26
27
#include "common/metrics/jvm_metrics.h"
28
#include "common/metrics/metrics.h"
29
#include "common/metrics/system_metrics.h"
30
31
namespace doris {
32
33
#define REGISTER_ENTITY_HOOK_METRIC(entity, owner, metric, func)                        \
34
543
    owner->metric = (UIntGauge*)(entity->register_metric<UIntGauge>(&METRIC_##metric)); \
35
9.25k
    entity->register_hook(#metric, [&]() { owner->metric->set_value(func()); });
storage_engine.cpp:_ZZN5doris13StorageEngineC1ERKNS_13EngineOptionsEENK3$_0clEv
Line
Count
Source
35
113
    entity->register_hook(#metric, [&]() { owner->metric->set_value(func()); });
broker_mgr.cpp:_ZZN5doris9BrokerMgrC1EPNS_7ExecEnvEENK3$_0clEv
Line
Count
Source
35
367
    entity->register_hook(#metric, [&]() { owner->metric->set_value(func()); });
external_scan_context_mgr.cpp:_ZZN5doris22ExternalScanContextMgrC1EPNS_7ExecEnvEENK3$_0clEv
Line
Count
Source
35
367
    entity->register_hook(#metric, [&]() { owner->metric->set_value(func()); });
result_buffer_mgr.cpp:_ZZN5doris15ResultBufferMgrC1EvENK3$_0clEv
Line
Count
Source
35
367
    entity->register_hook(#metric, [&]() { owner->metric->set_value(func()); });
result_queue_mgr.cpp:_ZZN5doris14ResultQueueMgrC1EvENK3$_0clEv
Line
Count
Source
35
367
    entity->register_hook(#metric, [&]() { owner->metric->set_value(func()); });
small_file_mgr.cpp:_ZZN5doris12SmallFileMgrC1EPNS_7ExecEnvERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEENK3$_0clEv
Line
Count
Source
35
367
    entity->register_hook(#metric, [&]() { owner->metric->set_value(func()); });
internal_service.cpp:_ZZN5doris16PInternalServiceC1EPNS_7ExecEnvEENK3$_0clEv
Line
Count
Source
35
367
    entity->register_hook(#metric, [&]() { owner->metric->set_value(func()); });
internal_service.cpp:_ZZN5doris16PInternalServiceC1EPNS_7ExecEnvEENK3$_1clEv
Line
Count
Source
35
367
    entity->register_hook(#metric, [&]() { owner->metric->set_value(func()); });
internal_service.cpp:_ZZN5doris16PInternalServiceC1EPNS_7ExecEnvEENK3$_2clEv
Line
Count
Source
35
367
    entity->register_hook(#metric, [&]() { owner->metric->set_value(func()); });
internal_service.cpp:_ZZN5doris16PInternalServiceC1EPNS_7ExecEnvEENK3$_3clEv
Line
Count
Source
35
367
    entity->register_hook(#metric, [&]() { owner->metric->set_value(func()); });
internal_service.cpp:_ZZN5doris16PInternalServiceC1EPNS_7ExecEnvEENK3$_4clEv
Line
Count
Source
35
367
    entity->register_hook(#metric, [&]() { owner->metric->set_value(func()); });
internal_service.cpp:_ZZN5doris16PInternalServiceC1EPNS_7ExecEnvEENK3$_5clEv
Line
Count
Source
35
367
    entity->register_hook(#metric, [&]() { owner->metric->set_value(func()); });
internal_service.cpp:_ZZN5doris16PInternalServiceC1EPNS_7ExecEnvEENK3$_6clEv
Line
Count
Source
35
367
    entity->register_hook(#metric, [&]() { owner->metric->set_value(func()); });
internal_service.cpp:_ZZN5doris16PInternalServiceC1EPNS_7ExecEnvEENK3$_7clEv
Line
Count
Source
35
367
    entity->register_hook(#metric, [&]() { owner->metric->set_value(func()); });
internal_service.cpp:_ZZN5doris16PInternalServiceC1EPNS_7ExecEnvEENK3$_8clEv
Line
Count
Source
35
367
    entity->register_hook(#metric, [&]() { owner->metric->set_value(func()); });
internal_service.cpp:_ZZN5doris16PInternalServiceC1EPNS_7ExecEnvEENK3$_9clEv
Line
Count
Source
35
367
    entity->register_hook(#metric, [&]() { owner->metric->set_value(func()); });
internal_service.cpp:_ZZN5doris16PInternalServiceC1EPNS_7ExecEnvEENK4$_10clEv
Line
Count
Source
35
367
    entity->register_hook(#metric, [&]() { owner->metric->set_value(func()); });
internal_service.cpp:_ZZN5doris16PInternalServiceC1EPNS_7ExecEnvEENK4$_11clEv
Line
Count
Source
35
367
    entity->register_hook(#metric, [&]() { owner->metric->set_value(func()); });
brpc_client_cache.cpp:_ZZN5doris15BrpcClientCacheINS_20PBackendService_StubEEC1ENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_S8_ENK3$_0clEv
Line
Count
Source
35
367
    entity->register_hook(#metric, [&]() { owner->metric->set_value(func()); });
brpc_client_cache.cpp:_ZZN5doris15BrpcClientCacheINS_20PBackendService_StubEEC1ENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_S8_ENK3$_1clEv
Line
Count
Source
35
367
    entity->register_hook(#metric, [&]() { owner->metric->set_value(func()); });
brpc_client_cache.cpp:_ZZN5doris15BrpcClientCacheINS_21PFunctionService_StubEEC1ENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_S8_ENK3$_0clEv
Line
Count
Source
35
367
    entity->register_hook(#metric, [&]() { owner->metric->set_value(func()); });
load_channel_mgr.cpp:_ZZN5doris14LoadChannelMgrC1EvENK3$_0clEv
Line
Count
Source
35
367
    entity->register_hook(#metric, [&]() { owner->metric->set_value(func()); });
tablets_channel.cpp:_ZZZN5doris18BaseTabletsChannelC1ERKNS_17TabletsChannelKeyERKNS_8UniqueIdEbPNS_14RuntimeProfileEENK3$_0clEvENKUlvE_clEv
Line
Count
Source
35
329
    entity->register_hook(#metric, [&]() { owner->metric->set_value(func()); });
memtable_memory_limiter.cpp:_ZZN5doris21MemTableMemoryLimiter4initElENK3$_0clEv
Line
Count
Source
35
367
    entity->register_hook(#metric, [&]() { owner->metric->set_value(func()); });
routine_load_task_executor.cpp:_ZZN5doris23RoutineLoadTaskExecutorC1EPNS_7ExecEnvEENK3$_0clEv
Line
Count
Source
35
367
    entity->register_hook(#metric, [&]() { owner->metric->set_value(func()); });
new_load_stream_mgr.cpp:_ZZN5doris16NewLoadStreamMgrC1EvENK3$_0clEv
Line
Count
Source
35
367
    entity->register_hook(#metric, [&]() { owner->metric->set_value(func()); });
storage_engine.cpp:_ZZZN5doris13StorageEngineC1ERKNS_13EngineOptionsEENK3$_0clEvENKUlvE_clEv
Line
Count
Source
35
113
    entity->register_hook(#metric, [&]() { owner->metric->set_value(func()); });
broker_mgr.cpp:_ZZZN5doris9BrokerMgrC1EPNS_7ExecEnvEENK3$_0clEvENKUlvE_clEv
Line
Count
Source
35
367
    entity->register_hook(#metric, [&]() { owner->metric->set_value(func()); });
external_scan_context_mgr.cpp:_ZZZN5doris22ExternalScanContextMgrC1EPNS_7ExecEnvEENK3$_0clEvENKUlvE_clEv
Line
Count
Source
35
367
    entity->register_hook(#metric, [&]() { owner->metric->set_value(func()); });
result_buffer_mgr.cpp:_ZZZN5doris15ResultBufferMgrC1EvENK3$_0clEvENKUlvE_clEv
Line
Count
Source
35
367
    entity->register_hook(#metric, [&]() { owner->metric->set_value(func()); });
result_queue_mgr.cpp:_ZZZN5doris14ResultQueueMgrC1EvENK3$_0clEvENKUlvE_clEv
Line
Count
Source
35
367
    entity->register_hook(#metric, [&]() { owner->metric->set_value(func()); });
small_file_mgr.cpp:_ZZZN5doris12SmallFileMgrC1EPNS_7ExecEnvERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEENK3$_0clEvENKUlvE_clEv
Line
Count
Source
35
367
    entity->register_hook(#metric, [&]() { owner->metric->set_value(func()); });
internal_service.cpp:_ZZZN5doris16PInternalServiceC1EPNS_7ExecEnvEENK3$_0clEvENKUlvE_clEv
Line
Count
Source
35
367
    entity->register_hook(#metric, [&]() { owner->metric->set_value(func()); });
internal_service.cpp:_ZZZN5doris16PInternalServiceC1EPNS_7ExecEnvEENK3$_1clEvENKUlvE_clEv
Line
Count
Source
35
367
    entity->register_hook(#metric, [&]() { owner->metric->set_value(func()); });
internal_service.cpp:_ZZZN5doris16PInternalServiceC1EPNS_7ExecEnvEENK3$_2clEvENKUlvE_clEv
Line
Count
Source
35
367
    entity->register_hook(#metric, [&]() { owner->metric->set_value(func()); });
internal_service.cpp:_ZZZN5doris16PInternalServiceC1EPNS_7ExecEnvEENK3$_3clEvENKUlvE_clEv
Line
Count
Source
35
367
    entity->register_hook(#metric, [&]() { owner->metric->set_value(func()); });
internal_service.cpp:_ZZZN5doris16PInternalServiceC1EPNS_7ExecEnvEENK3$_4clEvENKUlvE_clEv
Line
Count
Source
35
367
    entity->register_hook(#metric, [&]() { owner->metric->set_value(func()); });
internal_service.cpp:_ZZZN5doris16PInternalServiceC1EPNS_7ExecEnvEENK3$_5clEvENKUlvE_clEv
Line
Count
Source
35
367
    entity->register_hook(#metric, [&]() { owner->metric->set_value(func()); });
internal_service.cpp:_ZZZN5doris16PInternalServiceC1EPNS_7ExecEnvEENK3$_6clEvENKUlvE_clEv
Line
Count
Source
35
367
    entity->register_hook(#metric, [&]() { owner->metric->set_value(func()); });
internal_service.cpp:_ZZZN5doris16PInternalServiceC1EPNS_7ExecEnvEENK3$_7clEvENKUlvE_clEv
Line
Count
Source
35
367
    entity->register_hook(#metric, [&]() { owner->metric->set_value(func()); });
internal_service.cpp:_ZZZN5doris16PInternalServiceC1EPNS_7ExecEnvEENK3$_8clEvENKUlvE_clEv
Line
Count
Source
35
367
    entity->register_hook(#metric, [&]() { owner->metric->set_value(func()); });
internal_service.cpp:_ZZZN5doris16PInternalServiceC1EPNS_7ExecEnvEENK3$_9clEvENKUlvE_clEv
Line
Count
Source
35
367
    entity->register_hook(#metric, [&]() { owner->metric->set_value(func()); });
internal_service.cpp:_ZZZN5doris16PInternalServiceC1EPNS_7ExecEnvEENK4$_10clEvENKUlvE_clEv
Line
Count
Source
35
367
    entity->register_hook(#metric, [&]() { owner->metric->set_value(func()); });
internal_service.cpp:_ZZZN5doris16PInternalServiceC1EPNS_7ExecEnvEENK4$_11clEvENKUlvE_clEv
Line
Count
Source
35
367
    entity->register_hook(#metric, [&]() { owner->metric->set_value(func()); });
brpc_client_cache.cpp:_ZZZN5doris15BrpcClientCacheINS_20PBackendService_StubEEC1ENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_S8_ENK3$_0clEvENKUlvE_clEv
Line
Count
Source
35
367
    entity->register_hook(#metric, [&]() { owner->metric->set_value(func()); });
brpc_client_cache.cpp:_ZZZN5doris15BrpcClientCacheINS_20PBackendService_StubEEC1ENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_S8_ENK3$_1clEvENKUlvE_clEv
Line
Count
Source
35
367
    entity->register_hook(#metric, [&]() { owner->metric->set_value(func()); });
brpc_client_cache.cpp:_ZZZN5doris15BrpcClientCacheINS_21PFunctionService_StubEEC1ENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_S8_ENK3$_0clEvENKUlvE_clEv
Line
Count
Source
35
367
    entity->register_hook(#metric, [&]() { owner->metric->set_value(func()); });
load_channel_mgr.cpp:_ZZZN5doris14LoadChannelMgrC1EvENK3$_0clEvENKUlvE_clEv
Line
Count
Source
35
367
    entity->register_hook(#metric, [&]() { owner->metric->set_value(func()); });
tablets_channel.cpp:_ZZZZN5doris18BaseTabletsChannelC1ERKNS_17TabletsChannelKeyERKNS_8UniqueIdEbPNS_14RuntimeProfileEENK3$_0clEvENKUlvE_clEvENKUlvE_clEv
Line
Count
Source
35
329
    entity->register_hook(#metric, [&]() { owner->metric->set_value(func()); });
memtable_memory_limiter.cpp:_ZZZN5doris21MemTableMemoryLimiter4initElENK3$_0clEvENKUlvE_clEv
Line
Count
Source
35
367
    entity->register_hook(#metric, [&]() { owner->metric->set_value(func()); });
routine_load_task_executor.cpp:_ZZZN5doris23RoutineLoadTaskExecutorC1EPNS_7ExecEnvEENK3$_0clEvENKUlvE_clEv
Line
Count
Source
35
367
    entity->register_hook(#metric, [&]() { owner->metric->set_value(func()); });
new_load_stream_mgr.cpp:_ZZZN5doris16NewLoadStreamMgrC1EvENK3$_0clEvENKUlvE_clEv
Line
Count
Source
35
367
    entity->register_hook(#metric, [&]() { owner->metric->set_value(func()); });
36
37
#define REGISTER_HOOK_METRIC(metric, func)                                 \
38
543
    REGISTER_ENTITY_HOOK_METRIC(DorisMetrics::instance()->server_entity(), \
39
543
                                DorisMetrics::instance(), metric, func)
40
41
#define DEREGISTER_ENTITY_HOOK_METRIC(entity, name) \
42
118
    entity->deregister_metric(&METRIC_##name);      \
43
118
    entity->deregister_hook(#name);
44
45
#define DEREGISTER_HOOK_METRIC(name) \
46
118
    DEREGISTER_ENTITY_HOOK_METRIC(DorisMetrics::instance()->server_entity(), name)
47
48
class DorisMetrics {
49
public:
50
    IntCounter* fragment_requests_total = nullptr;
51
    IntCounter* fragment_request_duration_us = nullptr;
52
    IntCounter* query_scan_bytes = nullptr;
53
    IntCounter* query_scan_bytes_from_local = nullptr;
54
    IntCounter* query_scan_bytes_from_remote = nullptr;
55
    IntCounter* query_scan_rows = nullptr;
56
57
    IntCounter* push_requests_success_total = nullptr;
58
    IntCounter* push_requests_fail_total = nullptr;
59
    IntCounter* push_request_duration_us = nullptr;
60
    IntCounter* push_request_write_bytes = nullptr;
61
    IntCounter* push_request_write_rows = nullptr;
62
    IntCounter* create_tablet_requests_total = nullptr;
63
    IntCounter* create_tablet_requests_failed = nullptr;
64
    IntCounter* drop_tablet_requests_total = nullptr;
65
66
    IntCounter* report_all_tablets_requests_skip = nullptr;
67
68
    IntCounter* schema_change_requests_total = nullptr;
69
    IntCounter* schema_change_requests_failed = nullptr;
70
    IntCounter* create_rollup_requests_total = nullptr;
71
    IntCounter* create_rollup_requests_failed = nullptr;
72
    IntCounter* storage_migrate_requests_total = nullptr;
73
    IntCounter* storage_migrate_v2_requests_total = nullptr;
74
    IntCounter* storage_migrate_v2_requests_failed = nullptr;
75
    IntCounter* delete_requests_total = nullptr;
76
    IntCounter* delete_requests_failed = nullptr;
77
    IntCounter* clone_requests_total = nullptr;
78
    IntCounter* clone_requests_failed = nullptr;
79
    IntCounter* alter_inverted_index_requests_total = nullptr;
80
    IntCounter* alter_inverted_index_requests_failed = nullptr;
81
82
    IntCounter* finish_task_requests_total = nullptr;
83
    IntCounter* finish_task_requests_failed = nullptr;
84
85
    IntCounter* compaction_producer_callback_a_round_time = nullptr;
86
87
    IntCounter* base_compaction_request_total = nullptr;
88
    IntCounter* base_compaction_request_failed = nullptr;
89
    IntCounter* cumulative_compaction_request_total = nullptr;
90
    IntCounter* cumulative_compaction_request_failed = nullptr;
91
    IntCounter* single_compaction_request_total = nullptr;
92
    IntCounter* single_compaction_request_failed = nullptr;
93
    IntCounter* single_compaction_request_cancelled = nullptr;
94
95
    IntCounter* local_compaction_read_rows_total = nullptr;
96
    IntCounter* local_compaction_read_bytes_total = nullptr;
97
    IntCounter* local_compaction_write_rows_total = nullptr;
98
    IntCounter* local_compaction_write_bytes_total = nullptr;
99
    IntCounter* remote_compaction_read_rows_total = nullptr;
100
    IntCounter* remote_compaction_read_bytes_total = nullptr;
101
    IntCounter* remote_compaction_write_rows_total = nullptr;
102
    IntCounter* remote_compaction_write_bytes_total = nullptr;
103
104
    IntCounter* base_compaction_deltas_total = nullptr;
105
    IntCounter* base_compaction_bytes_total = nullptr;
106
    IntCounter* cumulative_compaction_deltas_total = nullptr;
107
    IntCounter* cumulative_compaction_bytes_total = nullptr;
108
    IntCounter* full_compaction_deltas_total = nullptr;
109
    IntCounter* full_compaction_bytes_total = nullptr;
110
111
    IntCounter* base_compaction_task_running_total = nullptr;
112
    IntCounter* base_compaction_task_pending_total = nullptr;
113
    IntCounter* cumulative_compaction_task_running_total = nullptr;
114
    IntCounter* cumulative_compaction_task_pending_total = nullptr;
115
116
    IntCounter* publish_task_request_total = nullptr;
117
    IntCounter* publish_task_failed_total = nullptr;
118
119
    // Counters for segment_v2
120
    // -----------------------
121
    // total number of segments read
122
    IntCounter* segment_read_total = nullptr;
123
    // total number of rows in queried segments (before index pruning)
124
    IntCounter* segment_row_total = nullptr;
125
    // number of condition cache lookups when digest != 0
126
    IntCounter* condition_cache_search_count = nullptr;
127
    // number of condition cache hits
128
    IntCounter* condition_cache_hit_count = nullptr;
129
130
    IntCounter* stream_load_txn_begin_request_total = nullptr;
131
    IntCounter* stream_load_txn_commit_request_total = nullptr;
132
    IntCounter* stream_load_txn_rollback_request_total = nullptr;
133
    IntCounter* stream_receive_bytes_total = nullptr;
134
    IntCounter* stream_load_rows_total = nullptr;
135
    IntCounter* load_rows = nullptr;
136
    IntCounter* load_bytes = nullptr;
137
138
    IntCounter* routine_load_get_msg_latency = nullptr;
139
    IntCounter* routine_load_get_msg_count = nullptr;
140
    IntCounter* routine_load_consume_bytes = nullptr;
141
    IntCounter* routine_load_consume_rows = nullptr;
142
143
    IntCounter* memtable_flush_total = nullptr;
144
    IntCounter* memtable_flush_duration_us = nullptr;
145
146
    IntGauge* memory_pool_bytes_total = nullptr;
147
    IntGauge* process_thread_num = nullptr;
148
    IntGauge* process_fd_num_used = nullptr;
149
    IntGauge* process_fd_num_limit_soft = nullptr;
150
    IntGauge* process_fd_num_limit_hard = nullptr;
151
152
    // the max compaction score of all tablets.
153
    // Record base and cumulative scores separately, because
154
    // we need to get the larger of the two.
155
    IntGauge* tablet_cumulative_max_compaction_score = nullptr;
156
    IntGauge* tablet_base_max_compaction_score = nullptr;
157
158
    IntGauge* all_rowsets_num = nullptr;
159
    IntGauge* all_segments_num = nullptr;
160
161
    // permits have been used for all compaction tasks
162
    IntGauge* compaction_used_permits = nullptr;
163
    // permits required by the compaction task which is waiting for permits
164
    IntGauge* compaction_waitting_permits = nullptr;
165
166
    HistogramMetric* tablet_version_num_distribution = nullptr;
167
168
    // The following metrics will be calculated
169
    // by metric calculator
170
    IntGauge* query_scan_bytes_per_second = nullptr;
171
172
    // Metrics related with file reader/writer
173
    IntCounter* local_file_reader_total = nullptr;
174
    IntCounter* s3_file_reader_total = nullptr;
175
    IntCounter* hdfs_file_reader_total = nullptr;
176
    IntCounter* broker_file_reader_total = nullptr;
177
    IntCounter* local_file_writer_total = nullptr;
178
    IntCounter* s3_file_writer_total = nullptr;
179
    IntCounter* file_created_total = nullptr;
180
    IntCounter* s3_file_created_total = nullptr;
181
    IntCounter* local_bytes_read_total = nullptr;
182
    IntCounter* s3_bytes_read_total = nullptr;
183
    IntCounter* local_bytes_written_total = nullptr;
184
    IntCounter* s3_bytes_written_total = nullptr;
185
    IntGauge* local_file_open_reading = nullptr;
186
    IntGauge* s3_file_open_reading = nullptr;
187
    IntGauge* hdfs_file_open_reading = nullptr;
188
    IntGauge* broker_file_open_reading = nullptr;
189
    IntGauge* local_file_open_writing = nullptr;
190
    IntGauge* s3_file_open_writing = nullptr;
191
192
    // Size of some global containers
193
    UIntGauge* rowset_count_generated_and_in_use = nullptr;
194
    UIntGauge* unused_rowsets_count = nullptr;
195
    UIntGauge* broker_count = nullptr;
196
    UIntGauge* data_stream_receiver_count = nullptr;
197
    UIntGauge* fragment_endpoint_count = nullptr;
198
    UIntGauge* active_scan_context_count = nullptr;
199
    UIntGauge* fragment_instance_count = nullptr;
200
    UIntGauge* load_channel_count = nullptr;
201
    UIntGauge* result_buffer_block_count = nullptr;
202
    UIntGauge* result_block_queue_count = nullptr;
203
    UIntGauge* routine_load_task_count = nullptr;
204
    UIntGauge* small_file_cache_count = nullptr;
205
    UIntGauge* stream_load_pipe_count = nullptr;
206
    UIntGauge* new_stream_load_pipe_count = nullptr;
207
    UIntGauge* brpc_endpoint_stub_count = nullptr;
208
    UIntGauge* brpc_stream_endpoint_stub_count = nullptr;
209
    UIntGauge* brpc_function_endpoint_stub_count = nullptr;
210
    UIntGauge* tablet_writer_count = nullptr;
211
212
    UIntGauge* segcompaction_mem_consumption = nullptr;
213
    UIntGauge* compaction_mem_consumption = nullptr;
214
    UIntGauge* load_mem_consumption = nullptr;
215
    UIntGauge* load_channel_mem_consumption = nullptr;
216
    UIntGauge* memtable_memory_limiter_mem_consumption = nullptr;
217
    UIntGauge* query_mem_consumption = nullptr;
218
    UIntGauge* schema_change_mem_consumption = nullptr;
219
    UIntGauge* storage_migration_mem_consumption = nullptr;
220
    UIntGauge* tablet_meta_mem_consumption = nullptr;
221
222
    // Cache metrics
223
    UIntGauge* query_cache_memory_total_byte = nullptr;
224
    UIntGauge* query_cache_sql_total_count = nullptr;
225
    UIntGauge* query_cache_partition_total_count = nullptr;
226
227
    // Upload metrics
228
    UIntGauge* upload_total_byte = nullptr;
229
    IntCounter* upload_rowset_count = nullptr;
230
    IntCounter* upload_fail_count = nullptr;
231
232
    UIntGauge* light_work_pool_queue_size = nullptr;
233
    UIntGauge* heavy_work_pool_queue_size = nullptr;
234
    UIntGauge* heavy_work_active_threads = nullptr;
235
    UIntGauge* light_work_active_threads = nullptr;
236
237
    UIntGauge* heavy_work_pool_max_queue_size = nullptr;
238
    UIntGauge* light_work_pool_max_queue_size = nullptr;
239
    UIntGauge* heavy_work_max_threads = nullptr;
240
    UIntGauge* light_work_max_threads = nullptr;
241
242
    UIntGauge* arrow_flight_work_pool_queue_size = nullptr;
243
    UIntGauge* arrow_flight_work_active_threads = nullptr;
244
    UIntGauge* arrow_flight_work_pool_max_queue_size = nullptr;
245
    UIntGauge* arrow_flight_work_max_threads = nullptr;
246
247
    IntCounter* num_io_bytes_read_total = nullptr;
248
    IntCounter* num_io_bytes_read_from_cache = nullptr;
249
    IntCounter* num_io_bytes_read_from_remote = nullptr;
250
    IntCounter* num_io_bytes_read_from_peer = nullptr;
251
252
    IntCounter* udf_close_bthread_count = nullptr;
253
254
    IntCounter* query_ctx_cnt = nullptr;
255
    IntCounter* scanner_ctx_cnt = nullptr;
256
    IntCounter* scanner_cnt = nullptr;
257
    IntCounter* scanner_task_cnt = nullptr;
258
    IntCounter* pipeline_task_queue_size = nullptr;
259
    IntCounter* ann_index_load_costs_ms = nullptr;
260
    IntCounter* ann_index_load_cnt = nullptr;
261
    IntCounter* ann_index_search_costs_ms = nullptr;
262
    IntCounter* ann_index_search_cnt = nullptr;
263
    IntCounter* ann_index_in_memory_cnt = nullptr;
264
    IntCounter* ann_index_in_memory_rows_cnt = nullptr;
265
    IntCounter* ann_index_construction = nullptr;
266
    IntCounter* ann_index_build_index_threads = nullptr;
267
268
    IntGauge* runtime_filter_consumer_num = nullptr;
269
    IntGauge* runtime_filter_consumer_ready_num = nullptr;
270
    IntCounter* runtime_filter_consumer_wait_ready_ms = nullptr;
271
    IntGauge* runtime_filter_consumer_timeout_num = nullptr;
272
273
    IntCounter* get_remote_tablet_slow_time_ms = nullptr;
274
    IntCounter* get_remote_tablet_slow_cnt = nullptr;
275
276
56.2M
    static DorisMetrics* instance() {
277
56.2M
        static DorisMetrics instance;
278
56.2M
        return &instance;
279
56.2M
    }
280
281
    // not thread-safe, call before calling metrics
282
    void initialize(
283
            bool init_system_metrics = false,
284
            const std::set<std::string>& disk_devices = std::set<std::string>(),
285
            const std::vector<std::string>& network_interfaces = std::vector<std::string>());
286
287
664k
    MetricRegistry* metric_registry() { return &_metric_registry; }
288
5.61k
    SystemMetrics* system_metrics() { return _system_metrics.get(); }
289
1.32k
    MetricEntity* server_entity() { return _server_metric_entity.get(); }
290
1.35k
    JvmMetrics* jvm_metrics() { return _jvm_metrics.get(); }
291
    void init_jvm_metrics();
292
293
private:
294
    // Don't allow constructor
295
    DorisMetrics();
296
297
    void _update();
298
    void _update_process_thread_num();
299
    void _update_process_fd_num();
300
301
private:
302
    static const std::string _s_registry_name;
303
    static const std::string _s_hook_name;
304
305
    MetricRegistry _metric_registry;
306
307
    std::unique_ptr<SystemMetrics> _system_metrics;
308
    std::unique_ptr<JvmMetrics> _jvm_metrics;
309
310
    std::shared_ptr<MetricEntity> _server_metric_entity;
311
};
312
313
}; // namespace doris