Skip to content

feat(telemetry): Push once per day instead once per hour - #8942

Draft
germangarces wants to merge 1 commit into
mainfrom
push-lzuwtywzttln
Draft

germangarces wants to merge 1 commit into
mainfrom
push-lzuwtywzttln

Conversation

@germangarces

@germangarces germangarces commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

Thanks for submitting a PR! Please check the boxes below:

  • 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

Switch telemetry reporting from once per hour to once per day.

Contributes to ENG-652

How did you test this code?

Tests pass

@germangarces
germangarces requested a review from a team as a code owner November 12, 2026 10:04
@germangarces
germangarces requested review from emyller and removed request for a team November 12, 2026 10:04
@vercel

vercel Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
docs Ready Ready Preview Nov 18, 2026 3:32pm UTC
2 Skipped Deployments
Project Deployment Actions Updated
flagsmith-frontend-preview Ignored Ignored Preview Nov 18, 2026 3:32pm UTC
flagsmith-frontend-staging Ignored Ignored Preview Nov 18, 2026 3:32pm UTC

Request Review

@github-actions github-actions Bot added the api Issue related to the REST API label Nov 12, 2026
@coderabbitai

coderabbitai Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Explain Change →

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • Resume reviews
  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

The usage reporting task now runs every 24 hours. The mapper accepts explicit window boundaries and uses them for usage queries and snapshot timestamps. Reporting state records each organisation’s last successfully pushed window. Snapshot submission retries selected HTTP responses and updates that state after a successful push. Tests and the event catalogue reflect these changes.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: Low · previous review 7f4d4

Daily reporting now advances per-organisation state, and a repeat run in the same hour no longer sends an empty snapshot. A small number of organisations may have some usage reported twice at the first daily run after deployment. The author has accepted this edge case, so it is a bounded risk to be aware of.

- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 25fd6676-9602-4dcf-8b70-d1e7e96678c5
Commits

Reviewing files that changed from the base of the PR and between fa9e523 and 7f4d491.

Files selected for processing: 1

  • api/tests/unit/organisations/usage_reporting/test_services.py

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 5 remain after this review.

@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Docker builds report

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

@github-actions github-actions Bot added the feature New feature or request label Nov 12, 2026

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

Major · Update the expected snapshot timestamp to the 24-hour window start. · test_mappers.py:55-80

api/tests/unit/organisations/usage_reporting/test_mappers.py:55-80
Major · Functional Correctness · Quick win

Update the expected snapshot timestamp to the 24-hour window start.

The mapper now sets timestamp to hour_start, which is 24 hours before the current hour. Under the frozen time 2026-06-18T09:30:00+00:00, that is 2026-06-17 09:00 UTC. Both test_map_organisation_to_usage_snapshot__with_usage__returns_populated_snapshot and test_map_organisation_to_usage_snapshot__no_analytics__returns_zeroed_snapshot still expect 2026-06-18 08:00 UTC. Each full UsageSnapshot comparison fails on timestamp, so the test suite fails at head.

The window bounds are not asserted in this file. Update the timestamp in both tests:

Suggested fix

-        timestamp=datetime(2026, 6, 18, 8, 0, 0, tzinfo=timezone.utc),
+        timestamp=datetime(2026, 6, 17, 9, 0, 0, tzinfo=timezone.utc),

Apply the same change in the zeroed-snapshot test.

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: baba5d1d-c915-4b72-b722-0c4ead45f7a3
Commits

Reviewing files that changed from the base of the PR and between d9c857a and 6354af3.

Files selected for processing: 2

  • api/organisations/tasks.py
  • api/organisations/usage_reporting/mappers.py

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

Comment thread api/organisations/tasks.py Resolved
@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor
✅ private-cloud · depot-ubuntu-latest-arm-16 — run #23092 (attempt 1)

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

passed  6 passed

Details

stats  6 tests across 5 suites
duration  35.9 seconds
commit  7f4d491
info  🔄 Run: #23092 (attempt 1)

🗂️ Previous results
✅ private-cloud · depot-ubuntu-latest-16 — run #23092 (attempt 1)

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

passed  3 passed

Details

stats  3 tests across 3 suites
duration  33.1 seconds
commit  7f4d491
info  🔄 Run: #23092 (attempt 1)

✅ oss · depot-ubuntu-latest-arm-16 — run #23092 (attempt 1)

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  36.3 seconds
commit  7f4d491
info  🔄 Run: #23092 (attempt 1)

✅ oss · depot-ubuntu-latest-16 — run #23092 (attempt 1)

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  30.8 seconds
commit  7f4d491
info  🔄 Run: #23092 (attempt 1)

✅ private-cloud · depot-ubuntu-latest-16 — run #23091 (attempt 1)

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

passed  3 passed

Details

stats  3 tests across 3 suites
duration  53.2 seconds
commit  fa9e523
info  🔄 Run: #23091 (attempt 1)

✅ oss · depot-ubuntu-latest-arm-16 — run #23091 (attempt 1)

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

passed  2 passed

Details

stats  2 tests across 2 suites
duration  37.1 seconds
commit  fa9e523
info  🔄 Run: #23091 (attempt 1)

✅ oss · depot-ubuntu-latest-16 — run #23091 (attempt 1)

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  31.8 seconds
commit  fa9e523
info  🔄 Run: #23091 (attempt 1)

✅ private-cloud · depot-ubuntu-latest-arm-16 — run #23089 (attempt 1)

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

passed  4 passed

Details

stats  4 tests across 4 suites
duration  45.1 seconds
commit  3879302
info  🔄 Run: #23089 (attempt 1)

✅ private-cloud · depot-ubuntu-latest-16 — run #23089 (attempt 1)

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

passed  2 passed

Details

stats  2 tests across 2 suites
duration  32.7 seconds
commit  3879302
info  🔄 Run: #23089 (attempt 1)

✅ oss · depot-ubuntu-latest-arm-16 — run #23090 (attempt 1)

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  33.3 seconds
commit  10154d3
info  🔄 Run: #23090 (attempt 1)

✅ oss · depot-ubuntu-latest-16 — run #23090 (attempt 1)

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

passed  2 passed

Details

stats  2 tests across 2 suites
duration  3.4 seconds
commit  10154d3
info  🔄 Run: #23090 (attempt 1)

✅ oss · depot-ubuntu-latest-arm-16 — run #23089 (attempt 1)

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  34.3 seconds
commit  3879302
info  🔄 Run: #23089 (attempt 1)

@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Visual Regression

24 screenshots compared. See report for details.
View full report

@germangarces
germangarces requested a review from a team as a code owner November 12, 2026 11:49
@github-actions github-actions Bot added docs Documentation updates feature New feature or request and removed feature New feature or request docs Documentation updates labels Nov 12, 2026
@codecov

codecov Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.92%. Comparing base (e9acd24) to head (dfdbaab).
⚠️ Report is 7 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff            @@
##             main    #8942    +/-   ##
========================================
  Coverage   98.92%   98.92%            
========================================
  Files        1713     1714     +1     
  Lines       72482    72582   +100     
========================================
+ Hits        71705    71805   +100     
  Misses        777      777            

☔ View full report in Codecov by Harness.
📢 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.

@coderabbitai coderabbitai 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.

Actionable comments posted: 5

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 7bc15325-0b28-40ce-a9f5-e7d095c37d71
Commits

Reviewing files that changed from the base of the PR and between 6354af3 and 25c43a7.

Files selected for processing: 7

  • api/organisations/migrations/0062_add_usage_reporting_state.py
  • api/organisations/models.py
  • api/organisations/usage_reporting/mappers.py
  • api/organisations/usage_reporting/services.py
  • api/tests/unit/organisations/usage_reporting/test_mappers.py
  • api/tests/unit/organisations/usage_reporting/test_services.py
  • docs/docs/deployment-self-hosting/observability/_events-catalogue.md

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

@github-actions github-actions Bot added the docs Documentation updates label Nov 12, 2026
@github-actions github-actions Bot added feature New feature or request docs Documentation updates and removed feature New feature or request docs Documentation updates labels Nov 12, 2026

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: ed405e70-b1b1-4cd7-8c29-e0241ca3c8a1
Commits

Reviewing files that changed from the base of the PR and between 25c43a7 and 10154d3.

Files selected for processing: 3

  • api/organisations/usage_reporting/services.py
  • api/tests/unit/organisations/usage_reporting/test_services.py
  • docs/docs/deployment-self-hosting/observability/_events-catalogue.md

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.

@github-actions github-actions Bot removed the feature New feature or request label Nov 12, 2026
@github-actions github-actions Bot added feature New feature or request and removed docs Documentation updates labels Nov 12, 2026

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 8ecc36c4-bb6a-4a01-9c3d-cda4e6eda8cc
Commits

Reviewing files that changed from the base of the PR and between 10154d3 and fa9e523.

Files selected for processing: 3

  • api/organisations/usage_reporting/services.py
  • api/tests/unit/organisations/usage_reporting/test_services.py
  • docs/docs/deployment-self-hosting/observability/_events-catalogue.md

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 5 remain after this review.

@github-actions github-actions Bot added docs Documentation updates feature New feature or request and removed feature New feature or request docs Documentation updates labels Nov 12, 2026
@germangarces
germangarces marked this pull request as draft November 18, 2026 11:01
@linear-code

linear-code Bot commented Nov 18, 2026

Copy link
Copy Markdown

ENG-652

@github-actions github-actions Bot added docs Documentation updates feature New feature or request and removed feature New feature or request docs Documentation updates labels Nov 18, 2026

This branch was successfully deployed

1 active deployment
Preview – docs — dfdbaabb Deployed Nov 18, 2026 by vercel[bot]
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 feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants