newrelic / newrelic-lambda-extension

An AWS Lambda Extension to collect, enhance and transport telemetry to New Relic for AWS Lambda functions without requiring an external transport such as CloudWatch Logs or Kinesis.
Apache License 2.0
74 stars 50 forks source link

NEW_RELIC_ENABLED env var not respected #215

Open rittneje opened 2 months ago

rittneje commented 2 months ago

Description

If we set NEW_RELIC_ENABLED=0, the Go agent won't report anything. However, the extension does not respect this env var. Consequently, it waits for telemetry that will never come, and ends up timing out 200 ms before actual timeout. (From AWS's perspective, the function was running the whole time and we get billed for it.)

https://github.com/newrelic/newrelic-lambda-extension/blob/a8461c8ce89bc2411cc5ae5dd7e06e206e3407bd/main.go#L269-L300

Steps to Reproduce

See above.

Expected Behavior

Extension should be a no-op if NEW_RELIC_ENABLED=0.

Relevant Logs / Console output

Your Environment

Additional context

workato-integration[bot] commented 2 months ago

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

chaudharysaket commented 1 month ago

Hi @rittneje We haveNEW_RELIC_LAMBDA_EXTENSION_ENABLED lambda environment variable to enable/disable extension, as defined here

Currently, we see that different language agent is using a different env var to enable instrumentation, as mentioned here. env var for controlling whether the agent is enabled differs across agents: Go: NEW_RELIC_ENABLED Ruby: NEW_RELIC_AGENT_ENABLED Node.js: NEW_RELIC_ENABLED

Since lambda extension supports all language runtimes, it should respect all agent specific env vars. We will look into the issue such that lambda extension should respect the agent enable environment variable. Thank you!