无法让NewRelic接收ActiveSupport自定义事件

问题描述 投票:0回答:1

我有一个 Rails 4.2.10 应用程序,带有 NewRelic newrelic_apm gem (8.15.0)。在我的 Rails 应用程序中,我使用 ActiveSupport::Notifications 生成支持团队用于跟踪问题的自定义事件。

这是一个例子:

ActiveSupport::Notifications.instrument('ingestion.data.automation.started',
                                            organisation_id: organisation_id,
                                            organisation_name: organisation_name,
                                            filename: full_path,
                                            file_size: file_size)

我已经验证事件是通过在初始化程序中订阅事件来生成的:

ActiveSupport::Notifications.subscribe "ingestion.data.automation.started" do |event|
  Rails.logger.info "*** Notification ***: #{event}"
end

因此产生日志记录:

I, [2023-01-19T04:12:09.851593 #1]  INFO -- : *** Notification ***: ingestion.data.automation.started

在我的

/config/newrelic.yml
中,我有以下内容:

active_support_custom_events_names:
    - ingestion.data.automation.started

但是,据我所知,这些自定义事件并未报告给 NewRelic。我从这个应用程序中获得了大量的仪器数据,所以我知道 NewRelic 连接和配置是有效的,我只是看不到我的自定义事件。我意识到这个配置选项只在 8.14 中引入,并且可能与早期的 Rails 版本不向后兼容(尽管 AFAICT 这个 API 自从 首次在 Rails 3.0 中引入以来就没有改变)。

还有什么我应该考虑的,或者有什么方法可以调试以找出问题所在吗?

ruby-on-rails newrelic
1个回答
0
投票

检查此提交https://github.com/newrelic/newrelic-ruby-agent/pull/1659/files我认为这将有助于调试问题。还要弄清楚这个功能是如何工作的。

© www.soinside.com 2019 - 2024. All rights reserved.