【发布时间】:2013-12-20 05:28:48
【问题描述】:
我正在开发一个我想添加 NewRelic 监控的 Ruby gem。 gem 用于作为守护进程运行并由bluepill 监控的脚本中。我跟着“Monitoring Ruby background processes and daemons”开始。
我确认 gem 正在与 NewRelic 建立连接,因为该应用程序显示在我的门户中,但是,没有事务跟踪或正在调用的代码的任何指标故障。
这是我的 gem 的“入口”点,因为我试图围绕调用方法手动启动代理:
require 'fms/parser/version'
require 'fms/parser/core'
require 'fms/parser/env'
require 'mongoid'
ENV['NRCONFIG'] ||= File.dirname(__FILE__) + '/../newrelic.yml'
require 'newrelic_rpm'
module Fms
module Parser
def self.prepare_parse(filename)
::NewRelic::Agent.manual_start
Mongoid.load!("#{File.dirname(__FILE__)}/../mongoid.yml", :development)
Core.prepare_parse(filename)
::NewRelic::Agent.shutdown
end
end
end
我也尝试将其添加到模块中:
class << self
include ::NewRelic::Agent::Instrumentation::ControllerInstrumentation
add_transaction_tracer :prepare_parse, :category => :task
end
我不完全确定我还能做什么。我确认代理能够与服务器通信并启用事务跟踪。后台应用程序选项卡中也没有显示任何内容。
这是迄今为止我从代理日志中获得的最有用的信息:
[12/23/13 21:21:03 +0000 apivm (7819)] INFO : Environment: development
[12/23/13 21:21:03 +0000 apivm (7819)] INFO : No known dispatcher detected.
[12/23/13 21:21:03 +0000 apivm (7819)] INFO : Application: MY-APP
[12/23/13 21:21:03 +0000 apivm (7819)] INFO : Installing Net instrumentation
[12/23/13 21:21:03 +0000 apivm (7819)] INFO : Finished instrumentation
[12/23/13 21:21:04 +0000 apivm (7819)] INFO : Reporting to: https://rpm.newrelic.com/[MASKED_ACCOUNT_NUMBER]
[12/23/13 22:12:06 +0000 apivm (7819)] INFO : Starting the New Relic agent in "development" environment.
[12/23/13 22:12:06 +0000 apivm (7819)] INFO : To prevent agent startup add a NEWRELIC_ENABLE=false environment variable or modify the "development" section of your newrelic.yml.
[12/23/13 22:12:06 +0000 apivm (7819)] INFO : Reading configuration from /var/lib/gems/1.9.1/gems/fms-parser-0.0.6/lib/fms/../newrelic.yml
[12/23/13 22:12:06 +0000 apivm (7819)] INFO : Starting Agent shutdown
这里唯一真正关心的是“未检测到已知的调度程序”。
我正在尝试做的事情可能吗?
【问题讨论】:
-
newrelic.log 中有什么内容?
-
您是否尝试通过在您的
newrelic.yml中设置agent_enabled: true来强制它运行?您是否也在开发过程中尝试这样做?也许尝试切换到developer_mode: true。 -
如果您不确定日志记录是否正确...尝试在设置
NRCONFIG环境变量后添加:ENV['NEW_RELIC_LOG'] ||= File.dirname(__FILE__) + '/../log/newrelic_agent.log'。 -
还可以尝试将
::NewRelic::Agent.manual_start移到require 'newrelic_rpm'之后的右侧