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

feat: Instrument Lambda invocations in AWS SDK #2901

Draft
wants to merge 34 commits into
base: main
Choose a base branch
from

Conversation

chynesNR
Copy link
Member

@chynesNR chynesNR commented Nov 25, 2024

Instrument calls to Lambdas and Lambda Aliases from the AWS SDK, with span attributes to allow linking the calls to the actual Lambda (specifically the ARN is what's needed). Includes unit and integration tests. We are able to test without a making a successful call to a lambda, so no live testing resources are necessary.

Also includes a new wrapper for AmazonServiceClient and logic to parse the AWS account ID from the Access Key credential. Currently supports only a single account ID per application and falls back to using the account ID from configuration if parsing is unsuccessful. We may need to revisit this logic to support multiple account IDs (one per service client instance) and consider whether using the value from configuration should take precedence or remain as a fallback.

Changes since the last PR:

  • Does not treat the segment as a Leaf, so we will get an additional HTTP span, which is now expected
  • Caps the size of the ARN cache
  • Limits most errors to log only once
  • Does not log the account ID, only if it is present or not

@chynesNR chynesNR requested a review from a team as a code owner November 25, 2024 22:54
@chynesNR chynesNR changed the title Feature/invoke lambda instrumentation feat: Instrument Lambda invocations in AWS SDK Nov 26, 2024
tippmar-nr
tippmar-nr previously approved these changes Dec 4, 2024
nrcventura
nrcventura previously approved these changes Dec 4, 2024
@tippmar-nr tippmar-nr dismissed stale reviews from nrcventura and themself via 55cc8a4 December 6, 2024 21:33
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 97.00599% with 5 lines in your changes missing coverage. Please review.

Project coverage is 81.66%. Comparing base (63788ff) to head (4537d5d).
Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
....Agent.Extensions/Collections/ConcurrentHashSet.cs 0.00% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2901      +/-   ##
==========================================
+ Coverage   81.42%   81.66%   +0.23%     
==========================================
  Files         465      467       +2     
  Lines       29563    29724     +161     
  Branches     3278     3308      +30     
==========================================
+ Hits        24073    24274     +201     
+ Misses       4697     4657      -40     
  Partials      793      793              
Flag Coverage Δ
Agent 82.61% <97.00%> (+0.25%) ⬆️
Profiler 73.13% <ø> (ø)

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

Files with missing lines Coverage Δ
...elic/Agent/Core/AgentHealth/AgentHealthReporter.cs 87.40% <100.00%> (+0.17%) ⬆️
...gent/Core/Attributes/AttributeDefinitionService.cs 95.71% <100.00%> (+0.06%) ⬆️
...c/Agent/NewRelic/Agent/Core/Metrics/MetricNames.cs 92.21% <ø> (ø)
.../Agent/NewRelic/Agent/Core/Segments/NoOpSegment.cs 100.00% <100.00%> (+88.88%) ⬆️
src/Agent/NewRelic/Agent/Core/Segments/Segment.cs 98.37% <100.00%> (+6.35%) ⬆️
...nt/NewRelic/Agent/Core/Transactions/Transaction.cs 80.73% <100.00%> (ø)
...ons/NewRelic.Agent.Extensions/AwsSdk/ArnBuilder.cs 100.00% <100.00%> (ø)
...lic.Agent.Extensions/AwsSdk/AwsAccountIdDecoder.cs 100.00% <100.00%> (ø)
....Agent.Extensions/Collections/ConcurrentHashSet.cs 30.00% <0.00%> (-2.73%) ⬇️

... and 1 file with indirect coverage changes

Copy link
Member

@tippmar-nr tippmar-nr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work!

@chynesNR chynesNR marked this pull request as draft December 11, 2024 19:21
@chynesNR
Copy link
Member Author

Moving this back to Draft until we get final word on the External segment discussion

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.

4 participants