From 7f2e67d40d1006e88fda86eb04699c15db3440ee Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Wed, 11 Oct 2017 15:08:49 +0530 Subject: metrics: provide options to dump metrics from xlators * Introduce xlator methods to allow dumping of metrics * Separate options to get the metrics dumped in a path Updates #168 Change-Id: I7df80df33b71d6f449f03c2332665b4a45f6ddf2 Signed-off-by: Amar Tumballi --- libglusterfs/src/globals.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'libglusterfs/src/globals.c') diff --git a/libglusterfs/src/globals.c b/libglusterfs/src/globals.c index 6bed1b546ee..f1eaccc9305 100644 --- a/libglusterfs/src/globals.c +++ b/libglusterfs/src/globals.c @@ -157,6 +157,9 @@ global_xl_reconfigure (xlator_t *this, dict_t *options) GF_OPTION_RECONF ("measure-latency", bool_opt, options, bool, out); this->ctx->measure_latency = bool_opt; + GF_OPTION_RECONF ("metrics-dump-path", this->ctx->config.metrics_dumppath, + options, str, out); + /* TODO: add more things here */ ret = 0; out: @@ -166,7 +169,19 @@ out: static int global_xl_init (xlator_t *this) { - return 0; + int ret = -1; + gf_boolean_t bool_opt = false; + + GF_OPTION_INIT ("measure-latency", bool_opt, bool, out); + this->ctx->measure_latency = bool_opt; + + GF_OPTION_INIT ("metrics-dump-path", this->ctx->config.metrics_dumppath, + str, out); + + ret = 0; + +out: + return ret; } static void @@ -184,6 +199,14 @@ struct volume_options global_xl_options[] = { .tags = {"global", "context"}, .description = "Use this option to toggle measuring latency" }, + { .key = {"metrics-dump-path"}, + .type = GF_OPTION_TYPE_STR, + .default_value = "{{gluster_workdir}}/metrics", + .op_version = {GD_OP_VERSION_4_0_0}, + .flags = OPT_FLAG_SETTABLE, + .tags = {"global", "context"}, + .description = "Use this option to set the metrics dump path" + }, { .key = {NULL},}, }; -- cgit