summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b6fbfb1)
raw | patch | inline | side by side (parent: b6fbfb1)
author | Florian Forster <octo@collectd.org> | |
Fri, 22 May 2015 09:25:01 +0000 (11:25 +0200) | ||
committer | Florian Forster <octo@collectd.org> | |
Fri, 22 May 2015 09:25:01 +0000 (11:25 +0200) |
This fixes the postgresql, rrdtool, target_notification, write_graphite and
write_redis plugins to use the globally defined format for gauges.
Issue #1039
write_redis plugins to use the globally defined format for gauges.
Issue #1039
diff --git a/src/postgresql.c b/src/postgresql.c
index 1eaf6bd3877570a56c0e50c045b7e90cc888cda2..c240e5438297b28e29e7b04d7f1180dd102a979b 100644 (file)
--- a/src/postgresql.c
+++ b/src/postgresql.c
if (ds->ds[i].type == DS_TYPE_GAUGE)
status = ssnprintf (str_ptr, str_len,
- ",%f", vl->values[i].gauge);
+ ","GAUGE_FORMAT, vl->values[i].gauge);
else if (store_rates) {
if (rates == NULL)
rates = uc_get_rate (ds, vl);
diff --git a/src/rrdtool.c b/src/rrdtool.c
index c795e2656502685ca353937ddda2b9defcd3a518..bebf468c3c83ce8158a082207c7c950382bf0352 100644 (file)
--- a/src/rrdtool.c
+++ b/src/rrdtool.c
":%llu", vl->values[i].counter);
else if (ds->ds[i].type == DS_TYPE_GAUGE)
status = ssnprintf (buffer + offset, buffer_len - offset,
- ":%lf", vl->values[i].gauge);
+ ":"GAUGE_FORMAT, vl->values[i].gauge);
else if (ds->ds[i].type == DS_TYPE_DERIVE)
status = ssnprintf (buffer + offset, buffer_len - offset,
":%"PRIi64, vl->values[i].derive);
(unsigned) tt, vl->values[0].derive);
break;
case DS_TYPE_GAUGE:
- status = ssnprintf (buffer, buffer_len, "%u:%lf",
+ status = ssnprintf (buffer, buffer_len, "%u:"GAUGE_FORMAT,
(unsigned) tt, vl->values[0].gauge);
break;
case DS_TYPE_COUNTER:
index cb68048b6a8f7c042cdd37bbf7dc3c77a24bd754..b465438705709df64c02aca9241dcc5a5f95ab9e 100644 (file)
/* If this is a gauge value, use the current value. */
if (ds->ds[i].type == DS_TYPE_GAUGE)
ssnprintf (value_str, sizeof (value_str),
- "%g", (double) vl->values[i].gauge);
+ GAUGE_FORMAT, (double) vl->values[i].gauge);
/* If it's a counter, try to use the current rate. This may fail, if the
* value has been renamed. */
else if (rates != NULL)
ssnprintf (value_str, sizeof (value_str),
- "%g", (double) rates[i]);
+ GAUGE_FORMAT, (double) rates[i]);
/* Since we don't know any better, use the string `unknown'. */
else
sstrncpy (value_str, "unknown", sizeof (value_str));
index b7d4494d3ed0fda8d6ad9a17cca5193ffdae911b..e23d5d92c65599fecc29ac575ca48c68af2b3369 100644 (file)
} while (0)
if (ds->ds[ds_num].type == DS_TYPE_GAUGE)
- BUFFER_ADD ("%f", vl->values[ds_num].gauge);
+ BUFFER_ADD (GAUGE_FORMAT, vl->values[ds_num].gauge);
else if (rates != NULL)
BUFFER_ADD ("%f", rates[ds_num]);
else if (ds->ds[ds_num].type == DS_TYPE_COUNTER)
diff --git a/src/write_redis.c b/src/write_redis.c
index 1d9ec27c0b60bf43900e9504e4271ce12a623a70..09aae7028d24505a6f3cb372860b8eafb8d20a1e 100644 (file)
--- a/src/write_redis.c
+++ b/src/write_redis.c
if (ds->ds[i].type == DS_TYPE_COUNTER)
APPEND ("%llu", vl->values[i].counter);
else if (ds->ds[i].type == DS_TYPE_GAUGE)
- APPEND ("%g", vl->values[i].gauge);
+ APPEND (GAUGE_FORMAT, vl->values[i].gauge);
else if (ds->ds[i].type == DS_TYPE_DERIVE)
APPEND ("%"PRIi64, vl->values[i].derive);
else if (ds->ds[i].type == DS_TYPE_ABSOLUTE)