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

cache cost results #2894

Merged
merged 25 commits into from
Nov 21, 2022
Merged

Conversation

guybartal
Copy link
Collaborator

@guybartal guybartal commented Nov 20, 2022

Related to: #2887

What is being addressed

Reduces probability for Azure cost management throttling issue by caching result,
caching will improve performance by returning faster response for cached cost reports.

How is this addressed

  • cache Azure cost management result if not exists yet in cache for two hours
  • clear expired cache items
  • make CostService as a singleton with @lru_cache(maxsize=None) decorator
  • Update CHANGELOG.md if needed

@github-actions
Copy link

github-actions bot commented Nov 20, 2022

Unit Test Results

518 tests   518 ✔️  14s ⏱️
    1 suites      0 💤
    1 files        0

Results for commit 4cc6d4d.

♻️ This comment has been updated with latest results.

api_app/api/routes/costs.py Outdated Show resolved Hide resolved
api_app/models/schemas/costs.py Outdated Show resolved Hide resolved
api_app/models/schemas/costs.py Outdated Show resolved Hide resolved
api_app/models/schemas/costs.py Outdated Show resolved Hide resolved
api_app/models/schemas/costs.py Outdated Show resolved Hide resolved
api_app/resources/strings.py Outdated Show resolved Hide resolved
api_app/services/cost_service.py Show resolved Hide resolved
@guybartal
Copy link
Collaborator Author

/test

@github-actions
Copy link

🤖 pr-bot 🤖

🏃 Running tests: https://github.com/microsoft/AzureTRE/actions/runs/3514208755 (with refid 80126968)

(in response to this comment from @guybartal)

@guybartal
Copy link
Collaborator Author

guybartal commented Nov 21, 2022

@martinpeck, FYI, I had to fix the UT to cope with the lru-cache

@guybartal
Copy link
Collaborator Author

/test

@github-actions
Copy link

🤖 pr-bot 🤖

🏃 Running tests: https://github.com/microsoft/AzureTRE/actions/runs/3515350780 (with refid 80126968)

(in response to this comment from @guybartal)

@guybartal guybartal enabled auto-merge (squash) November 21, 2022 14:39
@guybartal guybartal merged commit d62f24f into microsoft:main Nov 21, 2022
@guybartal guybartal deleted the guybartal/cache-cost-results branch November 22, 2022 11:53
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