Skip to content

Add caching for AWS metadata#1427

Merged
TimPansino merged 11 commits into
mainfrom
aws-utilization-token-expiration
Jul 23, 2025
Merged

Add caching for AWS metadata#1427
TimPansino merged 11 commits into
mainfrom
aws-utilization-token-expiration

Conversation

@lrafeei

@lrafeei lrafeei commented Jul 16, 2025

Copy link
Copy Markdown
Contributor

This PR adds the AWS metadata to the utilization class. This is for the specific case of when the agent is left continuously running and it is utilizing Kubernetes and AWS EC2 (but not EKS).

The utilization data is pulled the first time, but after this, the authentication token is unable to be refreshed. The utilization data will remain the same as long as the same agent instance, so if the EC2 instance fails, the agent will restart (and not just reconnect) and the utilization data will be fetched for the new EC2 instance.

@github-actions

github-actions Bot commented Jul 16, 2025

Copy link
Copy Markdown

🦙 MegaLinter status: ✅ SUCCESS

Descriptor Linter Files Fixed Errors Warnings Elapsed time
✅ ACTION actionlint 6 0 0 0.73s
✅ MARKDOWN markdownlint 7 0 0 0 1.08s
✅ MARKDOWN markdown-link-check 7 0 0 21.34s
✅ PYTHON ruff 922 0 0 0 0.86s
✅ PYTHON ruff-format 922 0 0 0 0.27s
✅ YAML prettier 13 0 0 0 1.15s
✅ YAML v8r 13 0 0 5.07s
✅ YAML yamllint 13 0 0 0.59s

See detailed report in MegaLinter reports

MegaLinter is graciously provided by OX Security

@mergify mergify Bot added the tests-failing Tests failing in CI. label Jul 16, 2025
@codecov-commenter

codecov-commenter commented Jul 16, 2025

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 83.33333% with 2 lines in your changes missing coverage. Please review.

Project coverage is 81.36%. Comparing base (d4e359a) to head (ad22f14).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
newrelic/common/utilization.py 83.33% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1427      +/-   ##
==========================================
- Coverage   81.37%   81.36%   -0.02%     
==========================================
  Files         208      208              
  Lines       23543    23554      +11     
  Branches     3715     3716       +1     
==========================================
+ Hits        19158    19164       +6     
- Misses       3127     3130       +3     
- Partials     1258     1260       +2     

☔ View full report in Codecov by Sentry.
📢 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.

@mergify mergify Bot removed the tests-failing Tests failing in CI. label Jul 16, 2025
@lrafeei lrafeei marked this pull request as ready for review July 16, 2025 18:14
@lrafeei lrafeei requested a review from a team as a code owner July 16, 2025 18:14
@TimPansino

Copy link
Copy Markdown
Contributor

What's the reasoning behind using environment variable to store this? Why not store it on the AWSUtilization class? (I think there's not an object for it but could still be stored on the class.) Or even store it in a global? What's the point of making it an env var we have to add to the customer's environment and then handle destroying on shutdown?

@TimPansino TimPansino self-assigned this Jul 17, 2025
@mergify mergify Bot added the tests-failing Tests failing in CI. label Jul 17, 2025
@mergify mergify Bot removed the tests-failing Tests failing in CI. label Jul 21, 2025
TimPansino
TimPansino previously approved these changes Jul 21, 2025
@mergify mergify Bot added the tests-failing Tests failing in CI. label Jul 22, 2025
@mergify mergify Bot removed the tests-failing Tests failing in CI. label Jul 22, 2025
TimPansino
TimPansino previously approved these changes Jul 23, 2025
@TimPansino TimPansino enabled auto-merge (squash) July 23, 2025 22:39
@mergify mergify Bot added the tests-failing Tests failing in CI. label Jul 23, 2025
@TimPansino TimPansino merged commit 777e025 into main Jul 23, 2025
60 checks passed
@TimPansino TimPansino deleted the aws-utilization-token-expiration branch July 23, 2025 23:52
@mergify mergify Bot removed the tests-failing Tests failing in CI. label Jul 23, 2025
@lrafeei lrafeei added this to the v10.15.0 milestone Jul 24, 2025
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