charts.d restarts every hour to prevent memory leaks of the shell; initial update of plugins does not specify a duration to allow netdata re-calibrate the chart to the current time
Costa Tsaousis (ktsaou) committed
May 21, 2014 at 20:57 UTC
80e6f14ec7e9908bfbd1a1d9523c0e93e28c9089
3 files changed
+16
-3
apps_plugin.c
+4
-1
@@ -890,7 +890,10 @@ void show_dimensions(void)
890
gettimeofday(&last, NULL);
891
getrusage(RUSAGE_SELF, &me_last);
892
893
- usec = update_every * 1000000ULL;
893
+ // the first time, give a zero to allow
894
+ // netdata calibrate to the current time
895
+ // usec = update_every * 1000000ULL;
896
+ usec = 0ULL;
897
cpuuser = 0;
898
cpusyst = 0;
899
}
plugins.d/charts.d.plugin
+10
@@ -276,8 +276,12 @@ done
276
# -----------------------------------------------------------------------------
277
# update dimensions
278
global_update() {
279
+ local exit_after=$((3600 / update_every))
280
+
281
+ local c=0
282
while [ 1 ]
283
do
284
+ local c=$((c + 1))
285
local now_charts="$run_charts"
286
local run_charts=
287
@@ -295,6 +299,10 @@ global_update() {
299
local dt=$(( (now - last) * 1000 ))
300
eval "last_update_$chart=$now"
301
302
+ # the first call should not give a duration
303
+ # so that netdata calibrates to current time
304
+ test $c -eq 1 && local dt=
305
+
306
$chart$charts_update $dt
307
if [ $? -eq 0 ]
308
then
@@ -312,6 +320,8 @@ global_update() {
320
# wait the time you are required to
321
loopsleepms $debug_time $update_every
322
fi
323
+
324
+ test $c -gt $exit_after && exit 0
325
done
326
}
327
plugins.d/tc-qos-helper.sh
+2
-2
@@ -84,7 +84,7 @@ do
84
show_tc $d
85
done
86
87
- [ $gc -gt $exit_after ] && exit 0
88
-
87
loopsleepms $sleep_time
88
+
89
+ test $gc -gt $exit_after && exit 0
90
done