summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 51612a1)
raw | patch | inline | side by side (parent: 51612a1)
author | Florian Forster <octo@collectd.org> | |
Fri, 22 May 2015 08:25:35 +0000 (10:25 +0200) | ||
committer | Florian Forster <octo@collectd.org> | |
Fri, 22 May 2015 08:25:35 +0000 (10:25 +0200) |
Fixes: #1039
src/utils_format_json.c | patch | blob | history | |
src/utils_format_json.h | patch | blob | history |
index 898b1725eac821acc99407c09061661abbeabca7..48aa4fc61c1eea967c15c3a51c934c374b48c23b 100644 (file)
--- a/src/utils_format_json.c
+++ b/src/utils_format_json.c
if (ds->ds[i].type == DS_TYPE_GAUGE)
{
if(isfinite (vl->values[i].gauge))
- BUFFER_ADD ("%g", vl->values[i].gauge);
+ BUFFER_ADD (JSON_GAUGE_FORMAT, vl->values[i].gauge);
else
BUFFER_ADD ("null");
}
}
if(isfinite (rates[i]))
- BUFFER_ADD ("%g", rates[i]);
+ BUFFER_ADD (JSON_GAUGE_FORMAT, rates[i]);
else
BUFFER_ADD ("null");
}
index c902e27220f2b542baa5cb43b19b24dc4291bec8..f8f5a355791d437e31e72f83ab1d4fca2d2695b5 100644 (file)
--- a/src/utils_format_json.h
+++ b/src/utils_format_json.h
#include "collectd.h"
#include "plugin.h"
+#ifndef JSON_GAUGE_FORMAT
+# define JSON_GAUGE_FORMAT "%.15g"
+#endif
+
int format_json_initialize (char *buffer,
size_t *ret_buffer_fill, size_t *ret_buffer_free);
int format_json_value_list (char *buffer,