mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-11 18:35:46 +02:00
feat(server): Expose serialization bytes via INFO
and /metrics
(#3087)
* feat(server): Expose serialization bytes via `INFO` and `/metrics` * Also expose pipeline_cmd_cache_bytes via `/metrics` (it's already in `INFO`)
This commit is contained in:
parent
2391f49e1c
commit
07b5e00424
2 changed files with 7 additions and 0 deletions
|
@ -1073,6 +1073,8 @@ void PrintPrometheusMetrics(const Metrics& m, DflyCmd* dfly_cmd, StringResponse*
|
|||
MetricType::GAUGE, &resp->body());
|
||||
AppendMetricWithoutLabels("dispatch_queue_bytes", "", conn_stats.dispatch_queue_bytes,
|
||||
MetricType::GAUGE, &resp->body());
|
||||
AppendMetricWithoutLabels("pipeline_cmd_cache_bytes", "", conn_stats.pipeline_cmd_cache_bytes,
|
||||
MetricType::GAUGE, &resp->body());
|
||||
|
||||
// Memory metrics
|
||||
auto sdata_res = io::ReadStatusInfo();
|
||||
|
@ -1107,6 +1109,8 @@ void PrintPrometheusMetrics(const Metrics& m, DflyCmd* dfly_cmd, StringResponse*
|
|||
<< sdata_res.error().message();
|
||||
}
|
||||
AppendMetricWithoutLabels("tls_bytes", "", m.tls_bytes, MetricType::GAUGE, &resp->body());
|
||||
AppendMetricWithoutLabels("snapshot_serialization_bytes", "", m.serialization_bytes,
|
||||
MetricType::GAUGE, &resp->body());
|
||||
|
||||
DbStats total;
|
||||
for (const auto& db_stats : m.db_stats) {
|
||||
|
@ -1867,6 +1871,7 @@ Metrics ServerFamily::GetMetrics() const {
|
|||
result.uptime = time(NULL) - this->start_time_;
|
||||
result.qps += uint64_t(ss->MovingSum6());
|
||||
result.facade_stats += *tl_facade_stats;
|
||||
result.serialization_bytes += SliceSnapshot::GetThreadLocalMemoryUsage();
|
||||
|
||||
if (shard) {
|
||||
result.heap_used_bytes += shard->UsedMemory();
|
||||
|
@ -2022,6 +2027,7 @@ void ServerFamily::Info(CmdArgList args, ConnectionContext* cntx) {
|
|||
append("dispatch_queue_peak_bytes", m.peak_stats.conn_dispatch_queue_bytes);
|
||||
append("client_read_buffer_peak_bytes", m.peak_stats.conn_read_buf_capacity);
|
||||
append("tls_bytes", m.tls_bytes);
|
||||
append("snapshot_serialization_bytes", m.serialization_bytes);
|
||||
|
||||
if (GetFlag(FLAGS_cache_mode)) {
|
||||
append("cache_mode", "cache");
|
||||
|
|
|
@ -97,6 +97,7 @@ struct Metrics {
|
|||
uint64_t fiber_switch_delay_usec = 0;
|
||||
uint64_t tls_bytes = 0;
|
||||
uint64_t refused_conn_max_clients_reached_count = 0;
|
||||
uint64_t serialization_bytes = 0;
|
||||
|
||||
// Statistics about fibers running for a long time (more than 1ms).
|
||||
uint64_t fiber_longrun_cnt = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue