From f55858349344b40168cd83d645b5636295eb92a6 Mon Sep 17 00:00:00 2001 From: DarrenJiang13 Date: Mon, 6 Jun 2022 13:29:24 +0800 Subject: [PATCH] Split instantaneous_repl_total_kbps to instantaneous_input_repl_kbps and instantaneous_output_repl_kbps. (#10810) A supplement to https://github.com/redis/redis/pull/10062 Split `instantaneous_repl_total_kbps` to `instantaneous_input_repl_kbps` and `instantaneous_output_repl_kbps`. ## Work: This PR: - delete 1 info field: - `instantaneous_repl_total_kbps` - add 2 info fields: - `instantaneous_input_repl_kbps / instantaneous_output_repl_kbps` ## Result: - master ``` total_net_input_bytes:26633673 total_net_output_bytes:21716596 total_net_repl_input_bytes:0 total_net_repl_output_bytes:18433052 instantaneous_input_kbps:0.02 instantaneous_output_kbps:0.00 instantaneous_input_repl_kbps:0.00 instantaneous_output_repl_kbps:0.00 ``` - slave ``` total_net_input_bytes:18433212 total_net_output_bytes:94790 total_net_repl_input_bytes:18433052 total_net_repl_output_bytes:0 instantaneous_input_kbps:0.00 instantaneous_output_kbps:0.05 instantaneous_input_repl_kbps:0.00 instantaneous_output_repl_kbps:0.00 ``` --- src/server.c | 12 ++++++++---- src/server.h | 5 +++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/server.c b/src/server.c index f41cd6c26..dfb627694 100644 --- a/src/server.c +++ b/src/server.c @@ -1204,8 +1204,10 @@ int serverCron(struct aeEventLoop *eventLoop, long long id, void *clientData) { stat_net_input_bytes + stat_net_repl_input_bytes); trackInstantaneousMetric(STATS_METRIC_NET_OUTPUT, stat_net_output_bytes + stat_net_repl_output_bytes); - trackInstantaneousMetric(STATS_METRIC_NET_TOTAL_REPLICATION, - stat_net_repl_input_bytes + stat_net_repl_output_bytes); + trackInstantaneousMetric(STATS_METRIC_NET_INPUT_REPLICATION, + stat_net_repl_input_bytes); + trackInstantaneousMetric(STATS_METRIC_NET_OUTPUT_REPLICATION, + stat_net_repl_output_bytes); } /* We have just LRU_BITS bits per object for LRU information. @@ -5622,7 +5624,8 @@ sds genRedisInfoString(dict *section_dict, int all_sections, int everything) { "total_net_repl_output_bytes:%lld\r\n" "instantaneous_input_kbps:%.2f\r\n" "instantaneous_output_kbps:%.2f\r\n" - "instantaneous_repl_total_kbps:%.2f\r\n" + "instantaneous_input_repl_kbps:%.2f\r\n" + "instantaneous_output_repl_kbps:%.2f\r\n" "rejected_connections:%lld\r\n" "sync_full:%lld\r\n" "sync_partial_ok:%lld\r\n" @@ -5670,7 +5673,8 @@ sds genRedisInfoString(dict *section_dict, int all_sections, int everything) { stat_net_repl_output_bytes, (float)getInstantaneousMetric(STATS_METRIC_NET_INPUT)/1024, (float)getInstantaneousMetric(STATS_METRIC_NET_OUTPUT)/1024, - (float)getInstantaneousMetric(STATS_METRIC_NET_TOTAL_REPLICATION)/1024, + (float)getInstantaneousMetric(STATS_METRIC_NET_INPUT_REPLICATION)/1024, + (float)getInstantaneousMetric(STATS_METRIC_NET_OUTPUT_REPLICATION)/1024, server.stat_rejected_conn, server.stat_sync_full, server.stat_sync_partial_ok, diff --git a/src/server.h b/src/server.h index 04c047cf0..6dfa8a067 100644 --- a/src/server.h +++ b/src/server.h @@ -156,8 +156,9 @@ typedef long long ustime_t; /* microsecond time type. */ #define STATS_METRIC_COMMAND 0 /* Number of commands executed. */ #define STATS_METRIC_NET_INPUT 1 /* Bytes read to network. */ #define STATS_METRIC_NET_OUTPUT 2 /* Bytes written to network. */ -#define STATS_METRIC_NET_TOTAL_REPLICATION 3 /* Bytes written and read to network during replication. */ -#define STATS_METRIC_COUNT 4 +#define STATS_METRIC_NET_INPUT_REPLICATION 3 /* Bytes read to network during replication. */ +#define STATS_METRIC_NET_OUTPUT_REPLICATION 4 /* Bytes written to network during replication. */ +#define STATS_METRIC_COUNT 5 /* Protocol and I/O related defines */ #define PROTO_IOBUF_LEN (1024*16) /* Generic I/O buffer size */