• EnglishEspañol日本語한국어Português
  • ログイン今すぐ開始

この機械翻訳は、参考として提供されています。

In the event of any inconsistency between the English version and the translated version, the English versionwill take priority. Please visit this page for more information.

問題を作成する

Unicorn のカウントが正しくない

問題

New Relic Ruby APM と Unicorn を一緒に使用していますが、メトリクスとカスタム イベントの数が少なすぎるようです。

解決

Unicorn に手動で NewRelic::Agent.shutdown を呼び出して、エージェントの終了ハンドラーを実行させます。Unicorn の終了メソッドの一部が原因で、エージェントが期待どおりにシャットダウンされません。以下の変更は、Unicorn プロセスを強制終了する前に、New Relic のシャットダウン メソッドを実行します。

この修正は 、unicorn-worker-killer gemの@expectedbehaviorのフォークに依存しています。

  1. 以下を使用して、これを Gemfile に追加します。

    gem 'unicorn-worker-killer', git: 'https://github.com/expectedbehavior/unicorn-worker-killer'

    unicorn-worker-killer Gemfile で既に使用している場合は、参照を更新してこのフォークを使用してください。

  2. バンドル:

    bundle install
  3. ユニコーン構成を更新して、以下を含めます。

    require "unicorn/worker_killer"
    ::Unicorn::WorkerKiller.configure do |config|
    config.before_kill do |signal|
    ::NewRelic::Agent.increment_metric("Custom/UnicornWorkerBeforeKillSignal/#{signal}")
    ::NewRelic::Agent.shutdown
    end
    end
  4. サーバーを再起動します

Copyright © 2024 New Relic株式会社。

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.