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.
|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.
Using an IF statement
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: ...
Passing results into dict
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.