mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-11 10:25:47 +02:00
fix: UB during cmd squashing reply size calculation (#4149)
* fix: UB during cmd squashing reply size calculation * feat: add promtheus metric commands_squashing_replies_bytes
This commit is contained in:
parent
794bd1cdb3
commit
4e7800f94f
2 changed files with 4 additions and 3 deletions
|
@ -273,8 +273,8 @@ bool MultiCommandSquasher::ExecuteSquashed(facade::RedisReplyBuilder* rb) {
|
||||||
|
|
||||||
aborted |= error_abort_ && CapturingReplyBuilder::TryExtractError(replies.back());
|
aborted |= error_abort_ && CapturingReplyBuilder::TryExtractError(replies.back());
|
||||||
|
|
||||||
CapturingReplyBuilder::Apply(std::move(replies.back()), rb);
|
|
||||||
current_reply_size_.fetch_sub(Size(replies.back()), std::memory_order_relaxed);
|
current_reply_size_.fetch_sub(Size(replies.back()), std::memory_order_relaxed);
|
||||||
|
CapturingReplyBuilder::Apply(std::move(replies.back()), rb);
|
||||||
replies.pop_back();
|
replies.pop_back();
|
||||||
|
|
||||||
if (aborted)
|
if (aborted)
|
||||||
|
|
|
@ -1300,8 +1300,6 @@ void PrintPrometheusMetrics(uint64_t uptime, const Metrics& m, DflyCmd* dfly_cmd
|
||||||
MetricType::GAUGE, &resp->body());
|
MetricType::GAUGE, &resp->body());
|
||||||
AppendMetricWithoutLabels("dispatch_queue_bytes", "", conn_stats.dispatch_queue_bytes,
|
AppendMetricWithoutLabels("dispatch_queue_bytes", "", conn_stats.dispatch_queue_bytes,
|
||||||
MetricType::GAUGE, &resp->body());
|
MetricType::GAUGE, &resp->body());
|
||||||
AppendMetricWithoutLabels("pipeline_cache_bytes", "", conn_stats.pipeline_cmd_cache_bytes,
|
|
||||||
MetricType::GAUGE, &resp->body());
|
|
||||||
AppendMetricWithoutLabels("pipeline_queue_length", "", conn_stats.dispatch_queue_entries,
|
AppendMetricWithoutLabels("pipeline_queue_length", "", conn_stats.dispatch_queue_entries,
|
||||||
MetricType::GAUGE, &resp->body());
|
MetricType::GAUGE, &resp->body());
|
||||||
AppendMetricWithoutLabels("pipeline_throttle_total", "", conn_stats.pipeline_throttle_count,
|
AppendMetricWithoutLabels("pipeline_throttle_total", "", conn_stats.pipeline_throttle_count,
|
||||||
|
@ -1313,6 +1311,9 @@ void PrintPrometheusMetrics(uint64_t uptime, const Metrics& m, DflyCmd* dfly_cmd
|
||||||
AppendMetricWithoutLabels("pipeline_commands_duration_seconds", "",
|
AppendMetricWithoutLabels("pipeline_commands_duration_seconds", "",
|
||||||
conn_stats.pipelined_cmd_latency * 1e-6, MetricType::COUNTER,
|
conn_stats.pipelined_cmd_latency * 1e-6, MetricType::COUNTER,
|
||||||
&resp->body());
|
&resp->body());
|
||||||
|
AppendMetricWithoutLabels("commands_squashing_replies_bytes", "",
|
||||||
|
MultiCommandSquasher::GetRepliesMemSize(), MetricType::GAUGE,
|
||||||
|
&resp->body());
|
||||||
string connections_libs;
|
string connections_libs;
|
||||||
AppendMetricHeader("connections_libs", "Total number of connections by libname:ver",
|
AppendMetricHeader("connections_libs", "Total number of connections by libname:ver",
|
||||||
MetricType::GAUGE, &connections_libs);
|
MetricType::GAUGE, &connections_libs);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue