diff options
author | Shreyas Siravara <sshreyas@fb.com> | 2017-09-07 15:54:22 -0700 |
---|---|---|
committer | Shreyas Siravara <sshreyas@fb.com> | 2017-09-07 23:42:44 +0000 |
commit | e698fd3e3a0ff8f54e31e810706a011cdf938dca (patch) | |
tree | db90148121d8a2404d4ffd8f29b71f67e2b17ed7 | |
parent | 9aca3f636b0fbf3122e6893c9771c08d7eb5c9f6 (diff) |
io-stats: Error count and rate collection
Summary:
- This diff adds error counts and rates to the regular io-stats dump.
- It outputs keys that look like this:
"storage.gluster.nfsd.groot.aggr.errors.<error_name>.count": "6",
"storage.gluster.nfsd.groot.inter.errors.<error_name>.per_sec": "0.00"
- <error_name> is the lowercase representation of errno values (e.g., ENOENT -> enoent, etc.)
- This is a port of D4691581 to 3.8
Reviewers: dph, kvigor
Reviewed By: kvigor
Change-Id: I96857d4283c47f9d330ae1978f113013e7c78a87
Reviewed-on: https://review.gluster.org/18230
Smoke: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Shreyas Siravara <sshreyas@fb.com>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
-rw-r--r-- | tests/basic/ios-dump.t | 1 | ||||
-rw-r--r-- | xlators/debug/io-stats/src/io-stats.c | 24 |
2 files changed, 25 insertions, 0 deletions
diff --git a/tests/basic/ios-dump.t b/tests/basic/ios-dump.t index ddeb19d01ac..8e16c036934 100644 --- a/tests/basic/ios-dump.t +++ b/tests/basic/ios-dump.t @@ -39,5 +39,6 @@ for i in {1..10}; do done EXPECT_WITHIN 30 "Y" check_brick_inter_stats fop.weighted_latency_ave_usec +EXPECT_WITHIN 30 "Y" check_brick_inter_stats errors.eio.per_sec cleanup diff --git a/xlators/debug/io-stats/src/io-stats.c b/xlators/debug/io-stats/src/io-stats.c index 2835b0a3f6e..50917d13c83 100644 --- a/xlators/debug/io-stats/src/io-stats.c +++ b/xlators/debug/io-stats/src/io-stats.c @@ -127,6 +127,7 @@ struct ios_global_stats { uint64_t fop_hits[GF_FOP_MAXVALUE]; struct timeval started_at; struct ios_lat latency[GF_FOP_MAXVALUE]; + uint64_t errno_count[IOS_MAX_ERRORS]; uint64_t nr_opens; uint64_t max_nr_opens; struct timeval max_openfd_time; @@ -490,6 +491,11 @@ ios_track_fd (call_frame_t *frame, fd_t *fd) if (conf && conf->measure_latency && \ conf->count_fop_hits) { \ BUMP_FOP(op); \ + if (op_ret != 0 && op_errno > 0 \ + && op_errno < IOS_MAX_ERRORS) { \ + conf->cumulative.errno_count[op_errno]++; \ + conf->incremental.errno_count[op_errno]++; \ + } \ gettimeofday (&frame->end, NULL); \ update_ios_latency (conf, frame, GF_FOP_##op, \ op_ret, op_errno); \ @@ -1011,7 +1017,9 @@ io_stats_dump_global_to_json_logfp (xlator_t *this, int ret = 1; /* Default to error */ int rw_size; char *rw_unit = NULL; + const char *errno_name = NULL; long fop_hits; + long error_count; float fop_lat_ave; float fop_lat_min; float fop_lat_max; @@ -1086,6 +1094,22 @@ io_stats_dump_global_to_json_logfp (xlator_t *this, key_prefix, str_prefix, conf->cumulative.max_nr_opens); } + for (i = 0; i < IOS_MAX_ERRORS; i++) { + errno_name = errno_to_name[i]; + error_count = stats->errno_count[i]; + if (interval == -1) { + ios_log (this, logfp, + "\"%s.%s.errors.%s.count\": \"%"PRId64"\",", + key_prefix, str_prefix, errno_name, + error_count); + } else { + ios_log (this, logfp, + "\"%s.%s.errors.%s.per_sec\": \"%0.2lf\",", + key_prefix, str_prefix, errno_name, + (double)(error_count/interval_sec)); + } + } + for (i = 0; i < GF_FOP_MAXVALUE; i++) { lc_fop_name = strdupa (gf_fop_list[i]); for (j = 0; lc_fop_name[j]; j++) { |