remove duplicate chart name from chart title when streaming metrics; #2276
Costa Tsaousis (ktsaou) committed
Jun 9, 2017 at 00:26 UTC
6bd9fe43cf00d9522ca5437f1b13e91e3a718621
3 files changed
+5
-5
src/rrd2json.c
+2
-2
@@ -11,7 +11,7 @@ void rrd_stats_api_v1_chart_with_data(RRDSET *st, BUFFER *wb, size_t *dimensions
11
"\t\t\t\"type\": \"%s\",\n"
12
"\t\t\t\"family\": \"%s\",\n"
13
"\t\t\t\"context\": \"%s\",\n"
14
- "\t\t\t\"title\": \"%s\",\n"
14
+ "\t\t\t\"title\": \"%s (%s)\",\n"
15
"\t\t\t\"priority\": %ld,\n"
16
"\t\t\t\"enabled\": %s,\n"
17
"\t\t\t\"units\": \"%s\",\n"
@@ -27,7 +27,7 @@ void rrd_stats_api_v1_chart_with_data(RRDSET *st, BUFFER *wb, size_t *dimensions
27
, st->type
28
, st->family
29
, st->context
30
- , st->title
30
+ , st->title, st->name
31
, st->priority
32
, rrdset_flag_check(st, RRDSET_FLAG_ENABLED)?"true":"false"
33
, st->units
src/rrd2json_api_old.c
+2
-2
@@ -14,7 +14,7 @@ unsigned long rrdset_info2json_api_old(RRDSET *st, char *options, BUFFER *wb) {
14
"\t\t\t\"type\": \"%s\",\n"
15
"\t\t\t\"family\": \"%s\",\n"
16
"\t\t\t\"context\": \"%s\",\n"
17
- "\t\t\t\"title\": \"%s\",\n"
17
+ "\t\t\t\"title\": \"%s (%s)\",\n"
18
"\t\t\t\"priority\": %ld,\n"
19
"\t\t\t\"enabled\": %d,\n"
20
"\t\t\t\"units\": \"%s\",\n"
@@ -37,7 +37,7 @@ unsigned long rrdset_info2json_api_old(RRDSET *st, char *options, BUFFER *wb) {
37
, st->type
38
, st->family
39
, st->context
40
- , st->title
40
+ , st->title, st->name
41
, st->priority
42
, rrdset_flag_check(st, RRDSET_FLAG_ENABLED)?1:0
43
, st->units
src/rrdset.c
+1
-1
@@ -572,7 +572,7 @@ RRDSET *rrdset_create_custom(
572
{
573
char varvalue[CONFIG_MAX_VALUE + 1];
574
char varvalue2[CONFIG_MAX_VALUE + 1];
575
- snprintfz(varvalue, CONFIG_MAX_VALUE, "%s (%s)", title?title:"", st->name);
575
+ snprintfz(varvalue, CONFIG_MAX_VALUE, "%s", title?title:"");
576
json_escape_string(varvalue2, varvalue, sizeof(varvalue2));
577
st->title = config_get(st->config_section, "title", varvalue2);
578
}