[Disk Manager] Add ability to report external storage limits/usage#6552
[Disk Manager] Add ability to report external storage limits/usage#6552jkuradobery wants to merge 7 commits into
Conversation
|
Note This is an automated comment that will be appended during run. Note All workloads for linux-x86_64-relwithdebinfo have completed. Tip Planned checks for linux-x86_64-relwithdebinfo. |
|
Note This is an automated comment that will be appended during run. Note All workloads for linux-x86_64-relwithdebinfo have completed. Tip Planned checks for linux-x86_64-relwithdebinfo. |
There was a problem hiding this comment.
Pull request overview
This PR adds a new snapshot storage quota/usage metrics reporting hook to Disk Manager’s dataplane, wiring a quota reporter into the periodic snapshot metrics collection and extending tests/helpers to validate the new gauges are exported.
Changes:
- Introduces
pkg/snapshotquota reporter interface plus a stub implementation that exportsused_bytes/limit_bytesgauges. - Wires reporter construction through
app.Run(...)→initDataplane(...)→dataplane.RegisterForExecution(...)and callsReport()fromcollectSnapshotMetricsTask. - Extends facade test utilities to read Prometheus gauges and adds a metrics test asserting the new dataplane gauges exist.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| cloud/disk_manager/pkg/ya.make | Adds snapshot package to build recursion. |
| cloud/disk_manager/pkg/snapshot/ya.make | New Go library target for snapshot quota reporting. |
| cloud/disk_manager/pkg/snapshot/quota.go | Defines quota reporter interface + constructor function type. |
| cloud/disk_manager/pkg/snapshot/quota_stub.go | Stub reporter that publishes quota gauges with bucket tag. |
| cloud/disk_manager/pkg/app/run.go | Threads quota reporter factory into app startup. |
| cloud/disk_manager/pkg/app/dataplane.go | Instantiates reporter and passes it into dataplane registration. |
| cloud/disk_manager/internal/pkg/dataplane/register.go | Extends registration to accept the quota reporter and pass it into task construction. |
| cloud/disk_manager/internal/pkg/dataplane/collect_snapshot_metrics_task.go | Calls quotaReporter.Report() on each metrics tick and logs failures. |
| cloud/disk_manager/internal/pkg/facade/testcommon/common.go | Adds gauge retrieval helpers (GetGauge(s)) for Prometheus metrics tests. |
| cloud/disk_manager/internal/pkg/facade/disk_service_test/disk_service_metrics_test.go | Adds assertions for the new quota gauges. |
| cloud/disk_manager/cmd/disk-manager/main.go | Wires the stub quota reporter into the disk-manager binary. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1b9579046d
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
Note This is an automated comment that will be appended during run. Note All workloads for linux-x86_64-relwithdebinfo have completed. Tip Planned checks for linux-x86_64-relwithdebinfo. |
|
Note This is an automated comment that will be appended during run. Note All workloads for linux-x86_64-relwithdebinfo have completed. Tip Planned checks for linux-x86_64-relwithdebinfo. 🟢 linux-x86_64-relwithdebinfo target: cloud/disk_manager/ (test time: 2100s): all tests PASSED for commit 0a5717a.
|
|
|
||
| //////////////////////////////////////////////////////////////////////////////// | ||
|
|
||
| func (c collectSnapshotMetricsTask) clearMetrics() { |
There was a problem hiding this comment.
It looks like we need to clear the quota metrics here, along with other metrics such as snapshots/count
There was a problem hiding this comment.
I do not think we need to delete quota metrics here. We can just do max(usage) / min(limit) and call it a day.
We also do not unregister other metrics in clearMetrics, such as totalStorageSize, so I do not see the reason to delete the metric.
There was a problem hiding this comment.
We also do not unregister other metrics in clearMetrics
Looks like we missed that, so it is a bug
There was a problem hiding this comment.
We can just do max(usage) / min(limit) and call it a day.
Looks very kostylno and does not work correctly as well
There was a problem hiding this comment.
Yes this is not a correct behavior. We can actually fail within the task for any reason, yet the disk-manager would keep on running, thus reporting metrics, which may lead to stale metrics.
| import ( | ||
| "context" | ||
|
|
||
| snapshot_config "github.com/ydb-platform/nbs/cloud/disk_manager/internal/pkg/dataplane/snapshot/config" |
There was a problem hiding this comment.
We should not reference internal packages here
There was a problem hiding this comment.
See auth in the same package
|
Note This is an automated comment that will be appended during run. Note All workloads for linux-x86_64-relwithdebinfo have completed. Tip Planned checks for linux-x86_64-relwithdebinfo. |
|
Note This is an automated comment that will be appended during run. Note All workloads for linux-x86_64-relwithdebinfo have completed. Tip Planned checks for linux-x86_64-relwithdebinfo. 🟢 linux-x86_64-relwithdebinfo target: cloud/disk_manager/ (test time: 2180s): all tests PASSED for commit 3bbd6a2.
|
|
Note This is an automated comment that will be appended during run. Note All workloads for linux-x86_64-relwithdebinfo have completed. Tip Planned checks for linux-x86_64-relwithdebinfo. |
|
Note This is an automated comment that will be appended during run. Note All workloads for linux-x86_64-relwithdebinfo have completed. Tip Planned checks for linux-x86_64-relwithdebinfo. 🟢 linux-x86_64-relwithdebinfo target: cloud/disk_manager/ (test time: 3953s): all tests PASSED for commit 5b9853d.
|
Notes
We would like to be able to add additional snapshot metrics reporting (e.g. ydb storage usage from ydb-controlplane, S3 storage usage via api).
We want disk-manager to report it's storage metrics without us having to rely on external metrics providers.