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

[COST-4175] Fix AWS first of the month issue #487

Merged
merged 13 commits into from
Mar 26, 2024
Merged

Conversation

esebesto
Copy link
Contributor

On the first of the month, the AWS previous month report generated by Nise contains also data for current month (COST-4175). This PR aims to fix this bug.
There is a very good chance that this PR actually breaks generation of data for other providers - thus it can't be merged until it's properly tested with all providers and methods of date specification

Copy link

codecov bot commented Feb 15, 2024

Codecov Report

Merging #487 (10550b7) into main (a292485) will increase coverage by 0.1%.
Report is 1 commits behind head on main.
The diff coverage is 96.0%.

Additional details and impacted files
@@           Coverage Diff           @@
##            main    #487     +/-   ##
=======================================
+ Coverage   93.5%   93.5%   +0.1%     
=======================================
  Files         60      60             
  Lines       4633    4638      +5     
  Branches     666     666             
=======================================
+ Hits        4330    4337      +7     
+ Misses       158     157      -1     
+ Partials     145     144      -1     

esebesto and others added 5 commits March 4, 2024 21:12
Do not both returning and then disccarding the keys view.
- Use nested .get() calls instead of conditionals
- Store the value instead of doing repeated attribute lookups
- Default to today()
It’s expensive in CPython to keep looking up attributes, plus it hurts
legibility greatly here. Lookup up the attributes once and store the
values to make the conditionals much easier to read and improve performance.

Compare both the month and day of month_end and end_date in order to determine
if they are the same. It may be sufficient to compare only day, but it seems
more accurate to compare both month and day.
@samdoran samdoran force-pushed the esebesto/COST-4714_fix_aws branch from 5e16168 to 60107cb Compare March 5, 2024 02:21
@samdoran samdoran changed the title DRAFT: COST-4175 - Fix AWS first of the month issue [COST-4175] Fix AWS first of the month issue Mar 5, 2024
@samdoran samdoran marked this pull request as draft March 5, 2024 02:24
@samdoran samdoran force-pushed the esebesto/COST-4714_fix_aws branch from 1d300e2 to 70a1a06 Compare March 5, 2024 04:15
@samdoran samdoran marked this pull request as ready for review March 5, 2024 04:19
nise/report.py Outdated Show resolved Hide resolved
nise/report.py Outdated Show resolved Hide resolved
nise/__main__.py Outdated Show resolved Hide resolved
tests/test_report.py Outdated Show resolved Hide resolved
@esebesto esebesto force-pushed the esebesto/COST-4714_fix_aws branch from bf589dd to 51ef810 Compare March 22, 2024 08:26
@esebesto esebesto force-pushed the esebesto/COST-4714_fix_aws branch from 5a425b3 to 10550b7 Compare March 25, 2024 14:36
@samdoran samdoran merged commit ef09612 into main Mar 26, 2024
6 checks passed
@samdoran samdoran deleted the esebesto/COST-4714_fix_aws branch March 26, 2024 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants