summaryrefslogtreecommitdiff
path: root/src/config.c
diff options
context:
space:
mode:
authorMadelyn Olson <34459052+madolson@users.noreply.github.com>2022-01-09 17:04:18 -0800
committerGitHub <noreply@github.com>2022-01-09 17:04:18 -0800
commite8e02f900cbf0fbaae6eb53e52ce9c4cc8318b99 (patch)
tree04ec1ed5c7630730149810b4dca9bc6b737f076c /src/config.c
parenta84c964d37a1899bf90c920efef85a1d7202d058 (diff)
downloadredis-e8e02f900cbf0fbaae6eb53e52ce9c4cc8318b99.tar.gz
Changed latency histogram output to omit trailing 0s and periods (#10075)
Changed latency percentile output to omit trailing 0s and periods
Diffstat (limited to 'src/config.c')
-rw-r--r--src/config.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/config.c b/src/config.c
index 6dd4cc844..055c849ce 100644
--- a/src/config.c
+++ b/src/config.c
@@ -2698,8 +2698,10 @@ static sds getConfigLatencyTrackingInfoPercentilesOutputOption(typeData data) {
UNUSED(data);
sds buf = sdsempty();
for (int j = 0; j < server.latency_tracking_info_percentiles_len; j++) {
- buf = sdscatprintf(buf,"%f",
- server.latency_tracking_info_percentiles[j]);
+ char fbuf[128];
+ size_t len = sprintf(fbuf, "%f", server.latency_tracking_info_percentiles[j]);
+ len = trimDoubleString(fbuf, len);
+ buf = sdscatlen(buf, fbuf, len);
if (j != server.latency_tracking_info_percentiles_len-1)
buf = sdscatlen(buf," ",1);
}
@@ -2718,8 +2720,10 @@ void rewriteConfigLatencyTrackingInfoPercentilesOutputOption(typeData data, cons
line = sdscat(line," \"\"");
} else {
for (int j = 0; j < server.latency_tracking_info_percentiles_len; j++) {
- line = sdscatprintf(line," %f",
- server.latency_tracking_info_percentiles[j]);
+ char fbuf[128];
+ size_t len = sprintf(fbuf, " %f", server.latency_tracking_info_percentiles[j]);
+ len = trimDoubleString(fbuf, len);
+ line = sdscatlen(line, fbuf, len);
}
}
rewriteConfigRewriteLine(state,name,line,1);