NH-68421 Adjust service name, key usage when lambda #309
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adjusts service name and service key requirements/usage when in lambda.
SW_APM_SERVICE_KEY
was already not required for APM Python to be enabled in lambda, but if not provided was causing IndexError at_update_service_key_name
. So added a condition in 5d7ba8b to only update key if not lambda.The precedence of
OTEL_SERVICE_NAME
>AWS_LAMBDA_FUNCTION_NAME
was already being respected by APM Python in lambda because of the otel-instrument wrapper. I added new helper_calculate_service_name_lambda
anyway in case the wrapper fails or is not used in a lambda environment. Service name setting in lambda does not takeagent_enabled
into consideration like for APM proto service name setting (I'm pretty sure there's no use case beyond using function name?)I manually tested by publishing a test layer (see ticket for ARN), applying to a function, and playing with different environment variables. Summary of outcome:
Please let me know what you think!