projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'collectd-5.0'
[collectd.git]
/
src
/
pinba.c
diff --git
a/src/pinba.c
b/src/pinba.c
index
ee790ff
..
26aa539
100644
(file)
--- a/
src/pinba.c
+++ b/
src/pinba.c
@@
-135,12
+135,15
@@
static void float_counter_add (float_counter_t *fc, float val) /* {{{ */
}
} /* }}} void float_counter_add */
}
} /* }}} void float_counter_add */
-static derive_t float_counter_get (const float_counter_t *fc) /* {{{ */
+static derive_t float_counter_get (const float_counter_t *fc, /* {{{ */
+ uint64_t factor)
{
{
- if (fc->n >= 500000000)
- return ((derive_t) (fc->i + 1));
- else
- return ((derive_t) fc->i);
+ derive_t ret;
+
+ ret = (derive_t) (fc->i * factor);
+ ret += (derive_t) (fc->n / (1000000000 / factor));
+
+ return (ret);
} /* }}} derive_t float_counter_get */
static void strset (char **str, const char *new) /* {{{ */
} /* }}} derive_t float_counter_get */
static void strset (char **str, const char *new) /* {{{ */
@@
-374,7
+377,7
@@
static pinba_socket_t *pinba_socket_open (const char *node, /* {{{ */
assert (ai_list != NULL);
s = malloc (sizeof (*s));
assert (ai_list != NULL);
s = malloc (sizeof (*s));
- if (s
!
= NULL)
+ if (s
=
= NULL)
{
freeaddrinfo (ai_list);
ERROR ("pinba plugin: malloc failed.");
{
freeaddrinfo (ai_list);
ERROR ("pinba plugin: malloc failed.");
@@
-614,7
+617,7
@@
static int plugin_config (oconfig_item_t *ci) /* {{{ */
if (strcasecmp ("Address", child->key) == 0)
cf_util_get_string (child, &conf_node);
else if (strcasecmp ("Port", child->key) == 0)
if (strcasecmp ("Address", child->key) == 0)
cf_util_get_string (child, &conf_node);
else if (strcasecmp ("Port", child->key) == 0)
- cf_util_get_s
tring
(child, &conf_service);
+ cf_util_get_s
ervice
(child, &conf_service);
else if (strcasecmp ("View", child->key) == 0)
pinba_config_view (child);
else
else if (strcasecmp ("View", child->key) == 0)
pinba_config_view (child);
else
@@
-694,19
+697,23
@@
static int plugin_submit (const pinba_statnode_t *res) /* {{{ */
sstrncpy (vl.plugin_instance, res->name, sizeof (vl.plugin_instance));
value.derive = res->req_count;
sstrncpy (vl.plugin_instance, res->name, sizeof (vl.plugin_instance));
value.derive = res->req_count;
- sstrncpy (vl.type, "requests", sizeof (vl.type));
+ sstrncpy (vl.type, "total_requests", sizeof (vl.type));
+ plugin_dispatch_values (&vl);
+
+ value.derive = float_counter_get (&res->req_time, /* factor = */ 1000);
+ sstrncpy (vl.type, "total_time_in_ms", sizeof (vl.type));
plugin_dispatch_values (&vl);
plugin_dispatch_values (&vl);
- value.derive =
float_counter_get (&res->req_time)
;
- sstrncpy (vl.type, "total_
time
", sizeof (vl.type));
+ value.derive =
res->doc_size
;
+ sstrncpy (vl.type, "total_
bytes
", sizeof (vl.type));
plugin_dispatch_values (&vl);
plugin_dispatch_values (&vl);
- value.derive = float_counter_get (&res->ru_utime);
+ value.derive = float_counter_get (&res->ru_utime
, /* factor = */ 100
);
sstrncpy (vl.type, "cpu", sizeof (vl.type));
sstrncpy (vl.type_instance, "user", sizeof (vl.type_instance));
plugin_dispatch_values (&vl);
sstrncpy (vl.type, "cpu", sizeof (vl.type));
sstrncpy (vl.type_instance, "user", sizeof (vl.type_instance));
plugin_dispatch_values (&vl);
- value.derive = float_counter_get (&res->ru_stime);
+ value.derive = float_counter_get (&res->ru_stime
, /* factor = */ 100
);
sstrncpy (vl.type, "cpu", sizeof (vl.type));
sstrncpy (vl.type_instance, "system", sizeof (vl.type_instance));
plugin_dispatch_values (&vl);
sstrncpy (vl.type, "cpu", sizeof (vl.type));
sstrncpy (vl.type_instance, "system", sizeof (vl.type_instance));
plugin_dispatch_values (&vl);