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

fix: Get current api usage InfluxDB query #3846

Merged
merged 1 commit into from
Apr 29, 2024

Conversation

zachaysan
Copy link
Contributor

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

Changes

A month or two ago I wrote a function to get current API usage, but I was limited to testing with the developer and staging keys and the amount of records returned from the database seemed low, but still seemed reasonable given that organisations in staging could reasonably be argued to not have much API use.

While testing with real production data the difference in the returned results against what we already know should be the right result made it apparent that this function was malfunctioning. Looking at other queries in the InfluxDB wrapper module I was able to alter the function in order to produce the correct result.

How did you test this code?

Tested against production data and verified that the total API calls were an exact match.

image
(Pdb++) sum([r.get_value() for r in result.records])
816600

Copy link

vercel bot commented Apr 25, 2024

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

Name Status Preview Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview Apr 25, 2024 3:16pm
flagsmith-frontend-preview ✅ Ready (Inspect) Visit Preview Apr 25, 2024 3:16pm
flagsmith-frontend-staging ✅ Ready (Inspect) Visit Preview Apr 25, 2024 3:16pm

@zachaysan zachaysan requested a review from matthewelwell April 25, 2024 15:17
@github-actions github-actions bot added the api Issue related to the REST API label Apr 25, 2024
Copy link
Contributor

github-actions bot commented Apr 25, 2024

Uffizzi Preview deployment-50849 was deleted.

@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 0% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 95.96%. Comparing base (5068575) to head (7951150).
Report is 19 commits behind head on main.

Files Patch % Lines
api/app_analytics/influxdb_wrapper.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3846      +/-   ##
==========================================
+ Coverage   95.91%   95.96%   +0.04%     
==========================================
  Files        1122     1126       +4     
  Lines       35482    35785     +303     
==========================================
+ Hits        34034    34342     +308     
+ Misses       1448     1443       -5     

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

@matthewelwell matthewelwell added this pull request to the merge queue Apr 29, 2024
Merged via the queue into main with commit 905c9fb Apr 29, 2024
22 checks passed
@matthewelwell matthewelwell deleted the fix/get_current_api_usage branch April 29, 2024 10:12
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants