From 1ab0aefbd026579dd12c7fb3372bd407cee3b27a Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Wed, 1 Jul 2009 14:54:55 +0200 Subject: [PATCH] couchdb plugin: Add the DERIVE and ABSOLUTE data source types. --- src/couchdb.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) 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); } -- 2.30.2