• EnglishEspañol日本語한국어Português
  • 로그인지금 시작하기

이 한글 문서는 사용자의 편의를 위해 기계 번역되었습니다.

영문본과 번역본이 일치하지 않는 경우 영문본이 우선합니다. 보다 자세한 내용은 이 페이지를 방문하시기 바랍니다.

문제 신고

애플리케이션 경고 활성화(Python)

문제

중요

데이터가 보고되지 않는 경우에만 문제가 됩니다.

최신 Python 에이전트를사용 중이며 다음과 같은 경고 메시지가 포함된 로그 항목이 표시됩니다.

Attempt to activate application in a process different to where the agent harvest thread was started.

또는:

Attempt to reactivate application or record transactions in a process different to where the agent was already registered.

응용 프로그램은 New Relic UI에 보고되는 것으로 표시되지만 New Relic에 보고되는 데이터는 없습니다.

해결책

앱에서 이 문제를 해결하려면:

  1. __name__ == __main__ 검사 내에서 함수 내부의 newrelic.agent.register_application 또는 newrelic.agent.application 에 대한 모든 호출을 이동합니다.

  2. newrelic.agent.register_application 또는 newrelic.agent.application 에 대한 호출이 어디에서 발생하는지 확실하지 않은 경우 에이전트 디버그 로그 를 사용하여 다음을 포함하는 항목을 검색하십시오.

    newrelic.core.agent DEBUG - Application was activated from:
  3. 에이전트를 활성화한 통화에 대한 항목의 역추적을 사용합니다. 정상으로 간주되는 다음 프레임을 참조하십시오.

    File "newrelic/api/transaction.py", line x, in __init__
    application.activate()
    File "newrelic/hooks/application_celery.py", line x, in process_initializer
    application_instance().activate()
  4. 활성화가 다른 위치에서 발생하는 경우 다음 예에 따라 이 문제를 수정하십시오.

    전에:

    import newrelic.agent
    # This will cause the agent to activate whenever custom_event is imported
    app = newrelic.agent.application()
    def custom_event():
    newrelic.agent.record_custom_event('CustomEvent', {}, application=app)

    이후 :

    import newrelic.agent
    def custom_event():
    app = newrelic.agent.application()
    newrelic.agent.record_custom_event('CustomEvent', {}, application=app)

데이터가 표시되지 않는 다른 팁은 Python 문제 해결 문서 를 참조하십시오.

원인

이 문제에는 두 가지 주요 원인이 있습니다. 첫 번째는 애플리케이션 인스턴스를 여러 번 생성하거나 포크하기 전에 애플리케이션 인스턴스를 생성하는 것입니다.

  1. 이는 일반적으로 가져오기 시 발생하는 newrelic.agent.register_application 또는 newrelic.agent.application 에 대한 호출로 인해 발생합니다.

    :

    import newrelic.agent
    # This will cause the agent to activate whenever custom_event is imported
    app = newrelic.agent.application()
    def custom_event():
    newrelic.agent.record_custom_event('CustomEvent', {}, application=app)
  2. 이 문제는 기본 상위 프로세스가 작업자 프로세스를 시작하는 셀러리와 같은 서비스를 모니터링할 때도 발생할 수 있습니다. 작업자 프로세스를 분기하기 전에 기본 프로세스에서 에이전트 응용 프로그램 인스턴스가 생성될 때 발생합니다. 에이전트는 상위 프로세스에서 시작되므로 하위 프로세스에서는 데이터가 수집되지 않습니다.

Copyright © 2024 New Relic Inc.

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