如何启用 NewRelic Python 代理?

How do I enable the NewRelic Python agent?

在尝试按照 https://docs.newrelic.com/docs/python/testing-the-python-agent 的建议使用 newrelic-admin validate-config newrelic.ini 测试我的 NewRelic 配置时,我收到以下错误:

WARNING - The Python Agent is not enabled.

ERROR - Unable to register application for test, connection could not be established within 30.0 seconds.

警告是什么意思,如何启用代理?为什么需要启用代理来验证配置?

原来 developer_modemonitor_mode 配置选项之一必须在您的配置文件中设置为 true 才能 "enable" 代理。

然而,看起来配置验证器实际上在名为 "Python Agent Test" 的测试应用程序下使用您的配置启动代理并尝试向 NewRelic 报告,将 developer_mode 设置为 true 启用代理但仍然导致测试失败。实际上,看起来测试失败是一个错误,因为错误消息是 ERROR - Unexpected exception when attempting to harvest the metric data and send it to the data collector. Please report this problem to New Relic support for further investigation.,并且回溯显示 newrelic.core.data_collector.send_request.

中的断言失败

配置文件中的设置 monitor_mode = true 应该会成功启用代理并使测试通过,PythonAgentTest 应用程序的数据会出现在 NewRelic 仪表板中。