Rails 不会向 NewRelic 发送自定义指标

2024-01-17

我正在尝试将自定义指标发送到 NewRelic 见解,但不幸的是,它不适用于当前正在向 New Relic 发送默认数据的 Rails 应用程序。

重现步骤

我刚刚登录工作应用程序的控制台并运行以下命令:

NewRelic::Agent.record_metric('/Custom/MyCategory/MyMetric', 5)

不幸的是,它从未出现在 Insights Data Explorer 中。

应用程序中的配置如下:

common: &default_settings
  license_key: <MY_KEY>
  app_name: my_app
  log_level: info

development:
  <<: *default_settings
  app_name: executive_alerts (development)
  monitor_mode: false

test:
  <<: *default_settings
  app_name: executive_alerts (test)
  monitor_mode: false

staging:
  <<: *default_settings
  app_name: executive_alerts (staging)

production:
  <<: *default_settings

谢谢你!


来自 New Relic 代理的文档:

  • http://www.rubydoc.info/github/newrelic/rpm/NewRelic/Agent#record_metric-instance_method http://www.rubydoc.info/github/newrelic/rpm/NewRelic/Agent#record_metric-instance_method
  • https://github.com/newrelic/rpm/blob/c252fad410a5d41a65a827d633338af609f8dff6/lib/new_relic/agent.rb#L143-L144 https://github.com/newrelic/rpm/blob/c252fad410a5d41a65a827d633338af609f8dff6/lib/new_relic/agent.rb#L143-L144

    metric_name应遵循斜杠分隔的路径约定。应用程序特定指标应从Custom/.

更改您的命令:

NewRelic::Agent.record_metric('/Custom/MyCategory/MyMetric', 5)

to:

NewRelic::Agent.record_metric('Custom/MyCategory/MyMetric', 5)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Rails 不会向 NewRelic 发送自定义指标 的相关文章

随机推荐