We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 96a4a04 commit 9bd0144Copy full SHA for 9bd0144
python/newrelic_lambda_wrapper.py
@@ -4,8 +4,6 @@
4
import os
5
import warnings
6
7
-import newrelic.agent
8
-
9
os.environ.setdefault("NEW_RELIC_APP_NAME", os.getenv("AWS_LAMBDA_FUNCTION_NAME", ""))
10
os.environ.setdefault("NEW_RELIC_NO_CONFIG_FILE", "true")
11
os.environ.setdefault("NEW_RELIC_DISTRIBUTED_TRACING_ENABLED", "true")
@@ -14,7 +12,12 @@
14
12
os.environ.setdefault("NEW_RELIC_LOG_LEVEL", "info")
15
13
os.environ.setdefault("NEW_RELIC_SERVERLESS_MODE_ENABLED", "true")
16
+# The agent will load some environment variables on module import so we need to perform
+# the import after setting the necessary environment variables.
17
+import newrelic.agent # noqa
18
+
19
newrelic.agent.initialize()
20
21
wrapped_handler = None
22
23
0 commit comments