sync clock on dimension creation attempts; refresh the chart to upstream on chart creation attempt
Costa Tsaousis (ktsaou) committed
Jul 18, 2018 at 16:54 UTC
e08c79b16ee1e299787bd057493ac6d692e4f751
3 files changed
+15
-2
src/rrddim.c
+7
@@ -48,6 +48,7 @@ inline int rrddim_set_name(RRDSET *st, RRDDIM *rd, const char *name) {
48
rd->hash_name = simple_hash(rd->name);
49
rrddimvar_rename_all(rd);
50
rd->exposed = 0;
51
+ rrdset_flag_clear(st, RRDSET_FLAG_EXPOSED_UPSTREAM);
52
return 1;
53
}
54
@@ -59,6 +60,7 @@ inline int rrddim_set_algorithm(RRDSET *st, RRDDIM *rd, RRD_ALGORITHM algorithm)
60
rd->algorithm = algorithm;
61
rd->exposed = 0;
62
rrdset_flag_set(st, RRDSET_FLAG_HOMEGENEOUS_CHECK);
63
+ rrdset_flag_clear(st, RRDSET_FLAG_EXPOSED_UPSTREAM);
64
return 1;
65
}
66
@@ -70,6 +72,7 @@ inline int rrddim_set_multiplier(RRDSET *st, RRDDIM *rd, collected_number multip
72
rd->multiplier = multiplier;
73
rd->exposed = 0;
74
rrdset_flag_set(st, RRDSET_FLAG_HOMEGENEOUS_CHECK);
75
+ rrdset_flag_clear(st, RRDSET_FLAG_EXPOSED_UPSTREAM);
76
return 1;
77
}
78
@@ -81,6 +84,7 @@ inline int rrddim_set_divisor(RRDSET *st, RRDDIM *rd, collected_number divisor)
84
rd->divisor = divisor;
85
rd->exposed = 0;
86
rrdset_flag_set(st, RRDSET_FLAG_HOMEGENEOUS_CHECK);
87
+ rrdset_flag_clear(st, RRDSET_FLAG_EXPOSED_UPSTREAM);
88
return 1;
89
}
90
@@ -90,6 +94,9 @@ inline int rrddim_set_divisor(RRDSET *st, RRDDIM *rd, collected_number divisor)
94
RRDDIM *rrddim_add_custom(RRDSET *st, const char *id, const char *name, collected_number multiplier, collected_number divisor, RRD_ALGORITHM algorithm, RRD_MEMORY_MODE memory_mode) {
95
rrdset_wrlock(st);
96
97
+ rrdset_flag_set(st, RRDSET_FLAG_SYNC_CLOCK);
98
+ rrdset_flag_clear(st, RRDSET_FLAG_EXPOSED_UPSTREAM);
99
+
100
RRDDIM *rd = rrddim_find(st, id);
101
if(unlikely(rd)) {
102
debug(D_RRD_CALLS, "Cannot create rrd dimension '%s/%s', it already exists.", st->id, name?name:"<NONAME>");
src/rrdpush.c
+7
-2
@@ -76,9 +76,14 @@ static inline int need_to_send_chart_definition(RRDSET *st) {
76
return 1;
77
78
RRDDIM *rd;
79
- rrddim_foreach_read(rd, st)
80
- if(unlikely(!rd->exposed))
79
+ rrddim_foreach_read(rd, st) {
80
+ if(unlikely(!rd->exposed)) {
81
+ #ifdef NETDATA_INTERNAL_CHECKS
82
+ info("host '%s', chart '%s', dimension '%s' flag 'exposed' triggered chart refresh to upstream", st->rrdhost->hostname, st->id, rd->id);
83
+ #endif
84
return 1;
85
+ }
86
+ }
87
88
return 0;
89
}
src/rrdset.c
+1
@@ -485,6 +485,7 @@ RRDSET *rrdset_create_custom(
485
if(st) {
486
rrdhost_unlock(host);
487
rrdset_flag_set(st, RRDSET_FLAG_SYNC_CLOCK);
488
+ rrdset_flag_clear(st, RRDSET_FLAG_EXPOSED_UPSTREAM);
489
return st;
490
}
491