From d449cf0941e4804be916bf138d80267669ed43eb Mon Sep 17 00:00:00 2001 From: Danil Osherov Date: Thu, 11 Jun 2015 13:24:01 +0300 Subject: [PATCH 1/5] update to handystats' printf-like syntax. Printf-like syntax is supported starting from version 1.11 --- cache/cache.cpp | 2 +- example/eblob_backend.c | 2 +- library/dnet.c | 4 ++-- library/pool.c | 12 ++++++------ monitor/measure_points.h | 4 ---- 5 files changed, 10 insertions(+), 14 deletions(-) diff --git a/cache/cache.cpp b/cache/cache.cpp index 95eab4082..6067c33b5 100644 --- a/cache/cache.cpp +++ b/cache/cache.cpp @@ -209,7 +209,7 @@ int dnet_cmd_cache_io(struct dnet_backend_io *backend, struct dnet_net_state *st cache_manager *cache = (cache_manager *)backend->cache; std::shared_ptr d; - FORMATTED(HANDY_TIMER_SCOPE, ("cache.%s", dnet_cmd_string(cmd->cmd))); + HANDY_TIMER_SCOPE(("cache.%s", dnet_cmd_string(cmd->cmd))); try { switch (cmd->cmd) { diff --git a/example/eblob_backend.c b/example/eblob_backend.c index dda6c5ebe..e627cfa47 100644 --- a/example/eblob_backend.c +++ b/example/eblob_backend.c @@ -804,7 +804,7 @@ int blob_defrag_stop(void *priv) static int eblob_backend_command_handler(void *state, void *priv, struct dnet_cmd *cmd, void *data) { - FORMATTED(HANDY_TIMER_SCOPE, ("eblob_backend.cmd.%s", dnet_cmd_string(cmd->cmd))); + HANDY_TIMER_SCOPE(("eblob_backend.cmd.%s", dnet_cmd_string(cmd->cmd))); int err; struct eblob_backend_config *c = priv; diff --git a/library/dnet.c b/library/dnet.c index a76aeed5f..2a4c4e9c8 100644 --- a/library/dnet.c +++ b/library/dnet.c @@ -1042,10 +1042,10 @@ int dnet_process_cmd_raw(struct dnet_backend_io *backend, struct dnet_net_state int handled_in_cache = 0; HANDY_TIMER_SCOPE(recursive ? "io.cmd_recursive" : "io.cmd"); - FORMATTED(HANDY_TIMER_SCOPE, ("io.cmd%s.%s", (recursive ? "_recursive" : ""), dnet_cmd_string(cmd->cmd))); + HANDY_TIMER_SCOPE(("io.cmd%s.%s", (recursive ? "_recursive" : ""), dnet_cmd_string(cmd->cmd))); if (!(cmd->flags & DNET_FLAGS_NOLOCK)) { - FORMATTED(HANDY_TIMER_SCOPE, ("io.cmd.%s.lock_time", dnet_cmd_string(cmd->cmd))); + HANDY_TIMER_SCOPE(("io.cmd.%s.lock_time", dnet_cmd_string(cmd->cmd))); dnet_oplock(n, &cmd->id); } diff --git a/library/pool.c b/library/pool.c index a3452a2f5..495ce215e 100644 --- a/library/pool.c +++ b/library/pool.c @@ -335,8 +335,8 @@ void dnet_schedule_io(struct dnet_node *n, struct dnet_io_req *r) pthread_mutex_unlock(&place->lock); - FORMATTED(HANDY_TIMER_START, ("pool.%s.queue.wait_time", thread_stat_id), (uint64_t)&r->req_entry); - FORMATTED(HANDY_COUNTER_INCREMENT, ("pool.%s.queue.size", thread_stat_id), 1); + HANDY_TIMER_START(("pool.%s.queue.wait_time", thread_stat_id), (uint64_t)&r->req_entry); + HANDY_COUNTER_INCREMENT(("pool.%s.queue.size", thread_stat_id), 1); HANDY_COUNTER_INCREMENT("io.input.queue.size", 1); } @@ -1091,10 +1091,10 @@ void *dnet_io_process(void *data_) HANDY_COUNTER_DECREMENT("io.input.queue.size", 1); - FORMATTED(HANDY_COUNTER_DECREMENT, ("pool.%s.queue.size", thread_stat_id), 1); - FORMATTED(HANDY_TIMER_STOP, ("pool.%s.queue.wait_time", thread_stat_id), (uint64_t)r); + HANDY_COUNTER_DECREMENT(("pool.%s.queue.size", thread_stat_id), 1); + HANDY_TIMER_STOP(("pool.%s.queue.wait_time", thread_stat_id), (uint64_t)r); - FORMATTED(HANDY_COUNTER_INCREMENT, ("pool.%s.active_threads", thread_stat_id), 1); + HANDY_COUNTER_INCREMENT(("pool.%s.active_threads", thread_stat_id), 1); st = r->st; cmd = r->header; @@ -1115,7 +1115,7 @@ void *dnet_io_process(void *data_) dnet_io_req_free(r); dnet_state_put(st); - FORMATTED(HANDY_COUNTER_DECREMENT, ("pool.%s.active_threads", thread_stat_id), 1); + HANDY_COUNTER_DECREMENT(("pool.%s.active_threads", thread_stat_id), 1); } dnet_log(n, DNET_LOG_NOTICE, "finished io thread: #%d, nonblocking: %d, backend: %zd", diff --git a/monitor/measure_points.h b/monitor/measure_points.h index a17aebfc3..c3eb0ad94 100644 --- a/monitor/measure_points.h +++ b/monitor/measure_points.h @@ -7,10 +7,6 @@ #else #include #endif - - #define __HANDY_NAME_USE BOOST_PP_CAT(__C_HANDY_NAME_BUF_, __LINE__) - #define __HANDY_NAME_SET(...) char __HANDY_NAME_USE[255]; snprintf(__HANDY_NAME_USE, (sizeof(__HANDY_NAME_USE) - 1), __VA_ARGS__) - #define FORMATTED(MACRO, NAME_ARGS, ...) __HANDY_NAME_SET NAME_ARGS; MACRO(__HANDY_NAME_USE, ##__VA_ARGS__) #else #include "monitor/handystats/stubs.h" #endif From f64e9d319af256d2f803bc47c738d0c80c442af3 Mon Sep 17 00:00:00 2001 From: Danil Osherov Date: Thu, 11 Jun 2015 15:14:40 +0300 Subject: [PATCH 2/5] example: handystats' config updated with new configuration format. New configuration format is: { "enable": , "dump-interval": , "defaults": { "moving-interval": , "histogram-bins": , "tags": ["", "", ...], "rate-unit": <"ns" | "us" | "ms" | "s" | "m" | "h"> }, "gauge": { }, "counter": { }, "timer": { "idle-timeout": , }, "": { } } --- example/handystats.json | 72 ++++++++++++++++++++++++++++++++++------- 1 file changed, 60 insertions(+), 12 deletions(-) diff --git a/example/handystats.json b/example/handystats.json index 2ca734c24..12894c9fd 100644 --- a/example/handystats.json +++ b/example/handystats.json @@ -1,21 +1,69 @@ { - "statistics": { + "enable": true, + "dump-interval": 1000, + + "defaults": { "moving-interval": 1000, - "histogram-bins": 30, + "rate-unit": "s", + "tags": [] + }, + "timer": { + "histogram-bins": 30 + }, + + "io.cmd.*.lock_time": { + "tags": ["quantile", "moving-avg"] + }, + + "io.cmd{,.[A-Z]*}": { + "tags": ["quantile", "moving-avg", "moving-count"] + }, + + "io.cmd_recursive{,.[A-Z]*}": { + "tags": ["quantile", "moving-avg"] + }, + + "cache.{READ,WRITE,DEL}": { + "tags": ["quantile", "moving-avg"] + }, + + "eblob_backend.cmd.{READ,WRITE,LOOKUP,DEL,READ_RANGE,DEL_RANGE}": { + "tags": ["quantile", "moving-avg"] + }, + + "io.notify.{update,add,remove}": { + "tags": ["quantile", "moving-avg"] + }, + + "io.{cmds,forwards,replies}": { + "tags": ["rate"] + }, + + "io.{input,output}.queue.size": { + "tags": ["rate", "moving-avg"] + }, + + "pool.*.{blocking,nonblocking}.queue.size": { + "tags": ["rate", "moving-avg"] + }, + + "pool.*.{blocking,nonblocking}.queue.wait_time": { + "tags": ["quantile", "moving-avg"] + }, + + "pool.*.{blocking,nonblocking}.active_threads": { "tags": ["moving-avg"] }, - "metrics": { - "counter": { - "tags": ["moving-avg", "rate"] - }, - "timer": { - "idle-timeout": 60000, - "tags": ["moving-avg", "quantile"] - } + "eblob.*.{lookup,cache.lookup,disk.{read,write,remove,lookup}}": { + "tags": ["quantile", "moving-avg", "moving-count"] + }, + + "eblob.*.disk.{read,write,remove}.errors.*": { + "tags": ["value", "rate", "moving-avg"] }, - "metrics-dump": { - "interval": 1000 + "eblob.*.cache.size": { + "tags": ["value", "rate", "moving-avg"] } } From 72f9845c38952b3dad33308cfe128bbad4fccc0a Mon Sep 17 00:00:00 2001 From: Danil Osherov Date: Thu, 11 Jun 2015 15:24:36 +0300 Subject: [PATCH 3/5] example: minimal handystats config added. --- example/handystats_minimal.json | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 example/handystats_minimal.json diff --git a/example/handystats_minimal.json b/example/handystats_minimal.json new file mode 100644 index 000000000..e0bccdd6d --- /dev/null +++ b/example/handystats_minimal.json @@ -0,0 +1,19 @@ +{ + "enable": true, + + "defaults": { + "moving-interval": 1000, + "histogram-bins": 30, + "tags": ["moving-avg"] + }, + + "dump-interval": 1000, + + "counter": { + "tags": ["moving-avg", "rate"] + }, + "timer": { + "idle-timeout": 60000, + "tags": ["moving-avg", "quantile"] + } +} From 4d6e6d580c924a2c88ff74b9e2c439d13d391576 Mon Sep 17 00:00:00 2001 From: Danil Osherov Date: Thu, 11 Jun 2015 13:25:33 +0300 Subject: [PATCH 4/5] debian/control: update dependency on handystats (>= 1.11.1). --- debian/control | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/debian/control b/debian/control index 71e8c5b52..566fd12bc 100644 --- a/debian/control +++ b/debian/control @@ -24,14 +24,14 @@ Build-Depends: cdbs, python-pip, python-virtualenv, msgpack-python | python-msgpack, - handystats (>= 1.10.2) + handystats (>= 1.11.1) Standards-Version: 3.8.0 Homepage: http://www.ioremap.net/projects/elliptics XS-Python-Version: >= 2.6 Package: elliptics Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, eblob (>= 0.22.22), elliptics-client (= ${Source-Version}), libcocaine-core2, handystats (>= 1.10.0) +Depends: ${shlibs:Depends}, ${misc:Depends}, eblob (>= 0.22.22), elliptics-client (= ${Source-Version}), libcocaine-core2, handystats (>= 1.11.1) Replaces: elliptics-2.10, srw Provides: elliptics-2.10 Description: Distributed hash table storage @@ -39,7 +39,7 @@ Description: Distributed hash table storage Package: elliptics-client Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, msgpack-python | python-msgpack, handystats (>= 1.10.0) +Depends: ${shlibs:Depends}, ${misc:Depends}, msgpack-python | python-msgpack, handystats (>= 1.11.1) Replaces: elliptics-2.10 Description: Distributed hash table storage (client library) Elliptics network is a fault tolerant distributed hash table object storage. From b69501e0134e553af0929f992503e1f472cde9df Mon Sep 17 00:00:00 2001 From: Danil Osherov Date: Thu, 11 Jun 2015 13:26:24 +0300 Subject: [PATCH 5/5] spec: update dependency on handystats (>= 1.11.1). --- elliptics-bf.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/elliptics-bf.spec b/elliptics-bf.spec index 415928a68..c1abda802 100644 --- a/elliptics-bf.spec +++ b/elliptics-bf.spec @@ -19,7 +19,7 @@ BuildRequires: eblob-devel >= 0.22.22 BuildRequires: libblackhole-devel >= 0.2.3-1 BuildRequires: libev-devel libtool-ltdl-devel BuildRequires: cmake msgpack-devel python-msgpack -BuildRequires: handystats >= 1.10.2 +BuildRequires: handystats >= 1.11.1 %define boost_ver %{nil}