• 로그인지금 시작하기

사용자의 편의를 위해 제공되는 기계 번역입니다.

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

문제 신고

record_custom_event(Python 에이전트 API)

통사론

newrelic.agent.record_custom_event(event_type, params, application=None)

쿼리에 사용할 사용자 지정 이벤트를 기록합니다.

요구 사항

Python 에이전트 버전 2.60.0.46 이상.

설명

이것은 New Relic UI에서 보고 쿼리할 수 있는 사용자 지정 이벤트 를 기록합니다. 모니터링되는 트랜잭션 컨텍스트 외부에서 이것을 사용하려면 application 매개변수를 사용하십시오.

중요

event_typeparams 에 대한 제한 및 제한은 제한 및 제한 문자예약어 를 참조하십시오.

매개변수

매개변수

설명

event_type

필수의. event_type 은 맞춤 이벤트의 이름(또는 유형)을 정의하며 문자열이어야 합니다. 트랜잭션에 대해 기록된 추가 속성은 사용자 지정 이벤트에 추가되지 않습니다.

params

딕셔너리

필수의. 이벤트에 사용자 정의 속성을 첨부합니다. params 으로 전달된 속성만 추가됩니다. 트랜잭션에 대해 기록된 추가 속성은 사용자 지정 이벤트에 추가되지 않습니다.

application

물체

선택 과목. 모니터링되는 트랜잭션 컨텍스트 외부에서 이벤트를 기록하려는 경우 이를 사용하여 호출을 특정 응용 프로그램 개체와 연결합니다. newrelic.agent.application 함수를 사용하여 애플리케이션 객체를 얻을 수 있습니다.

반환 값

없음.

백그라운드 작업에서 사용자 지정 이벤트 기록

다음은 백그라운드 작업과 연결된 사용자 지정 이벤트를 기록하는 예입니다.

@newrelic.agent.background_task()
def bg_task():
# do some type of work in this background task...
application = newrelic.agent.application()
newrelic.agent.record_custom_event('your_event_type', {'param1':'value1'}, application)

종료된 쿼리 사용자 지정 이벤트 만들기

데이터베이스 로깅 기능 내에서 killed-query 사용자 정의 이벤트를 생성하는 예:

application = newrelic.agent.register_application(timeout=10)
def task_runner():
event_type = "Killed_Query"
params = {'query_info':'select * from all_things;', 'killed_time': '2016-05-18 00:59:00', 'host': 'my_host'}
newrelic.agent.record_custom_event(event_type, params, application=application)
Copyright © 2023 New Relic Inc.

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