Ruben Kerkhof [Sun, 7 Aug 2016 12:50:06 +0000 (14:50 +0200)]
More autoconf work
Ruben Kerkhof [Mon, 5 Dec 2016 19:23:39 +0000 (20:23 +0100)]
Fix some automake warnings
src/Makefile.am:1286: warning: variable 'test_plugin_virt_SOURCES' is defined but no program or
src/Makefile.am:1286: library has 'test_plugin_virt' as canonical name (possible typo)
src/Makefile.am:1290: warning: variable 'test_plugin_virt_LDADD' is defined but no program or
src/Makefile.am:1290: library has 'test_plugin_virt' as canonical name (possible typo)
src/Makefile.am:1289: warning: variable 'test_plugin_virt_LDFLAGS' is defined but no program or
src/Makefile.am:1289: library has 'test_plugin_virt' as canonical name (possible typo)
autoreconf: Leaving directory `.'
Ruben Kerkhof [Mon, 5 Dec 2016 19:19:40 +0000 (20:19 +0100)]
Fix autoreconf error on Mac OS
autoreconf: running: /usr/local/Cellar/autoconf/2.69/bin/autoconf --force
configure.ac:39: error: possibly undefined macro: AC_DISABLE_STATIC
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
autoreconf: /usr/local/Cellar/autoconf/2.69/bin/autoconf failed with exit status: 1
Ruben Kerkhof [Mon, 5 Dec 2016 19:13:31 +0000 (20:13 +0100)]
Merge pull request #2048 from mojaves/pr-virt-domain-tag
Add support for virt domain tags
Ruben Kerkhof [Mon, 5 Dec 2016 18:49:07 +0000 (19:49 +0100)]
Merge branch 'collectd-5.7'
Mytnyk, VolodymyrX [Wed, 30 Nov 2016 14:12:49 +0000 (14:12 +0000)]
dpdkstats: fix detection of local libdpdk
- Fix typo.
Change-Id: I7cfb6dff4e1c2728650cd1d44aaaa36169880809
Signed-off-by: Mytnyk, VolodymyrX <volodymyrx.mytnyk@intel.com>
Ruben Kerkhof [Fri, 2 Dec 2016 13:59:47 +0000 (14:59 +0100)]
utils_format_graphite_test.c: fix build warnings
Ruben Kerkhof [Fri, 2 Dec 2016 13:53:40 +0000 (14:53 +0100)]
battery_statefs: fix a few build warnings
battery_statefs.c:95:8: warning: initializing 'char *' with an expression of type 'const char [38]' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
{STATEFS_ROOT "Current", "current", NULL, 1e-6}, // from uA to A
^~~~~~~~~~~~~~~~~~~~~~
Ruben Kerkhof [Fri, 2 Dec 2016 13:39:25 +0000 (14:39 +0100)]
meta_data.c: fix a build warning
make[3]: Entering directory '/home/ruben/src/collectd/src/daemon'
CC meta_data.lo
meta_data.c:728:12: warning: assigning to 'char *' from 'const char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
actual = e->value.mv_boolean ? "true" : "false";
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
CCLD libmetadata.la
CC collectd-meta_data.o
meta_data.c:728:12: warning: assigning to 'char *' from 'const char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
actual = e->value.mv_boolean ? "true" : "false";
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
Ruben Kerkhof [Fri, 2 Dec 2016 13:01:27 +0000 (14:01 +0100)]
Merge branch 'collectd-5.7'
Ruben Kerkhof [Fri, 2 Dec 2016 12:59:32 +0000 (13:59 +0100)]
Merge pull request #2069 from octo/issue/2067
src/Makefile.am: Fix dependencies for the "tail" and "match" utilities.
Florian Forster [Thu, 1 Dec 2016 13:52:06 +0000 (14:52 +0100)]
src/Makefile.am: Fix dependencies for the "tail" and "match" utilities.
Since being pulled out of the core daemon, the daemon no longer provides
all the required symbols for these shared objects. The "tail", "match"
and "tail_match" utils need to be compiled in explicitly. Also, we need
to link with the liblatency.la convenience library for the
"Distribution" handling in the "match" util.
Issue: #2067
Francesco Romani [Wed, 23 Nov 2016 17:39:51 +0000 (18:39 +0100)]
virt plugin: Document the partition/tag support
document the tag schema, and explain one use case
and rationale for it.
Francesco Romani [Thu, 24 Nov 2016 15:09:41 +0000 (16:09 +0100)]
virt plugin: Properly reset the lists
If all the libvirt domains are shutdown between two refresh cycles,
the code failed to clean the lists.
Thus, the last detected libvirt domains are kept forever, leading
to failures in the data collection.
This leads to messages like
Nov 24 15:34:57 benji.rokugan.lan collectd[15083]: libvirt: QEMU Driver
error : Domain not found: no domain with matching uuid
'
bc324fee-5707-4ac6-a650-
6037562d4632' (nano_C010)
In the logs.
This bug was also present in collectd 5.6.1.
Signed-off-by: Francesco Romani <fromani@redhat.com>
Francesco Romani [Thu, 24 Nov 2016 09:16:00 +0000 (10:16 +0100)]
virt plugin: Disable tests momentarily
Old libvirts (<= 0.10.z, such as the version shipped on debian wheezy)
depend on libnl-1. There is a small memory leak caused by the
initialization of the library, and we have no means to avoid it.
This causes valgrind to complain in the tests, creating a false
positive.
Anyway, libvirt switched to libnl-3, which should also fix this leak.
The simplest solution is just to disable those tests until we
can depend on libnl-3 enabled libvirt.
Francesco Romani [Wed, 23 Nov 2016 17:38:42 +0000 (18:38 +0100)]
virt plugin: Add tests for the domain tags
Bootstrap the unit tests for the virt plugin, starting with
the newly-added partition/tag support.
Signed-off-by: Francesco Romani <fromani@redhat.com>
Francesco Romani [Wed, 30 Nov 2016 09:20:55 +0000 (10:20 +0100)]
virt plugin: Minor fixes
- avoid double registration with useless lv_read callback (will do
nothing now without userdata)
- fix configuration parsing
- improve and reformat logging
- avoid unitialized memory in partition tag buffer
- refactor and improve finalization, and ensure deregistration of
namespaces to improve cleanup.
Signed-off-by: Francesco Romani <fromani@redhat.com>
Francesco Romani [Wed, 23 Nov 2016 17:53:08 +0000 (18:53 +0100)]
virt plugin: Use int, for the number of instances
One 'int' is big enough, and we check the boundaries anyway
in lv_config.
Signed-off-by: Francesco Romani <fromani@redhat.com>
Francesco Romani [Wed, 23 Nov 2016 17:50:18 +0000 (18:50 +0100)]
virt plugin: Avoid NULL pointer deference
As per pull request review. Moving the variable assignement after
the check avoid any potential issues in the future.
Signed-off-by: Francesco Romani <fromani@redhat.com>
Francesco Romani [Mon, 21 Nov 2016 10:29:52 +0000 (11:29 +0100)]
virt plugin: Add support for domain tags
One "domain tag" is one custom attribute in the libvirt domain
metadata section. This patch enhances the virt plugin to partition
the domains to sample into reader instances according to tags.
One reader instance will only query the domains with attached
a macthing tag.
The special-purpose reader instance #0, guaranteed to be always present,
(since <0 instances are not allowed), will query all the domains
with missing or unrecognized tag, so no domain will ever left
out.
It's up to one external entity, like a management application,
to properly tag domains however it sees fit; how tags are picked
is completely transparent to the plugin
Tagging could be used by management application to evenly spread the
load among the reader threads, or to pin on the same threads all
the libvirt domains which use the same shared storage, to minimize
the disruption in presence of storage outages.
Signed-off-by: Francesco Romani <fromani@redhat.com>
Francesco Romani [Mon, 21 Nov 2016 08:30:45 +0000 (09:30 +0100)]
virt plugin: Support for multiple read callbacks
Add support to register more than one read callbacks in the
reader thread pool.
The default configuration is to use just one read callback,
for backward compatibility. No user-visible changes are expected
in this scenario.
Signed-off-by: Francesco Romani <fromani@redhat.com>
Francesco Romani [Wed, 30 Nov 2016 08:19:42 +0000 (09:19 +0100)]
virt plugin: Factor the read state into a struct
The lv_read function needs some bookkeeping data to track which
domain, block interface and network interface should be polled
for new data.
This patch factors out this data, previously scattered as module
globals, in a new struct. This makes the code a little tidier
and more reusable.
Signed-off-by: Francesco Romani <fromani@redhat.com>
Ruben Kerkhof [Tue, 29 Nov 2016 18:29:46 +0000 (19:29 +0100)]
Merge pull request #1898 from rubenk/remove-libltdl-support
Replace libltdl with plain dlopen.
Ruben Kerkhof [Fri, 19 Aug 2016 20:14:30 +0000 (22:14 +0200)]
Drop support for libtool version 1
The only distro that we still support that uses libtool version 1
is RHEL5, but that will be EOL in a few months.
Florian Forster [Tue, 29 Nov 2016 15:21:23 +0000 (16:21 +0100)]
src/utils_format_graphite.[ch]: Test correct null termination.
Issue: #2063
Ruben Kerkhof [Tue, 29 Nov 2016 14:47:53 +0000 (15:47 +0100)]
Merge branch 'collectd-5.7'
Ruben Kerkhof [Tue, 29 Nov 2016 14:46:52 +0000 (15:46 +0100)]
Merge pull request #2064 from rubenk/fix-make-distcheck
Fix make distcheck
Ruben Kerkhof [Tue, 29 Nov 2016 14:43:22 +0000 (15:43 +0100)]
Fix make distcheck
This was broken by
1d888f3
Ruben Kerkhof [Tue, 29 Nov 2016 11:39:33 +0000 (12:39 +0100)]
Merge branch 'collectd-5.7'
Ruben Kerkhof [Tue, 29 Nov 2016 11:38:59 +0000 (12:38 +0100)]
Merge branch 'collectd-5.6' into collectd-5.7
Conflicts:
contrib/redhat/collectd.spec
Ruben Kerkhof [Tue, 29 Nov 2016 11:33:20 +0000 (12:33 +0100)]
collectd.spec: also disable write_redis on EL6
This plugin also depends on the hiredis library, which was retired from
EPEL6.
Ruben Kerkhof [Tue, 29 Nov 2016 11:31:39 +0000 (12:31 +0100)]
Merge branch 'collectd-5.5' into collectd-5.6
Conflicts:
contrib/redhat/collectd.spec
Ruben Kerkhof [Tue, 29 Nov 2016 11:21:29 +0000 (12:21 +0100)]
contrib: clang-format rootfs_prefix.c
Ruben Kerkhof [Tue, 29 Nov 2016 10:48:40 +0000 (11:48 +0100)]
collectd.spec: disable redis plugin on EL6
hiredis has been retired from EPEL6
Ruben Kerkhof [Tue, 29 Nov 2016 10:43:08 +0000 (11:43 +0100)]
collectd.spec: disable redis plugin on EL6
Ruben Kerkhof [Tue, 29 Nov 2016 10:26:24 +0000 (11:26 +0100)]
Merge pull request #2041 from mfournier/contrib-docker
Add sample Dockerfile & LD_PRELOAD wrapper to contrib
Florian Forster [Mon, 28 Nov 2016 21:23:24 +0000 (22:23 +0100)]
Even more renormalization.
Florian Forster [Mon, 28 Nov 2016 21:23:04 +0000 (22:23 +0100)]
Merge branch 'collectd-5.6'
Florian Forster [Mon, 28 Nov 2016 21:22:01 +0000 (22:22 +0100)]
More reformatting.
No idea why the previous round missed these files.
Florian Forster [Mon, 28 Nov 2016 21:16:04 +0000 (22:16 +0100)]
Merge branch 'collectd-5.6'
Florian Forster [Mon, 28 Nov 2016 21:15:48 +0000 (22:15 +0100)]
Tree wide: Reformat with clang-format.
Florian Forster [Mon, 28 Nov 2016 21:09:22 +0000 (22:09 +0100)]
Tree wide: Reformat with clang-format.
Florian Forster [Mon, 28 Nov 2016 20:48:36 +0000 (21:48 +0100)]
Merge branch 'collectd-5.5' into collectd-5.6
Florian Forster [Mon, 28 Nov 2016 15:51:37 +0000 (16:51 +0100)]
Bump version to 5.5.3; Update ChangeLog.
Florian Forster [Mon, 28 Nov 2016 08:03:12 +0000 (09:03 +0100)]
Merge branch 'pr/2056'
Florian Forster [Mon, 28 Nov 2016 07:58:29 +0000 (08:58 +0100)]
collectd.conf(5): Improve documentation of the turbostat plugin.
Brock Johnson [Mon, 28 Nov 2016 02:20:02 +0000 (20:20 -0600)]
Updated to actually honor the boolean and clarified documentation per request
Florian Forster [Sun, 27 Nov 2016 19:34:25 +0000 (20:34 +0100)]
collectd.conf(5): Add missing blank line.
Florian Forster [Sun, 27 Nov 2016 13:58:42 +0000 (14:58 +0100)]
src/utils_latency_config.c: Avoid nested compound literals.
So GCC 4.6 doesn't crash.
Florian Forster [Sun, 27 Nov 2016 07:02:39 +0000 (08:02 +0100)]
src/daemon/utils_match.[ch]: Rename UTILS_MATCH_CF_GAUGE_LATENCY to UTILS_MATCH_CF_GAUGE_DIST.
Florian Forster [Sun, 20 Nov 2016 21:53:34 +0000 (22:53 +0100)]
tail plugin: Rename DSType from Latency to Distribution.
This is a more flexible naming owing to the fact that percentiles and other
distribution parameters are interesting for a variety of metrics, not just
latencies.
The config handling is now completely in src/utils_latency_config.c so
that other plugins, such as the cURL plugin, can easily reuse the module
with consistent config handling.
Florian Forster [Wed, 12 Oct 2016 15:25:13 +0000 (17:25 +0200)]
src/utils_latency{,_config}.[ch]: Reformat new code with clang-format.
Florian Forster [Wed, 12 Oct 2016 15:15:10 +0000 (17:15 +0200)]
collectd.conf(5): Update the "LatencyRate" option.
Florian Forster [Wed, 12 Oct 2016 07:15:49 +0000 (09:15 +0200)]
src/utils_latency.[ch]: get_rate(): Make lower bound exclusive.
This has a bunch of benefits:
* You can easily iterate over a range of latencies without counting
latencies twice. This was previously tricky because both borders were
considered to be inclusive.
* When lower equals upper, the returned value is now zero.
Previously, it was a value very close to zero, but not zero. The exact
value depended on the bucket width, an information not easily
available to the caller.
Florian Forster [Tue, 11 Oct 2016 15:27:11 +0000 (17:27 +0200)]
src/utils_latency.[ch]: Remove latency_counter_get_start_time().
Florian Forster [Tue, 11 Oct 2016 15:25:58 +0000 (17:25 +0200)]
src/utils_latency.[ch]: Improve accuracy, update unit test.
Pavel Rochnyack [Mon, 19 Sep 2016 17:32:54 +0000 (23:32 +0600)]
DSType latency: Improved after PR code review
Pavel Rochnyack [Sat, 7 May 2016 17:26:15 +0000 (23:26 +0600)]
+ liblatency: Added utils_latency_config code
+ tail plugin: DSType Latency added
Pavel Rochnyack [Sat, 7 May 2016 16:09:09 +0000 (22:09 +0600)]
+ utils_latency: Cleaned latency_counter_get_rate() from debugging
Pavel Rochnyack [Sat, 7 May 2016 15:55:16 +0000 (21:55 +0600)]
+ utils_latency: Added latency_counter_get_rate()
Pavel Rochnyack [Sat, 7 May 2016 07:01:33 +0000 (13:01 +0600)]
+ User_data destroy callback added to match_create_callback() in utils_match
Florian Forster [Sun, 27 Nov 2016 06:24:55 +0000 (07:24 +0100)]
Merge remote-tracking branch 'github/pr/2058'
Florian Forster [Sat, 26 Nov 2016 18:00:19 +0000 (19:00 +0100)]
amqp, write_graphite and write_kafka plugins: Implement the "[Graphite]PreserveSeparator" option.
Fixes: #419
Florian Forster [Sat, 26 Nov 2016 17:46:36 +0000 (18:46 +0100)]
src/utils_format_graphite.[ch]: Implement the GRAPHITE_PRESERVE_SEPARATOR flag.
brockcj [Sat, 26 Nov 2016 03:32:54 +0000 (21:32 -0600)]
Add config boolean for logical CPU naming for turbostat plugin
Florian Forster [Fri, 25 Nov 2016 19:59:53 +0000 (20:59 +0100)]
Merge remote-tracking branch 'github/pr/2052'
Florian Forster [Fri, 25 Nov 2016 16:27:10 +0000 (17:27 +0100)]
Merge remote-tracking branch 'github/pr/2054'
Florian Forster [Fri, 25 Nov 2016 09:08:49 +0000 (10:08 +0100)]
src/utils_format_graphite.[ch]: Add unit test.
First step towards fixing issue #419.
Marc Fournier [Wed, 23 Nov 2016 06:00:12 +0000 (07:00 +0100)]
collectd.spec: enable write_prometheus
Matthias Bethke [Tue, 22 Nov 2016 17:36:12 +0000 (00:36 +0700)]
use deterministic time values in MockDaemon
Matthias Bethke [Tue, 22 Nov 2016 16:53:30 +0000 (23:53 +0700)]
recognize seconds with and without fractional part
Matthias Bethke [Tue, 22 Nov 2016 16:37:33 +0000 (23:37 +0700)]
pass fractional seconds upwards as floats
Matthias Bethke [Tue, 22 Nov 2016 16:35:36 +0000 (23:35 +0700)]
allow fractional seconds in listval_filter()
Matthias Bethke [Tue, 22 Nov 2016 16:30:37 +0000 (23:30 +0700)]
update MockDaemon to report fractional seconds
Matthias Bethke [Tue, 22 Nov 2016 16:22:19 +0000 (23:22 +0700)]
fix indentation (consistently use tabs)
Ruben Kerkhof [Mon, 21 Nov 2016 13:37:53 +0000 (14:37 +0100)]
Merge pull request #2046 from rubenk/cleanup-dpdk-detection
Cleanup dpdk detection
Florian Forster [Mon, 21 Nov 2016 07:33:42 +0000 (08:33 +0100)]
Merge remote-tracking branch 'github/pr/2040'
Ruben Kerkhof [Sat, 19 Nov 2016 10:47:00 +0000 (11:47 +0100)]
Fix Lua header detection
checking lua.h usability... yes
checking lua.h presence... no
configure: WARNING: lua.h: accepted by the compiler, rejected by the
preprocessor!
configure: WARNING: lua.h: proceeding with the compiler's result
checking for lua.h... yes
checking lauxlib.h usability... yes
checking lauxlib.h presence... no
configure: WARNING: lauxlib.h: accepted by the compiler, rejected by the
preprocessor!
configure: WARNING: lauxlib.h: proceeding with the compiler's result
checking for lauxlib.h... yes
checking lualib.h usability... yes
checking lualib.h presence... no
configure: WARNING: lualib.h: accepted by the compiler, rejected by the
preprocessor!
configure: WARNING: lualib.h: proceeding with the compiler's result
checking for lualib.h... yes
AC_CHECK_HEADERS uses the preprocessor directly, which doesn't use
CFLAGS. Fixes detection of the lua-5.1 compat libs on Fedora Rawhide.
Florian Forster [Sat, 19 Nov 2016 13:26:27 +0000 (14:26 +0100)]
src/daemon/plugin.c: Address review comments.
Ruben Kerkhof [Sat, 19 Nov 2016 16:31:23 +0000 (17:31 +0100)]
Rewrite the check for libdpdk
This fixes various issues, like us not picking up the right include path
and testing for the library in the wrong location.
We now allow you to override the CPPFLAGS and LDFLAGS by doing
./configure LIBDPDK_CPPFLAGS="-I/path/to/your/libdpdk_headers" LIBDPDK_LDFLAGS="-L/path/to/your/libdpdk.so -Wl,--no-as-needed"
The nice thing is that these settings are now logged and remembered
between configure runs.
Ruben Kerkhof [Sat, 19 Nov 2016 10:58:36 +0000 (11:58 +0100)]
Enable detection of libdpdk by default
Otherwise we never exercise this check and it will just bitrot.
Taras Chornyi [Sat, 19 Nov 2016 16:02:22 +0000 (17:02 +0100)]
dpdkstat: Added support for dpdk 16.07.
Florian Forster [Sat, 19 Nov 2016 07:10:47 +0000 (08:10 +0100)]
configure.ac: Improve detection and usage of pthread_set_name_np(3).
Marc Fournier [Wed, 16 Nov 2016 09:12:10 +0000 (10:12 +0100)]
contrib/README: sort items
Marc Fournier [Wed, 16 Nov 2016 09:10:10 +0000 (10:10 +0100)]
contrib/docker: add instructions to README
Marc Fournier [Wed, 16 Nov 2016 09:00:44 +0000 (10:00 +0100)]
contrib/docker: add minimal example config file
Marc Fournier [Wed, 12 Oct 2016 05:14:20 +0000 (07:14 +0200)]
contrib/docker: add basic Dockerfile & config files
Marc Fournier [Wed, 5 Oct 2016 06:09:09 +0000 (08:09 +0200)]
contrib/docker: add LD_PRELOAD wrapper to fopen/open/opendir syscalls
Marc Fournier [Wed, 16 Nov 2016 06:49:25 +0000 (07:49 +0100)]
mqtt, gps: add name parameter to plugin_thread_create()
Manuel Luis Sanmartín Rozada [Sun, 9 Feb 2014 15:03:03 +0000 (16:03 +0100)]
Explain the need for _GNU_SOURCE
Manuel Luis Sanmartín Rozada [Sat, 8 Feb 2014 22:13:01 +0000 (23:13 +0100)]
Add support to set the thread name.
Florian Forster [Tue, 15 Nov 2016 08:34:57 +0000 (09:34 +0100)]
write_prometheus plugin: Escape label values.
Fixes: #2035
Florian Forster [Fri, 11 Nov 2016 20:24:21 +0000 (21:24 +0100)]
Merge remote-tracking branch 'github/pr/1967'
Florian Forster [Fri, 11 Nov 2016 19:42:36 +0000 (20:42 +0100)]
write_prometheus plugin: Use the "static" macro to specify PROMETHEUS_DEFAULT_STALENESS_DELTA.
Fixes:
write_prometheus.c:56:1: error: initializer element is not constant
static cdtime_t staleness_delta = PROMETHEUS_DEFAULT_STALENESS_DELTA;
^
Florian Forster [Mon, 24 Oct 2016 07:03:32 +0000 (09:03 +0200)]
write_prometheus plugin: Don't allocate metric families in prom_missing().
Marc Fournier [Tue, 1 Nov 2016 10:15:24 +0000 (11:15 +0100)]
write_prometheus: add support for libmicrohttpd 0.9.45+
Add switch on MHD_VERSION to support both legacy and modern MHD functions.
`MHD_create_response_from_data()` is deprecated since libmicrohttpd
0.9.5 and makes the build fail since 0.9.45.
Florian Forster [Sat, 1 Oct 2016 19:22:12 +0000 (21:22 +0200)]
write_prometheus plugin: Improve performance of metric_cmp().
This function is a hotspot because it is used by bsearch() to look up
metrics in a metric family. This simple (though non-obvious) change
brings prom_write() complexity down from 3000 instructions/call to 2640
instructions/call, i.e. a 12% improvement.
Florian Forster [Sat, 1 Oct 2016 08:12:41 +0000 (10:12 +0200)]
write_prometheus plugin: Optimize metric_family_get_metric().
Profiling showed that prom_write() spent 73% of its time in this
function. 36% of time was spent in metric_create() and 19% was spent in
metric_destroy().
This patch replaces these two calls by a stack allocation, reducing the
time prom_write() spends in metric_family_get_metric() to 42%.
Florian Forster [Thu, 29 Sep 2016 19:38:24 +0000 (21:38 +0200)]
write_prometheus plugin: New plugin for exposing metrics to Prometheus.
Florian Forster [Fri, 11 Nov 2016 13:34:20 +0000 (14:34 +0100)]
collectd-tg: Fix sleep interval.
nanosleep() was called with the current time, meaning that it would
block for years. This correctly subtracts "now" from the metric's time
and only sleeps for the duration between the two.