4
我如何將救出的異常發送給NewRelic?如何手動向NewRelic(Ruby)發送異常?
我有一個測試文件rpm.rb:
NEWRELIC_ENABLE=true ruby rpm.rb
日誌/ newrelic_agent.log的內容:
[05/14/13 ... (87691)] INFO : Reading configuration from config/newrelic.yml
[05/14/13 ... (87691)] INFO : Environment: development
[05/14/13 ... (87691)] WARN : No dispatcher detected.
[05/14/13 ... (87691)] INFO : Application: xxx (Development)
[05/14/13 ... (87691)] INFO : Installing Net instrumentation
[05/14/13 ... (87691)] INFO : Audit log enabled at '.../log/newrelic_audit.log'
[05/14/13 ... (87691)] INFO : Finished instrumentation
[05/14/13 ... (87691)] INFO : Reading configuration from config/newrelic.yml
[05/14/13 ... (87691)] INFO : Starting Agent shutdown
內容
require 'newrelic_rpm'
NewRelic::Agent.manual_start
begin
"2" + 3
rescue TypeError => e
puts "whoa !"
NewRelic::Agent.agent.error_collector.notice_error(e)
end
我啓動的日誌/ newrelic_audit.log
[2013-05-14 ... (87691)] : REQUEST: collector.newrelic.com:443/agent_listener/12/74901a11b7ff1a69aba11d1797830c8c1af41d56/get_redirect_host?marshal_format=json
[2013-05-14 ... (87691)] : REQUEST BODY: []
沒有報道給NewRelic,爲什麼?
我看到這個已經:Is there way to push NewRelic error manually?
做了'raise'關鍵字的幫助? – 2013-05-14 09:04:15
我不希望看到我們的客戶的堆棧跟蹤:),這就是爲什麼救援是在我的例子中,但是謝謝 – astropanic 2013-05-14 09:09:41
這可能太明顯了,但NR在開發模式下運行時默認不會回家,除非您更改配置文件。 – mikeryz 2014-02-22 21:05:05