Returns an application settings object.
This returns a reference to the application settings object. The
global_settings object contains settings in the configuration file and environment variables; this
application_settings object additionally includes configuration changes set server-side via the New Relic UI.
The returned settings are nested, hierarchical objects and the setting names match the names in the agent configuration file. The main reason to expose the application settings is if you want your instrumentation to reference the agent-specific local configuration and not what's set server-side.
name value is not set, the call uses the application name specified in the agent config file or via the
NEW_RELIC_APP_NAME environment variable.
If the application hasn't been registered with the data collector when this call is made, it returns the value
None. When a call is successfully made and returns values, it will reflect the values of any local configuration overlaid with the server-side configuration for that application obtained during registration.
Do not make any changes to the application settings object. Do not cache the settings object because it will be invalidated and replaced if a server-side config change causes the agent to re-register the application with the data collector.
Optional. The name of the application. If not set, the name matches the name set in the Python agent configuration for that application.
Returns an application settings object. The object itself does not present any public API; some other calls require it to be passed.
You might want to check the configuration settings to determine what custom instrumentation to implement. Here's an example of using an
if statement with the app settings object:
settings = newrelic.agent.application_settings()if settings and settings.error_collector.enabled:...
If you are debugging or logging and require the global settings as a traditional Python dictionary object, you can pass the result into a
dict. For example:
settings_dict = dict(newrelic.agent.application_settings())for name, value in settings_dict.items():print name, value
name will be the full dotted path for that setting.
If you need more help, check out these support and learning resources:
- Browse the Explorers Hub to get help from the community and join in discussions.
- Find answers on our sites and learn how to use our support portal.
- Run New Relic Diagnostics, our troubleshooting tool for Linux, Windows, and macOS.
- Review New Relic's data security and licenses documentation.