Ruby Agent 日志信息说明

正常情况下的日志输出

Ruby Agent 会在应用启动时在应用的 log 目录中创建 oneapm_agent.log 文件,正常启动时 Ruby Agent 会打印以下日志(以 Rails 应用为例):

localhost (17710)] INFO : Starting the OneApm agent in "production" environment
localhost (17710)] INFO : Reading configuration from /var/www/redmine/config/oneapm.yml (/var/www/redmine)
localhost (17710)] INFO : Using JSON marshaller (json)
localhost (17710)] INFO : Environment: production
localhost (17710)] INFO : Dispatcher: thin
localhost (17710)] INFO : Application: Redmine
localhost (17710)] INFO : Creating Ruby Agent worker thread.
localhost (17710)] INFO : Installing Rails 3+ middleware instrumentation
localhost (17710)] INFO : Installing Net instrumentation
localhost (17710)] INFO : Installing ActiveRecord instrumentation
localhost (17710)] INFO : Installing Rails 3 Error instrumentation
localhost (17710)] INFO : Installing Rails 3 Controller instrumentation
localhost (17710)] INFO : Installing Rails 3.1/3.2 view instrumentation
localhost (17710)] INFO : Installing deferred Rack instrumentation
localhost (17710)] INFO : Installing Rack::Builder middleware instrumentation
localhost (17710)] INFO : Finished instrumentation
localhost (17710)] INFO : Doing deferred library-detection before Rack startup

根据此 log 日志,可以确定探针是以 production 环境启动的,而且 app_name 为 Redmine,那么在 OneAPM 的管理后端就会显示 Redmine 这个应用,而且所有的数据也会上传到这个应用下。

通过此日志还可以知道,这个应用的 server 为 thin,是一个 Rails3 应用,并且使用 ActiveRecord,同时由于 net/http 为 ruby 标准库,默认就进行了 hook,如果发现使用了相应的库,但是 Agent 没有发现,说明 Agent 出现了问题,或者 Agent 目前还不支持此库。

配置文件未找到或者license_key为空时的日志输出

这里可以一条 warn 日志,写明了警告信息无法找到 license_key。

localhost (8403)] INFO : Starting the OneApm agent in "production" environment
localhost (8403)] INFO : Reading configuration from /var/www/redmine/config/oneapm.yml (/var/www/redmine)
localhost (8403)] INFO : Using JSON marshaller (json)
localhost (8403)] INFO : Environment: production
localhost (8403)] INFO : Dispatcher: thin
localhost (8403)] INFO : Application: Redmine
localhost (8403)] WARN : No license key found. This often means your oneapm.yml file was not found, or it lacks a section for the running environment, 'production'. You may also want to try linting your oneapm.yml to ensure it is valid YML.
localhost (8403)] INFO : Installing Rails 3+ middleware instrumentation
localhost (8403)] INFO : Installing Net instrumentation
localhost (8403)] INFO : Installing ActiveRecord instrumentation
localhost (8403)] INFO : Installing Rails 3 Error instrumentation
localhost (8403)] INFO : Installing Rails 3 Controller instrumentation
localhost (8403)] INFO : Installing Rails 3.1/3.2 view instrumentation
localhost (8403)] INFO : Installing deferred Rack instrumentation
localhost (8403)] INFO : Installing Rack::Builder middleware instrumentation
localhost (8403)] INFO : Finished instrumentation
localhost (8403)] INFO : Doing deferred library-detection before Rack startup
还有其他问题? 提交请求

您还可以采取以下方式解决问题: