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

Support Lambda Extension

Open rittneje opened this issue 1 year ago • 4 comments

Is your feature request related to a problem? Please describe.

We are trying to switch from the old log group subscription approach to your Lambda extension. https://github.com/newrelic/newrelic-lambda-extension

It seems that the Python agent doesn't support it though. Even with the layer installed, it still outputs telemetry directly to the logs. And I don't see any mention of the special named pipe (/tmp/newrelic-telemetry) in this repo.

Feature Description

Automatically detect and use the named pipe from the extension, like the other language agents do.

Describe Alternatives

None.

Additional context

None.

Priority

Must Have. Until this is fixed, we are unable to get all of our Python lambda functions to use a unified log group.

rittneje avatar May 14 '24 15:05 rittneje

https://new-relic.atlassian.net/browse/NR-268348

The Lambda functionality is published as layers over at https://github.com/newrelic/newrelic-lambda-layers. The layers include some additional code that is used to interface with the lambda extension. An outdated version of the additional functionality is published to PyPi as newrelic-lambda which contains the handler code needed to interface with the extension. Note that version has missing support for API gateway v2, and will be potentially missing some information from traces if used with API gateway v2.

It's easiest to set up lambda monitoring using our Lambda CLI. You can find an example for Python located here.

TimPansino avatar May 28 '24 20:05 TimPansino

Log forwarding should be on by default however, maybe your lambda had it turned off since you were using a different forwarder before. See the following for the necessary configuration options: https://docs.newrelic.com/docs/logs/logs-context/configure-logs-context-python/ Note logging and log forwarding can be set via an environment variable on your lambda if you are not using a configuration file (very likely). Additionally, this should already be configured for you using the process Tim linked above but make sure the following environment variable is set in your lambda as well: NEW_RELIC_SERVERLESS_MODE_ENABLED = true.

hmstepanek avatar May 28 '24 22:05 hmstepanek

@TimPansino You need to keep your PyPI distribution up to date. We should not be forced to use your layer for a Python library. It's also really annoying to require people tamper with the configuration of their lambda function with regards to the registered handler, as it makes it difficult to easily disable New Relic when it breaks. I also don't understand why Python needs to differ from other languages on this point. Please fix your Python agent so that it just works, like your Go agent does.

@hmstepanek This issue is not about log forwarding. It's strictly about the telemetry that used to be reported via the log group subscription and ingest lambda function.

rittneje avatar Jun 08 '24 23:06 rittneje

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jul 19 '25 05:07 stale[bot]

We've recently regained the ability to publish releases for newrelic-lambda and the most recent version of the lambda code is published there. If you don't want to use a lambda layer then please follow this guide to manually configure the lambda functionality with environment variables, and install the latest version from PyPi.

TimPansino avatar Jul 31 '25 22:07 TimPansino