Skip to content

refactor: Move telemetry reports to the telemetry app - #9015

Open
germangarces wants to merge 5 commits into
mainfrom
push-qsnsylxyonzx
Open

germangarces wants to merge 5 commits into
mainfrom
push-qsnsylxyonzx

Conversation

@germangarces

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

Moves the code that pushes organisation usage out of the organisations module into the telemetry module, where it should be.

It also simplifies the testing while still reaching 100% coverage.

Contributes to ENG-652

How did you test this code?

Added unit tests

@vercel

vercel Bot commented Nov 19, 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 19, 2026 3:28pm UTC
2 Skipped Deployments
Project Deployment Actions Updated
flagsmith-frontend-preview Ignored Ignored Preview Nov 19, 2026 3:28pm UTC
flagsmith-frontend-staging Ignored Ignored Preview Nov 19, 2026 3:28pm UTC

Request Review

@linear-code

linear-code Bot commented Nov 19, 2026

Copy link
Copy Markdown

ENG-652

@coderabbitai

coderabbitai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Usage snapshot generation and control-plane reporting moved from organisations to telemetry. Snapshots now cover the 24-hour period ending at the current hour and include usage totals, category breakdowns, organisation details and ranked project usage. A recurring task submits snapshots every 24 hours through a telemetry control-plane client. Tests and the event catalogue were updated for the telemetry reporting flow.

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

Merge Risk: Minimal · up to 68805

This refactor moves usage reporting into the telemetry module and changes it from an hourly report of the preceding hour to a daily report covering 24 hours. No concrete defect was established. Whether the receiver needs gap-free or replayed usage data is not documented in this repository, so it remains an unknown rather than a merge-blocking risk.

- [ ] 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: 2e34a377-5e9d-4d04-9b3e-7d64b600e048
Commits

Reviewing files that changed from the base of the PR and between d2719ac and 688059a.

Files selected for processing: 16

  • api/organisations/tasks.py
  • api/organisations/usage_reporting/mappers.py
  • api/organisations/usage_reporting/services.py
  • api/telemetry/control_plane/client.py
  • api/telemetry/dataclasses.py
  • api/telemetry/services.py
  • api/telemetry/tasks.py
  • api/tests/unit/organisations/usage_reporting/__init__.py
  • api/tests/unit/organisations/usage_reporting/test_mappers.py
  • api/tests/unit/organisations/usage_reporting/test_services.py
  • api/tests/unit/organisations/usage_reporting/test_tasks.py
  • api/tests/unit/telemetry/control_plane/__init__.py
  • api/tests/unit/telemetry/control_plane/test_client.py
  • api/tests/unit/telemetry/test_services.py
  • api/tests/unit/telemetry/test_tasks.py
  • docs/docs/deployment-self-hosting/observability/_events-catalogue.md
Files with no reviewable changes: 9

  • api/organisations/tasks.py
  • api/organisations/usage_reporting/mappers.py
  • api/organisations/usage_reporting/services.py
  • api/telemetry/dataclasses.py
  • api/tests/unit/organisations/usage_reporting/init.py
  • api/tests/unit/organisations/usage_reporting/test_mappers.py
  • api/tests/unit/organisations/usage_reporting/test_services.py
  • api/tests/unit/organisations/usage_reporting/test_tasks.py
  • api/tests/unit/telemetry/control_plane/init.py

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

@github-actions github-actions Bot added api Issue related to the REST API refactor docs Documentation updates labels Nov 19, 2026
@codecov

codecov Bot commented Nov 19, 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 (688059a).
⚠️ Report is 12 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #9015   +/-   ##
=======================================
  Coverage   98.92%   98.92%           
=======================================
  Files        1713     1714    +1     
  Lines       72482    72574   +92     
=======================================
+ Hits        71705    71797   +92     
  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.

@github-actions github-actions Bot added refactor and removed docs Documentation updates refactor labels Nov 19, 2026
@github-actions github-actions Bot added docs Documentation updates refactor and removed docs Documentation updates refactor labels Nov 19, 2026
@github-actions github-actions Bot added docs Documentation updates refactor and removed docs Documentation updates refactor labels Nov 19, 2026
@germangarces
germangarces marked this pull request as ready for review November 19, 2026 14:31
@germangarces
germangarces requested review from a team as code owners November 19, 2026 14:31
@germangarces
germangarces requested review from khvn26 and removed request for a team November 19, 2026 14:31

@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: cbe01c69-cada-4122-bfc3-168db382229c
Commits

Reviewing files that changed from the base of the PR and between e4bbda6 and d2719ac.

Files selected for processing: 18

  • api/app_analytics/analytics_db_service.py
  • api/organisations/tasks.py
  • api/organisations/usage_reporting/mappers.py
  • api/organisations/usage_reporting/services.py
  • api/telemetry/control_plane/client.py
  • api/telemetry/dataclasses.py
  • api/telemetry/services.py
  • api/telemetry/tasks.py
  • api/tests/unit/app_analytics/test_analytics_db_service.py
  • api/tests/unit/organisations/usage_reporting/__init__.py
  • api/tests/unit/organisations/usage_reporting/test_mappers.py
  • api/tests/unit/organisations/usage_reporting/test_services.py
  • api/tests/unit/organisations/usage_reporting/test_tasks.py
  • api/tests/unit/telemetry/control_plane/__init__.py
  • api/tests/unit/telemetry/control_plane/test_client.py
  • api/tests/unit/telemetry/test_services.py
  • api/tests/unit/telemetry/test_tasks.py
  • docs/docs/deployment-self-hosting/observability/_events-catalogue.md
Files with no reviewable changes: 9

  • api/organisations/tasks.py
  • api/organisations/usage_reporting/mappers.py
  • api/organisations/usage_reporting/services.py
  • api/telemetry/dataclasses.py
  • api/tests/unit/organisations/usage_reporting/init.py
  • api/tests/unit/organisations/usage_reporting/test_mappers.py
  • api/tests/unit/organisations/usage_reporting/test_services.py
  • api/tests/unit/organisations/usage_reporting/test_tasks.py
  • api/tests/unit/telemetry/control_plane/init.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 added refactor and removed docs Documentation updates refactor labels Nov 19, 2026

This branch was successfully deployed

1 active deployment
Preview – docs — 688059a5 Deployed Nov 19, 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 docs Documentation updates refactor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant