• English日本語한국어
  • Log inStart now

global_settings (Python agent API)

Syntax

newrelic.agent.global_settings()

This call returns a reference to the Python agent's global settings object.

Description

This call returns a reference to the global agent settings object, which you can then use to make changes to the available settings. The returned settings object contains nested, hierarchical objects. The setting names match the global settings' names in the agent configuration file.

The global_settings object contains settings from the configuration file and environment variables; the application_settings object contains additional configuration changes from server-side configuration.

If you update global settings using the global settings object, the changes will only take affect the next time the Python agent is registered with the collector for that specific application.

If accessed before the agent is initialized, the global settings will have the default configuration settings, along with any overrides from user environment variables. If accessed after agent initialization, the global settings contain any agent config file settings that are also global settings (because the config file contains fewer settings than the global settings object).

Return values

Returns a reference to the global agent settings object.

Examples

Assigning various settings

Here are some examples of assigning the proxy_host, proxy_port, slow_sql.enabled, and browser_monitoring.auto_instrument settings:

settings = newrelic.agent.global_settings()
settings.proxy_host = 'proxy.intranet'
settings.proxy_port = 8888
settings.slow_sql.enabled = False
settings.browser_monitoring.auto_instrument = False

Passing settings into a 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. Here's an example:

settings_dict = dict(newrelic.agent.global_settings())
for name, value in settings_dict.items():
print name, value

Each name will be the full dotted path for that setting.

Copyright © 2024 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.