add option [statsd].private charts hidder = yes/no to allow using statsd private charts only for backends; fixes #3229
Costa Tsaousis (ktsaou) committed
Feb 25, 2018 at 01:08 UTC
620746f7166bab45227159382f80cccc46554dc5
2 files changed
+10
-2
src/rrd.h
+3
-2
@@ -232,7 +232,8 @@ typedef enum rrdset_flags {
232
RRDSET_FLAG_EXPOSED_UPSTREAM = 1 << 6, // if set, we have sent this chart to netdata master (streaming)
233
RRDSET_FLAG_STORE_FIRST = 1 << 7, // if set, do not eliminate the first collection during interpolation
234
RRDSET_FLAG_HETEROGENEOUS = 1 << 8, // if set, the chart is not homogeneous (dimensions in it have multiple algorithms, multipliers or dividers)
235
- RRDSET_FLAG_HOMEGENEOUS_CHECK= 1 << 9 // if set, the chart should be checked to determine if the dimensions as homogeneous
235
+ RRDSET_FLAG_HOMEGENEOUS_CHECK= 1 << 9, // if set, the chart should be checked to determine if the dimensions as homogeneous
236
+ RRDSET_FLAG_HIDDEN = 1 << 10, // if set, do not show this chart on the dashboard, but use it for backends
237
} RRDSET_FLAGS;
238
239
#ifdef HAVE_C___ATOMIC
@@ -648,7 +649,7 @@ extern void rrdset_is_obsolete(RRDSET *st);
649
extern void rrdset_isnot_obsolete(RRDSET *st);
650
651
// checks if the RRDSET should be offered to viewers
651
-#define rrdset_is_available_for_viewers(st) (rrdset_flag_check(st, RRDSET_FLAG_ENABLED) && !rrdset_flag_check(st, RRDSET_FLAG_OBSOLETE) && (st)->dimensions && (st)->rrd_memory_mode != RRD_MEMORY_MODE_NONE)
652
+#define rrdset_is_available_for_viewers(st) (rrdset_flag_check(st, RRDSET_FLAG_ENABLED) && !rrdset_flag_check(st, RRDSET_FLAG_HIDDEN) && !rrdset_flag_check(st, RRDSET_FLAG_OBSOLETE) && (st)->dimensions && (st)->rrd_memory_mode != RRD_MEMORY_MODE_NONE)
653
#define rrdset_is_available_for_backends(st) (rrdset_flag_check(st, RRDSET_FLAG_ENABLED) && !rrdset_flag_check(st, RRDSET_FLAG_OBSOLETE) && (st)->dimensions)
654
655
// get the total duration in seconds of the round robin database
src/statsd.c
+7
@@ -259,6 +259,7 @@ static struct statsd {
259
size_t max_private_charts_hard;
260
RRD_MEMORY_MODE private_charts_memory_mode;
261
long private_charts_rrd_history_entries;
262
+ int private_charts_hidden;
263
264
STATSD_APP *apps;
265
size_t recvmmsg_size;
@@ -274,6 +275,7 @@ static struct statsd {
275
.enabled = 1,
276
.max_private_charts = 200,
277
.max_private_charts_hard = 1000,
278
+ .private_charts_hidden = 0,
279
.recvmmsg_size = 10,
280
.decimal_detail = STATSD_DECIMAL_DETAIL,
281
@@ -1449,6 +1451,10 @@ static inline RRDSET *statsd_private_rrdset_create(
1451
, history // history
1452
);
1453
rrdset_flag_set(st, RRDSET_FLAG_STORE_FIRST);
1454
+
1455
+ if(statsd.private_charts_hidden)
1456
+ rrdset_flag_set(st, RRDSET_FLAG_HIDDEN);
1457
+
1458
// rrdset_flag_set(st, RRDSET_FLAG_DEBUG);
1459
return st;
1460
}
@@ -2099,6 +2105,7 @@ void *statsd_main(void *ptr) {
2105
statsd.private_charts_rrd_history_entries = (int)config_get_number(CONFIG_SECTION_STATSD, "private charts history", default_rrd_history_entries);
2106
statsd.decimal_detail = (size_t)config_get_number(CONFIG_SECTION_STATSD, "decimal detail", (long long int)statsd.decimal_detail);
2107
statsd.tcp_idle_timeout = (size_t) config_get_number(CONFIG_SECTION_STATSD, "disconnect idle tcp clients after seconds", (long long int)statsd.tcp_idle_timeout);
2108
+ statsd.private_charts_hidden = (int)config_get_boolean(CONFIG_SECTION_STATSD, "private charts hidden", statsd.private_charts_hidden);
2109
2110
statsd.histogram_percentile = (double)config_get_float(CONFIG_SECTION_STATSD, "histograms and timers percentile (percentThreshold)", statsd.histogram_percentile);
2111
if(isless(statsd.histogram_percentile, 0) || isgreater(statsd.histogram_percentile, 100)) {