Agent does not use documented defaults when configuring using environment variables
See original GitHub issueDescription
The documentation for the NodeJS Agent says that you can configure the agent using either a newrelic.js
file or environment variables.
In the documentation, you list the newrelic.js
property path, the corresponding environment variable for the property, e.g. application_logging
→ NEW_RELIC_APPLICATION_LOGGING_ENABLED
, followed by the default value of the configuration setting.
However—for example, application logging for logs in context—if the agent is being configured by environment variables but the corresponding environment variable is not set, then the feature is not turned on.
Expected Behavior
I expected that since the default value for the configuration setting application_logging
applied also to the environment variable NEW_RELIC_APPLICATION_LOGGING_ENABLED
. However, apparently one must explicitly set the environment variable in order for the feature to be enabled. Note that this is not limited to just application logging. NO default configuration is applied when using environment variables as the means of agent configuration.
The documentation is extremely unclear in this regard when one chooses to configure the agent via environment variables.
If the configuration setting’s default is true
, for example, then I shouldn’t have to do anything, in the configuration file nor via setting environment variables, in order for the default behavior to apply.
Steps to Reproduce
- Configure the Node JS agent using environment variables.
- Be sure to set
NEW_RELIC_NO_CONFIG_FILE=true
for good measure. - Set the bare minimum environment variables required:
NEW_RELIC_APPLICATION_NAME
andNEW_RELIC_LICENSE_KEY
. - Start your application.
- Don’t profit–i.e., no application logs will be sent to new relic, browser agent monitoring will be disabled, no metrics will be sent, basically, all the things the documentation says the agent defaults to enabling.
Suggested Remedies
- Actually have the agent internally configured according to the documented default settings, only altering the agent behavior if an end-user configures the agent differently via the acceptable configuration methods
- Update the documentation to explicitly state that environment variables MUST be set in order to configure the agent no matter what the stated default settings are.
Of the two, I prefer the first option because it means less work for the end-user and requires no updates to the documentation. It Just Works™ as the user expects according to the documentation.
Issue Analytics
- State:
- Created a year ago
- Comments:6 (2 by maintainers)
Ugh, right, there’s the default that application logging is enabled–but you have to explicitly turn on forwarding. OK, that makes sense. I’m getting all twisted around in the myriad of environment configuration variables. 😄 I was just trying to make sure I’m providing the bare minimum configuration. Thanks @bizob2828!
And just to remove any confusion/doubt, I fixed my app and redeployed. When I do not set
NEW_RELIC_APPLICATION_LOGGING_ENABLED=true
, my application logs are not sent to New Relic. And as I mentioned on #1209, my logs also are not updated with New Relic-specific properties nor have my timestapms altered. However, if I setNEW_RELIC_APPLICATION_LOGGING_ENABLED=true
explicitly and restart my app, then my logs are updated as discussed in #1209, and the logs show up in New Relic. So I don’t think (at least for application logging) that the default setting(s) are taking effect.I noticed this too, the other day, when I was looking for more info in APM and didn’t see much there. So on a whim, I decided to set
NEW_RELIC_APPLICATION_LOGGING_METRICS_ENABLED=true
, too, and things started to light up in New Relic.