Skip to content

Add serverless mode support to Profiler #2285

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

Merged

Conversation

chynesNR
Copy link
Member

@chynesNR chynesNR commented Feb 28, 2024

This adds the ability to add an instrumentation point to the Profiler via an environment variable, AWS_LAMBDA_FUNCTION_NAME, in the format assembly::class::method. If the variable is not in the correct format it will log a Warning but continue running. It does not attempt to verify that the method exists.

The environment variable can be added at any point during the startup sequence and the Profiler will pick it up (as long as the method hasn't been invoked yet)..

When the named method is invoked it will call the wrapper NewRelic.Providers.Wrapper.AwsLambda.HandlerMethod in the managed Agent.

Unit tests are included.

This also removes the hard-coded method name in the instrumentation.xml that was used in the POC branch.

@codecov-commenter
Copy link

codecov-commenter commented Feb 29, 2024

Codecov Report

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

❗ No coverage uploaded for pull request base (feature/lambda-support@3e0d49f). Click here to learn what that means.

Additional details and impacted files

Impacted file tree graph

@@                    Coverage Diff                    @@
##             feature/lambda-support    #2285   +/-   ##
=========================================================
  Coverage                          ?   72.80%           
=========================================================
  Files                             ?      444           
  Lines                             ?    27749           
  Branches                          ?     3021           
=========================================================
  Hits                              ?    20202           
  Misses                            ?     6769           
  Partials                          ?      778           
Files Coverage Δ
...c/Agent/NewRelic/Profiler/Common/AssemblyVersion.h 0.00% <0.00%> (ø)
...rc/Agent/NewRelic/Profiler/Configuration/Strings.h 0.00% <0.00%> (ø)
...t/NewRelic/Profiler/MethodRewriter/Instrumentors.h 0.00% <0.00%> (ø)
...filer/Configuration/InstrumentationConfiguration.h 0.00% <0.00%> (ø)

@chynesNR chynesNR marked this pull request as ready for review March 1, 2024 18:35
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.

Looks good!

@chynesNR chynesNR merged commit e466d90 into feature/lambda-support Mar 4, 2024
@chynesNR chynesNR deleted the feature-work/lambda-profiler-changes branch March 4, 2024 21:25
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