Repository navigation
rgw: read user usage log in S3 GetUsage - #69459
Conversation
GET /?usage is a service-level request with no bucket in the URL, so s->bucket is null and the usage log was never read. Entries and per-category ops in the response were therefore always empty even when usage logging was enabled. Read usage from the authenticated user instead, matching RGWUsage::show() behavior. Signed-off-by: ramin.najarbashi <[email protected]>
Extend radosgw-admin QA to call GET /?usage after usage data is flushed and verify CapacityUsed, Entries, and non-zero Ops. This guards the fix that reads usage from the authenticated user when no bucket is present in the service-level request. Signed-off-by: ramin.najarbashi <[email protected]>
s3_get_usage() used a broken SigV4 URL (?usage in path, empty region), which returned 403 in teuthology. Sign GET / with usage query param and default region us-east-1. Extend usage-s3-getusage to verify Entries owner, Summary ops/bytes, and cross-check against usage show. Add unit tests for XML parsing helpers. RGW returns nested XML (Entries, categories, CapacityUsed) that botocore could not parse into User/Bucket/Ops fields. Add wrapper shapes, flattened lists, resultWrapper Usage, and GetUsageStatsRequest. Set region_name in get_usage_stats.py example for correct SigV4 signing. Document usage logging requirement, start-date/end-date parameters, and Entries/CapacityUsed response fields alongside existing Summary stats. Signed-off-by: ramin.najarbashi <[email protected]>
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
16 similar comments
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
@cbodley |
|
@ceph/rgw Could someone please review this PR? Core change: fix S3 GET /?usage to read the user usage log when no bucket @cbodley — would appreciate your review on the RGW/S3 side when you have time. |
|
@AliMasarweh Is it possible if you have a chance to check this PR and give your opinion? |
|
Gentle ping @AliMasarweh @cbodley @ceph/rgw — still looking for a review when you have a moment. Also need |
|
@RaminNietzsche thanks for your patience, I had tasks with close deadline and an urgent costumer issues that I am working on for the past month. so I couldn't review your change |
AliMasarweh
left a comment
There was a problem hiding this comment.
the PR looks good, but I would like to keep the format of service-2.sdk-extras.json as it was before
|
ok to test |
Restore the previous formatting of service-2.sdk-extras.json and keep only the GetUsageStats schema additions needed for the example client, per review feedback. Signed-off-by: ramin.najarbashi <[email protected]>
I restored the previous formatting of service-2.sdk-extras.json and kept only the GetUsageStats schema. |
AliMasarweh
left a comment
There was a problem hiding this comment.
LGTM, a few nit picking comments about format
this will help identify where changes have occurred
| }, | ||
| "GetUsageStats":{ | ||
| "name":"GetUsageStats", | ||
| "name": "GetUsageStats", |
There was a problem hiding this comment.
| "name": "GetUsageStats", | |
| "name":"GetUsageStats", |
There was a problem hiding this comment.
Applied in f4fb1e0 — GetUsageStats entries now use the same compact key spacing as the surrounding operations/shapes.
| "method": "GET", | ||
| "requestUri": "/?usage", | ||
| "responseCode": 200 |
There was a problem hiding this comment.
| "method": "GET", | |
| "requestUri": "/?usage", | |
| "responseCode": 200 | |
| "method":"GET", | |
| "requestUri":"/?usage", | |
| "responseCode":200 |
There was a problem hiding this comment.
Applied in f4fb1e0 — GetUsageStats entries now use the same compact key spacing as the surrounding operations/shapes.
| "shape": "GetUsageStatsOutput", | ||
| "resultWrapper": "Usage" | ||
| }, | ||
| "documentationUrl": "https://docs.ceph.com/docs/master/radosgw/s3/serviceops#get-usage-stats", |
There was a problem hiding this comment.
| "documentationUrl": "https://docs.ceph.com/docs/master/radosgw/s3/serviceops#get-usage-stats", | |
| "documentationUrl":"https://docs.ceph.com/docs/master/radosgw/s3/serviceops#get-usage-stats", |
There was a problem hiding this comment.
Applied in f4fb1e0 — GetUsageStats entries now use the same compact key spacing as the surrounding operations/shapes.
| "documentation":"<p>A container for object tags filtering rules.</p>" | ||
| }, | ||
| "GetUsageStatsOutput": { | ||
| "GetUsageStatsOutput":{ |
There was a problem hiding this comment.
| "GetUsageStatsOutput":{ | |
| "GetUsageStatsOutput": { |
There was a problem hiding this comment.
Applied in f4fb1e0 — GetUsageStats entries now use the same compact key spacing as the surrounding operations/shapes.
| "Summary":{ | ||
| "shape": "UsageStatsSummary", |
There was a problem hiding this comment.
| "Summary":{ | |
| "shape": "UsageStatsSummary", | |
| "Summary": { | |
| "shape":"UsageStatsSummary", |
There was a problem hiding this comment.
Applied in f4fb1e0 — GetUsageStats entries now use the same compact key spacing as the surrounding operations/shapes.
| } | ||
| }, | ||
| "UsageStatsSummary": { | ||
| "UsageStatsSummary":{ |
There was a problem hiding this comment.
| "UsageStatsSummary":{ | |
| "UsageStatsSummary": { |
There was a problem hiding this comment.
Applied in f4fb1e0 — GetUsageStats entries now use the same compact key spacing as the surrounding operations/shapes.
| "members":{ | ||
| "User":{ | ||
| "shape": "UsageStatsSummaryUserList", | ||
| "locationName": "User" | ||
| }, | ||
| "QuotaMaxBytes":{ | ||
| "shape": "QuotaMaxBytes" | ||
| }, | ||
| "QuotaMaxBuckets":{ | ||
| "shape": "QuotaMaxBuckets" | ||
| }, | ||
| "QuotaMaxObjCount":{ | ||
| "shape": "QuotaMaxObjCount" | ||
| }, | ||
| "QuotaMaxBytesPerBucket":{ | ||
| "shape": "QuotaMaxBytesPerBucket" | ||
| }, | ||
| "QuotaMaxObjCountPerBucket":{ | ||
| "shape": "QuotaMaxObjCountPerBucket" | ||
| }, | ||
| "TotalBytes":{ | ||
| "shape": "TotalBytes" | ||
| }, | ||
| "TotalBytesRounded":{ | ||
| "shape": "TotalBytesRounded" | ||
| }, | ||
| "TotalEntries":{ | ||
| "shape": "TotalEntries" | ||
| } |
There was a problem hiding this comment.
| "members":{ | |
| "User":{ | |
| "shape": "UsageStatsSummaryUserList", | |
| "locationName": "User" | |
| }, | |
| "QuotaMaxBytes":{ | |
| "shape": "QuotaMaxBytes" | |
| }, | |
| "QuotaMaxBuckets":{ | |
| "shape": "QuotaMaxBuckets" | |
| }, | |
| "QuotaMaxObjCount":{ | |
| "shape": "QuotaMaxObjCount" | |
| }, | |
| "QuotaMaxBytesPerBucket":{ | |
| "shape": "QuotaMaxBytesPerBucket" | |
| }, | |
| "QuotaMaxObjCountPerBucket":{ | |
| "shape": "QuotaMaxObjCountPerBucket" | |
| }, | |
| "TotalBytes":{ | |
| "shape": "TotalBytes" | |
| }, | |
| "TotalBytesRounded":{ | |
| "shape": "TotalBytesRounded" | |
| }, | |
| "TotalEntries":{ | |
| "shape": "TotalEntries" | |
| } | |
| "members": { | |
| "User":{ | |
| "shape": "UsageStatsSummaryUserList", | |
| "locationName": "User" | |
| }, | |
| "QuotaMaxBytes":{"shape": "QuotaMaxBytes"}, | |
| "QuotaMaxBuckets":{"shape": "QuotaMaxBuckets"}, | |
| "QuotaMaxObjCount":{"shape": "QuotaMaxObjCount"}, | |
| "QuotaMaxBytesPerBucket":{"shape": "QuotaMaxBytesPerBucket" }, | |
| "QuotaMaxObjCountPerBucket":{"shape": "QuotaMaxObjCountPerBucket"}, | |
| "TotalBytes":{"shape": "TotalBytes"}, | |
| "TotalBytesRounded":{"shape": "TotalBytesRounded"}, | |
| "TotalEntries":{"shape": "TotalEntries"} |
There was a problem hiding this comment.
Applied in f4fb1e0 — GetUsageStats entries now use the same compact key spacing as the surrounding operations/shapes.
Apply AliMasarweh's review nits so the GetUsageStats entries in service-2.sdk-extras.json use the same compact key spacing as the surrounding operations and shapes. Signed-off-by: ramin.najarbashi <[email protected]>
Apply the same compact key spacing to the rest of the GetUsageStats / UsageStats schema shapes introduced in this series, so they match the surrounding entries and the earlier formatting nits. Signed-off-by: ramin.najarbashi <[email protected]>
|
@AliMasarweh thanks again for the review. Formatting nits on
The related review threads are resolved. Jenkins is re-running on the latest tip. If that looks good, a formal Approve would help move this forward. Happy to rebase onto current |
Use the compact one-line member form AliMasarweh suggested for UsageStatsSummary in service-2.sdk-extras.json. Signed-off-by: ramin.najarbashi <[email protected]>
Collapse single-member shapes onto one line and align inner spacing for all GetUsageStats/UsageStats* definitions added by this PR in examples/rgw/boto3/service-2.sdk-extras.json, matching the compact style requested in review. Signed-off-by: ramin.najarbashi <[email protected]>
AliMasarweh
left a comment
There was a problem hiding this comment.
LGTM, Great job @RaminNietzsche
|
jenkins test api |
|
This PR has been added to main integration testing by anuchaithra started 2026-08-11-06:41. |
pr testing completed and approved by @ivancich. @RaminNietzsche if no further testing is needed then this pr can be merged |
|
Backports opened for active targets (parent tracker https://tracker.ceph.com/issues/79539): |
Summary
Hi! This PR fixes a long-standing gap in Ceph’s S3 extension
GET /?usage.The problem: When you call
GET /?usage(no bucket in the URL), RGW onlyread the usage log if
s->bucketwas set — which it isn’t for thisservice-level request. So
Entries(per-op stats likeput_obj,get_obj)stayed empty even with
rgw enable usage log = true. You still got storageinfo (
CapacityUsed,Summary.TotalBytes), but the ops side looked broken.The fix: In
RGWGetUsage::execute(), when there’s no bucket in the URL,read usage from the authenticated user (
s->user->read_usage()), same ideaas
radosgw-admin usage show.On top of the code fix, this PR also:
radosgw-adminteuthology task to callGET /?usageafter usage data is flushed, fixes SigV4 signing for thatrequest, and adds stronger checks (owner, Summary ops, TotalBytes).
service-2.sdk-extras.jsonsoget_usage_stats()actually parses RGW’s XML (
Entries,categories,CapacityUsed) insteadof returning empty
{}fields.doc/radosgw/s3/serviceops.rstwith usage-logrequirement, date filters, and response field descriptions.
Why each part matters
rgw_op.ccfixEntriesis always empty onGET /?usage/?usagein the URL path →403in real testsrgw enable usage log = truefor ops statsTesting
Tested locally with vstart (
rgw enable usage log = true, usage tick 5s).Smoke test (
test_rgw_s3_getusage.py):Raw XML (
awscurl) —Entriesnow has real ops (create_bucket,put_obj,get_self_usage), plusSummaryandCapacityUsed:boto3 (
get_usage_stats.pywith updated sdk-extras) — structuredEntries.User[].Buckets.Bucket[],Summary, andCapacityUsedallpopulate correctly (HTTP 200).
Teuthology:
usage-s3-getusageruns inside theradosgw-admintask whenthe
rgw:singletonsuite is scheduled. Suggest:Checklist
Show available Jenkins commands
jenkins test classic perfJenkins Job | Jenkins Job Definitionjenkins test crimson perfJenkins Job | Jenkins Job Definitionjenkins test signedJenkins Job | Jenkins Job Definitionjenkins test make checkJenkins Job | Jenkins Job Definitionjenkins test make check arm64Jenkins Job | Jenkins Job Definitionjenkins test submodulesJenkins Job | Jenkins Job Definitionjenkins test dashboardJenkins Job | Jenkins Job Definitionjenkins test dashboard cephadmJenkins Job | Jenkins Job Definitionjenkins test apiJenkins Job | Jenkins Job Definitionjenkins test docsReadTheDocs | Github Workflow Definitionjenkins test ceph-volume allJenkins Jobs | Jenkins Jobs Definitionjenkins test windowsJenkins Job | Jenkins Job Definitionjenkins test rook e2eJenkins Job | Jenkins Job DefinitionYou must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.