Skip to content

[Disk Manager] Add ability to report external storage limits/usage#6552

Open
jkuradobery wants to merge 7 commits into
mainfrom
users/jkuradobery/external-storage-metrics
Open

[Disk Manager] Add ability to report external storage limits/usage#6552
jkuradobery wants to merge 7 commits into
mainfrom
users/jkuradobery/external-storage-metrics

Conversation

@jkuradobery

Copy link
Copy Markdown
Collaborator

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.

Copilot AI review requested due to automatic review settings July 17, 2026 15:29
@github-actions

github-actions Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

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.

@jkuradobery jkuradobery added disk_manager Add this label to run only cloud/disk_manager build and tests on PR large-tests Launch large tests for PR labels Jul 17, 2026
@github-actions

github-actions Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/snapshot quota reporter interface plus a stub implementation that exports used_bytes / limit_bytes gauges.
  • Wires reporter construction through app.Run(...)initDataplane(...)dataplane.RegisterForExecution(...) and calls Report() from collectSnapshotMetricsTask.
  • 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.

Comment thread cloud/disk_manager/pkg/snapshot/quota_stub.go

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread cloud/disk_manager/internal/pkg/facade/testcommon/common.go Outdated
Comment thread cloud/disk_manager/cmd/disk-manager/main.go Outdated
@github-actions

github-actions Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

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.

@github-actions

github-actions Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

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.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
1948 1948 0 0 0 0 0

Comment thread cloud/disk_manager/pkg/snapshot/quota.go Outdated
Comment thread cloud/disk_manager/internal/pkg/facade/testcommon/common.go
Comment thread cloud/disk_manager/internal/pkg/facade/testcommon/common.go
Comment thread cloud/disk_manager/internal/pkg/facade/testcommon/common.go
Comment thread cloud/disk_manager/test/mocks/disk-manager/ya.make Outdated

////////////////////////////////////////////////////////////////////////////////

func (c collectSnapshotMetricsTask) clearMetrics() {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like we need to clear the quota metrics here, along with other metrics such as snapshots/count

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@SvartMetal SvartMetal Jul 22, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also do not unregister other metrics in clearMetrics

Looks like we missed that, so it is a bug

@SvartMetal SvartMetal Jul 22, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can just do max(usage) / min(limit) and call it a day.

Looks very kostylno and does not work correctly as well

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread cloud/disk_manager/pkg/snapshot/quota.go Outdated
Comment thread cloud/disk_manager/pkg/snapshot/quota.go
import (
"context"

snapshot_config "github.com/ydb-platform/nbs/cloud/disk_manager/internal/pkg/dataplane/snapshot/config"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should not reference internal packages here

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See auth in the same package

@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

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.

@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

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.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
1948 1948 0 0 0 0 0

@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

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.

@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

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.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
1948 1948 0 0 0 0 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

disk_manager Add this label to run only cloud/disk_manager build and tests on PR large-tests Launch large tests for PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants