Skip to content

Commit

Permalink
rgw: need to 'open_object_section' before dump stats in 'RGWGetUsage_…
Browse files Browse the repository at this point in the history
…ObjStore_S3::send_response()' function

Signed-off-by: weiqiaomiao <wei.qiaomiao@zte.com.cn>
  • Loading branch information
weiqiaomiao committed Jul 25, 2016
1 parent 1194331 commit 2da1e22
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
22 changes: 21 additions & 1 deletion PendingReleaseNotes
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,26 @@
listed in 'osd class default list' requires a capability naming the class
(e.g. 'allow class foo').

* The 'rgw_rest_getusage_op_compat' config option allow you to dump the description of user stats
or not in s3 GetUsage API.This config is bool type and its default value is false.
If the value is true, the reponse data of s3 GetUsage like bellow:

"stats": {
"TotalBytes": 516,
"TotalBytesRounded": 1024,
"TotalEntries": 1
}

Or if the value is false, the reponse of s3 GetUsage like bellow and as it do before we add this config:


{
516,
1024,
1
}.


11.0.0
------

Expand Down Expand Up @@ -51,4 +71,4 @@
development packages (lib*-dev) any more. As it is unneeded, and per
https://wiki.debian.org/ReleaseGoals/LAFileRemoval and
https://www.debian.org/doc/manuals/maint-guide/advanced.en.html,
we should remove them.
we should remove them.
2 changes: 2 additions & 0 deletions src/common/config_opts.h
Original file line number Diff line number Diff line change
Expand Up @@ -1474,6 +1474,8 @@ OPTION(rgw_swift_versioning_enabled, OPT_BOOL, false) // whether swift object ve

OPTION(rgw_list_bucket_min_readahead, OPT_INT, 1000) // minimum number of entries to read from rados for bucket listing

OPTION(rgw_rest_getusage_op_compat, OPT_BOOL, false) // dump description of total stats for s3 GetUsage API

OPTION(mutex_perf_counter, OPT_BOOL, false) // enable/disable mutex perf counter
OPTION(throttler_perf_counter, OPT_BOOL, true) // enable/disable throttler perf counter

Expand Down
12 changes: 11 additions & 1 deletion src/rgw/rgw_rest_s3.cc
Original file line number Diff line number Diff line change
Expand Up @@ -429,10 +429,20 @@ void RGWGetUsage_ObjStore_S3::send_response()
formatter->dump_int("SuccessfulOps", total_usage.successful_ops);
formatter->close_section(); // total
formatter->close_section(); // user
}
}

if (s->cct->_conf->rgw_rest_getusage_op_compat) {
formatter->open_object_section("Stats");
}

formatter->dump_int("TotalBytes", header.stats.total_bytes);
formatter->dump_int("TotalBytesRounded", header.stats.total_bytes_rounded);
formatter->dump_int("TotalEntries", header.stats.total_entries);

if (s->cct->_conf->rgw_rest_getusage_op_compat) {
formatter->close_section(); //Stats
}

formatter->close_section(); // summary
}
formatter->close_section(); // usage
Expand Down

0 comments on commit 2da1e22

Please sign in to comment.