Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rgw: need to 'open_object_section' before dump stats in 'RGWGetUsage_… #9495

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 19 additions & 1 deletion PendingReleaseNotes
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,24 @@
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 allows you to dump the description of user stats
or not in s3 GetUsage API. This config option is of bool type and defaults to false.
If the value is true, the reponse data of s3 GetUsage like below:

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

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

{
516,
1024,
1
}.

11.0.0
------

Expand Down Expand Up @@ -51,4 +69,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 @@ -1478,6 +1478,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 @@ -430,10 +430,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