Skip to content

fix(API Usage): Allow self-hosted API usage alerts#6975

Merged
emyller merged 6 commits intomainfrom
feat/enterprise-usage-alerts
Mar 20, 2026
Merged

fix(API Usage): Allow self-hosted API usage alerts#6975
emyller merged 6 commits intomainfrom
feat/enterprise-usage-alerts

Conversation

@emyller
Copy link
Copy Markdown
Contributor

@emyller emyller commented Mar 18, 2026

  • I have read the Contributing Guide.
  • I have added information to docs/ if required so people know about the feature.
  • I have filled in the "Changes" section below.
  • I have filled in the "How did you test this code" section below.

Changes

Contributes to https://github.com/Flagsmith/infrastructure/issues/334

Deprecate get_current_api_usage (Influx) in favour of get_total_events_count (Influx/Postgres).

This is part of a plan to enable usage alert emails for self-hosted users, by [experimentally] reading usage data from local Postgres instead of InfluxDB — our usage backend in production.

How did you test this code?

Tests incoming as part of a private cloud endeavour.

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 18, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

3 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs Ignored Ignored Preview Mar 20, 2026 0:35am
flagsmith-frontend-preview Ignored Ignored Preview Mar 20, 2026 0:35am
flagsmith-frontend-staging Ignored Ignored Preview Mar 20, 2026 0:35am

Request Review

@github-actions github-actions bot added api Issue related to the REST API fix labels Mar 18, 2026
@emyller emyller self-assigned this Mar 19, 2026
@emyller emyller force-pushed the feat/enterprise-usage-alerts branch from 5455d1b to 5b1d009 Compare March 19, 2026 23:16
@github-actions github-actions bot added fix and removed fix labels Mar 19, 2026
@github-actions github-actions bot added fix and removed fix labels Mar 19, 2026
@emyller emyller force-pushed the feat/enterprise-usage-alerts branch from 9801c2a to fc9e700 Compare March 20, 2026 00:35
@github-actions github-actions bot added fix and removed fix labels Mar 20, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 20, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.32%. Comparing base (dcb0a37) to head (fc9e700).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6975      +/-   ##
==========================================
- Coverage   98.32%   98.32%   -0.01%     
==========================================
  Files        1335     1335              
  Lines       49876    49850      -26     
==========================================
- Hits        49039    49013      -26     
  Misses        837      837              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@emyller emyller marked this pull request as ready for review March 20, 2026 00:56
@emyller emyller requested a review from a team as a code owner March 20, 2026 00:56
@emyller emyller requested review from Zaimwa9 and removed request for a team March 20, 2026 00:56
Copy link
Copy Markdown

@claude claude bot left a comment

Choose a reason for hiding this comment

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

⚠️ Code review skipped — your organization's overage spend limit has been reached.

Code review is billed via overage credits. To resume reviews, an organization admin can raise the monthly limit in Settings → Usage.

Once credits are available, reopen this pull request to trigger a review.

@github-actions github-actions bot added fix and removed fix labels Mar 20, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 20, 2026

Docker builds report

Image Build Status Security report
ghcr.io/flagsmith/flagsmith-e2e:pr-6975 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-api-test:pr-6975 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-frontend:pr-6975 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-api:pr-6975 Finished ✅ Results
ghcr.io/flagsmith/flagsmith:pr-6975 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-private-cloud:pr-6975 Finished ✅ Results

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 20, 2026

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  10 passed

Details

stats  10 tests across 7 suites
duration  9.5 seconds
commit  fc9e700
info  🔄 Run: #15397 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  10 passed

Details

stats  10 tests across 7 suites
duration  11.3 seconds
commit  fc9e700
info  🔄 Run: #15397 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  2 passed

Details

stats  2 tests across 2 suites
duration  46.3 seconds
commit  fc9e700
info  🔄 Run: #15397 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  3 passed

Details

stats  3 tests across 3 suites
duration  1 minute, 11 seconds
commit  fc9e700
info  🔄 Run: #15397 (attempt 1)

Copy link
Copy Markdown
Member

@khvn26 khvn26 left a comment

Choose a reason for hiding this comment

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

Looks good in principle. I'd love to see more docs on the feature flag usage here (rationale, rollout plan).

@emyller
Copy link
Copy Markdown
Contributor Author

emyller commented Mar 20, 2026

Looks good in principle. I'd love to see more docs on the feature flag usage here (rationale, rollout plan).

I've updated the issue description with a [hopefully] clear rollout plan.

@emyller emyller merged commit 437abff into main Mar 20, 2026
51 checks passed
@emyller emyller deleted the feat/enterprise-usage-alerts branch March 20, 2026 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api Issue related to the REST API fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants