Repository navigation
feat: M3 DigitalOcean driver and request budgets - #82
Merged
Merged
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 4 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
The first provider driver. It authenticates with a bearer token, lists Droplets and load balancers 100 a page, and reads the catalog's metrics with one GET each under /v2/monitoring/metrics. Its operation list allows only GET under /v2/droplets, /v2/load_balancers, and /v2/monitoring/metrics. - Every URL is built from the fixed host, a catalog path, and a stored resource id that must match its type's pattern. Paging counts pages instead of following links.pages.next, so no URL from a response is requested, and a list past 1,000 pages fails rather than retire the resources it did not reach. - 401 is a rejected credential, 403 a missing scope, 429 throttling, and 5xx a transient failure. A credential, scope, or rate failure stops the collection run. - CPU is percent busy between the two newest samples, reading the per-mode series as cumulative seconds as the API example suggests. Bandwidth is converted from megabits to bits per second. A metric with no data, as without the metrics agent, gives no observation. - Load balancer label sets are undocumented, so a response with several series is reported as malformed rather than combined. - The estimate counts one request per series per collection. No charge is documented for DigitalOcean API calls. The driver is registered in production. CLOUD_OFFLINE=1 makes every driver's transport refuse all requests; CI sets it, so the real pages and collector run without reaching a provider. Tests use DigitalOcean's example responses from its API specification (Apache 2.0, annotated in REUSE.toml). The facts only a live account can settle, such as sample spacing and the 403 behaviour, still wait on #16. Refs #39 Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Before reading, the collector splits an account's series into those that fit its request budget and those that do not (REQ-BUDGET-001, REQ-BUDGET-002). A run may use the account's share of the provider's hourly limit spread over its interval, and never more than its share of the per-minute limit; discovery requests count against it, and a monthly cost ceiling cuts it further. Series are read in their stored order; the rest are marked unread with reason budget and the run's collection state is budget. With DigitalOcean's 5,000 an hour and 250 a minute at the default 50 percent share, 500 Droplets read 119 of 2,500 series in a five-minute run. Throttling (REQ-BUDGET-003): a 429 stops the account for the run and its Retry-After, in seconds or as a date and at most an hour, becomes the health row's new retry_at. The collector skips the account until then, and the health page shows the wait. The DigitalOcean driver also stops once ratelimit-remaining is down to the part of the token's limit left for its other users, until ratelimit-reset; discovery fails rather than return a cut-off list. Schema version 2 adds plugin_cloud_health.retry_at. Keeping tables on uninstall now also untracks columns that migrations added, since core drops tracked columns. Refs #40 Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Same treatment as the main-branch wrap: tabs, braces on the same line, one argument or array element per line, SQL broken at whitespace. The DigitalOcean metric catalog entries become multi-line arrays with the same keys and values. A token comparison against the previous commit matches for every file. Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
somethingwithproof
force-pushed
the
feat/m3-digitalocean
branch
from
November 15, 2026 08:54
95f5fc9 to
b3f24c9
Compare
Wrapping each catalog entry into a multi-line keyed array made the entries near-identical blocks, and SonarQube Cloud counted 190 duplicated lines (10.5% of new code against a 3% gate). Each metric is now a positional row on one line, and metric(), defaults() and paths() name the fields. Their results are unchanged for every metric and resource type. Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
One device per account and scope, with a script server data query per resource type whose indexes are provider resource IDs. The plugin owner decided it so milestone 3 can build the Cacti objects; the upstream proposal is not being pursued for now. Closes #10 Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
|
somethingwithproof
marked this pull request as ready for review
November 15, 2026 09:18
This was referenced Nov 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Milestone 3, first part: the DigitalOcean driver, request budgets, and the decision on how resources appear in Cacti. The Cacti objects (#42 to #45) and the cost preview (#41), which belongs on their graph screens, follow in separate PRs.
Closes #40
Closes #10
Refs #39
Refs #3
DigitalOcean driver (#39)
links.pages.next, so no URL from a response is ever requested. A list longer than 1,000 pages fails instead of retiring the resources it didn't reach./v2/monitoring/metrics. CPU percent busy comes from the two newest per-mode samples, read as cumulative seconds as the API example suggests. Bandwidth is converted from Mbit/s to bit/s. Load balancer metrics with several series are reported as malformed, because their label sets are undocumented./v2/droplets,/v2/load_balancersand/v2/monitoring/metrics(REQ-DO-006). Every URL is built from the fixed host, a catalog path, and a stored ID that has to match its type's pattern.CLOUD_OFFLINE=1makes every driver refuse all provider requests. CI sets it in the jobs that drive the real pages and collector.Still open for #39: live graphs and the facts only a live account can settle (sample spacing, whether CPU values really are cumulative, 403 behaviour, load balancer labels), all tracked on #16. REQ-DO-004's "graphs not offered" part needs the graph screens.
Request budgets and throttling (#40)
budget.plugin_cloud_health.retry_at. The collector skips the account until then, and the health page shows the wait. The driver also stops whenratelimit-remainingreaches the part of the limit left for the token's other users.retry_at. Keeping tables on uninstall now also untracks columns that migrations added, because core drops tracked columns.How resources appear in Cacti (#10)
ADR 0010: one device per account and scope, with a script server data query per resource type whose indexes are provider resource IDs. The plugin owner decided it so the Cacti objects can be built; the upstream proposal (#15) is not being pursued for now.
Style
After the rebase onto #83, the new lines over 120 characters are wrapped, and the DigitalOcean metric catalog is one row per metric. A token comparison shows no other change, and
metric(),defaults()andpaths()return the same results for every metric. SonarQube Cloud reports no open issues on this PR.Testing
retry_atthrough a kept-tables uninstall.