Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add api usage metrics for different periods #3870

merged 50 commits into from
May 24, 2024


Copy link

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

  • I have run pre-commit to check linting
  • 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?
  • I have used a Conventional Commit title for this Pull Request


This provides the ability to get API usage data for different billing periods. The supported new periods are the current billing period (i.e., the first day of the billing period till now), the previous billing period, and a 90-day rolling period to the present.

Part of these changes involved with a refactoring of how code is called to influxdb. The former code incorrectly attributed date_range as if it were date_start with an inverse modifier. With the former code any callers that had set a date_stop to anything other than now() the resultant range would be smaller than the interface contract implied. These issues have been addressed and subsequent calling methods have been updated.

There was also an issue that cropped up with Pydantic and Freeze Gun, which has been temporarily solved with the addition of an auto-use function in

How did you test this code?

Tested manually against production influxdb to verify results then also added 3 tests to ensure calling signatures to related influxdb functions.

Copy link

vercel bot commented May 1, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 23, 2024 1:58pm
flagsmith-frontend-preview ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 23, 2024 1:58pm
flagsmith-frontend-staging ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 23, 2024 1:58pm

@github-actions github-actions bot added the api Issue related to the REST API label May 1, 2024
Copy link

github-actions bot commented May 1, 2024

Uffizzi Preview deployment-51125 was deleted.

Copy link

codecov bot commented May 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.40%. Comparing base (59ddfba) to head (3dcbed0).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3870      +/-   ##
+ Coverage   96.28%   96.40%   +0.12%     
  Files        1143     1145       +2     
  Lines       36992    37198     +206     
+ Hits        35618    35862     +244     
+ Misses       1374     1336      -38     

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

Copy link

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

Two nitpicks, one naming request I trust @zachaysan to address, otherwise LGTM.

@zachaysan zachaysan added this pull request to the merge queue May 24, 2024
Merged via the queue into main with commit 50cc369 May 24, 2024
24 checks passed
@zachaysan zachaysan deleted the feat/add_api_usage_metrics_for_different_periods branch May 24, 2024 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
api Issue related to the REST API
None yet

Successfully merging this pull request may close these issues.

None yet

3 participants