X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fcouchdb.c;h=30f56da7bee0e3bbd6a0a51c3c5778a2f49f121c;hb=1061f214d8ec98341f3c3dba6a0ec3d37ce246ee;hp=361e9e93c1155700c14c003ba6423e9341fdbee0;hpb=54232abc855778f381b96a63b75c1a97240402aa;p=collectd.git diff --git a/src/couchdb.c b/src/couchdb.c index 361e9e93..30f56da7 100644 --- a/src/couchdb.c +++ b/src/couchdb.c @@ -142,9 +142,15 @@ static int couchcb_integer (void *ctx, long val) type = couchdb_get_type (key); if (type == DS_TYPE_COUNTER) - vt.counter = val; + vt.counter = (counter_t) val; + else if (type == DS_TYPE_GAUGE) + vt.gauge = (gauge_t) val; + else if (type == DS_TYPE_DERIVE) + vt.derive = (derive_t) val; + else if (type == DS_TYPE_ABSOLUTE) + vt.absolute = (absolute_t) val; else - vt.gauge = (double)val; + return 0; couchdb_submit (db, key, &vt); } @@ -162,10 +168,16 @@ static int couchcb_double (void *ctx, double val) int type; type = couchdb_get_type (key); - if (type == DS_TYPE_GAUGE) - vt.gauge = val; + if (type == DS_TYPE_COUNTER) + vt.counter = (counter_t) val; + else if (type == DS_TYPE_GAUGE) + vt.gauge = (gauge_t) val; + else if (type == DS_TYPE_DERIVE) + vt.derive = (derive_t) val; + else if (type == DS_TYPE_ABSOLUTE) + vt.absolute = (absolute_t) val; else - vt.counter = val; + return 0; couchdb_submit (db, key, &vt); }