• 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의 종료 방법을 실행합니다.

이 수정은 @expectedbehaviorunicorn-worker-killer gem포크에 의존합니다.

  1. 다음을 사용하여 이것을 Gemfile에 추가하십시오.

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

    Gemfile에서 이미 unicorn-worker-killer 사용하고 있다면 이 포크를 사용하도록 참조를 업데이트하세요.

  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 Inc.

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