Skip to content

Implementation of alert and thershold. - #16

Merged
cb-srinaths merged 1 commit into
devfrom
feature/alert
Sep 11, 2026
Merged

cb-srinaths merged 1 commit into
devfrom
feature/alert

Conversation

@cb-alish

@cb-alish cb-alish commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features

    • Added alert status visibility to the usage page, including alert names, thresholds, and trigger times.
    • Added support for tracking active usage alerts and displaying alerts configured for a subscription.
    • Added automatic handling of alert-triggered and alert-resolved events.
    • Added default 80% usage-exceeded alerts for metered features during setup.
  • Bug Fixes

    • Improved alert synchronization when external alert status updates are received.
    • Resolved alerts are removed from active alert results.

⚠️ Note: Your high-level summary instructions were not applied because this feature is currently available only on Essentials plans or higher.

@coderabbitai

coderabbitai Bot commented Sep 10, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Free

Run ID: 8022bedd-6441-4527-a16d-2aca9127dc58

📥 Commits

Reviewing files that changed from the base of the PR and between 1e2af9f and 050c084.

📒 Files selected for processing (9)
  • pointer/.gitignore
  • pointer/app/api/alerts/status/route.ts
  • pointer/app/usage/page.tsx
  • pointer/lib/alerts/provider.ts
  • pointer/lib/alerts/sync.ts
  • pointer/lib/events/types.ts
  • pointer/package.json
  • pointer/scripts/bootstrap-chargebee.ts
  • pointer/workers/chargebee-webhook-processor.ts

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


Walkthrough

The change adds Chargebee alert bootstrapping, webhook synchronization, Redis-backed alarm storage, an alert status API route, and active alarm rendering on the usage page. It also adds worker logging support.

Changes

Chargebee alert monitoring

Layer / File(s) Summary
Alert definitions and alarm aggregation
pointer/lib/alerts/provider.ts, pointer/scripts/bootstrap-chargebee.ts
The provider lists alerts and statuses, stores local alarms in Redis, and merges local alarms with Chargebee alarms. Bootstrap creates default 80% usage alerts for metered features.
Alert webhook synchronization
pointer/lib/events/types.ts, pointer/lib/alerts/sync.ts, pointer/workers/chargebee-webhook-processor.ts, pointer/package.json, pointer/.gitignore
Alert webhooks emit trigger or resolution events, update local alarm state, and bypass unrelated subscription processing. Worker output is appended to an ignored log file.
Alert status API and usage display
pointer/app/api/alerts/status/route.ts, pointer/app/usage/page.tsx
The API returns authenticated subscription alarms enriched with alert definitions. The usage page displays alarm names, thresholds, and trigger timestamps.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Chargebee
  participant ChargebeeWebhookProcessor
  participant processAlertWebhook
  participant RedisAlarmStorage
  Chargebee->>ChargebeeWebhookProcessor: alert_status_changed webhook
  ChargebeeWebhookProcessor->>processAlertWebhook: process alert event
  processAlertWebhook->>RedisAlarmStorage: persist active or resolved alarm
Loading

Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Essentials by visiting https://app.coderabbit.ai/settings/billing.

Comment @coderabbitai help to get the list of available commands.

@snyk-io

snyk-io Bot commented Sep 10, 2026 •

Copy link
Copy Markdown

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Open Source Security 0 0 0 0 0 issues
✅ Licenses 0 0 0 0 0 issues
✅ Code Security 0 0 0 0 0 issues
✅ Secrets 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@cb-srinaths
cb-srinaths merged commit 72c269d into dev Sep 11, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants