feat(monitoring): wire AwsCostCollectorService into cost scheduler#1085
Open
sadiqabubakar826-del wants to merge 1 commit into
Open
Conversation
- Replace hardcoded placeholder (0) with real Cost Explorer data - CostSchedulerService now delegates to AwsCostCollectorService.collectHourlyCost() - On collector failure, skip metric update and increment cost_collection_failures_total counter - Label infrastructure_hourly_cost_usd gauge with billing_period from Cost Explorer response - Remove duplicate @Cron from AwsCostCollectorService (scheduler drives the cycle) - Add billing_period label to CostTrackingService.recordHourlyCost() - Add 8 tests covering success path, failure path, and no-placeholder hygiene
|
@sadiqabubakar826-del Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Contributor
|
Well done on the job done so far! |
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.
Wire real AWS Cost Explorer data into the hourly cost scheduler
Previously, CostSchedulerService published a hard-coded 0 as the hourly cost metric on every
cycle, making any capacity planning or cost alerting built on that metric reason from a
constant rather than real data. AwsCostCollectorService already existed and could fetch live
Cost Explorer data, but was never connected to the scheduler.
───────────────────────────────────────────────────────────────────────────────────────────────
Changes
AwsCostCollectorService
a pure data-fetcher.
writing the metric itself. Returns null on any failure or when the collector is disabled, so
the caller can decide how to handle it.
convention and making the reporting delay explicit.
CostTrackingService
alert rules can see which window a data point describes.
CostSchedulerService
cost_collection_failures_total counter — failures are visible without publishing a fabricated
value.
cost-scheduler.service.spec.ts (new)
counter incremented on each failed cycle, no metric write on failure, and no hard-coded
placeholder published.
───────────────────────────────────────────────────────────────────────────────────────────────
Testing
pnpm test --testPathPattern="cost-scheduler" # 8/8 pass
pnpm test --testPathPattern="monitoring" # 61/61 pass (no regressions)
pnpm typecheck # clean
───────────────────────────────────────────────────────────────────────────────────────────────
Acceptance checklist
closes #1037