newrelic-dotnet-agent icon indicating copy to clipboard operation
newrelic-dotnet-agent copied to clipboard

Add support for capturing docker id from AWS ECS Fargate.

Open jaffinito opened this issue 1 year ago • 1 comments

On hold while we wait for more details about the missing linkage with infra.

Description

  • Updates GetDockerVendorInfo to check for both the v4 and v3 ECS metadata endpoint URI environment variables and if present parse out the docker from JSON obtain from the endpoint.
  • Includes unit tests for both v3 and v4.

Notes:

  • Matches docker id captured by the ECS and Docker AWS integrations.
  • Environment variables are only read if the CGroup v1 and v2 checks fail (always with ECS Fargate).
  • Environment variables are only present in ECS (non-fargate and fargate). No additional web calls will be made outside of that environment.
  • Metadata v4 is checked first and if present, v3 will not be used. v3 is a fallback since it will eventually disappear.
  • No integration tests since that would either require running in ECS Fargate or faking the environment variables with a fake locally hosted endpoint. The unit test does basically the same thing without the extra effort.

Once/If this is approved, I will update the agent specs with our implementation.

Author Checklist

  • [x] Unit tests, Integration tests, and Unbounded tests completed
  • [x] Performance testing completed with satisfactory results (if required)

Reviewer Checklist

  • [x] Perform code review
  • [x] Pull request was adequately tested (new/existing tests, performance tests)

jaffinito avatar May 14 '24 21:05 jaffinito

Codecov Report

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

Project coverage is 80.56%. Comparing base (0be7ccd) to head (fe2a7d1).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2481   +/-   ##
=======================================
  Coverage   80.55%   80.56%           
=======================================
  Files         459      459           
  Lines       28759    28802   +43     
  Branches     3152     3159    +7     
=======================================
+ Hits        23168    23203   +35     
- Misses       4812     4817    +5     
- Partials      779      782    +3     
Flag Coverage Δ
Agent 81.50% <70.58%> (-0.01%) :arrow_down:
Profiler 72.15% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
...gent/NewRelic/Agent/Core/Utilization/VendorInfo.cs 82.47% <70.58%> (-1.00%) :arrow_down:

... and 1 file with indirect coverage changes

codecov-commenter avatar May 31 '24 20:05 codecov-commenter