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

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

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

문제 신고

set_transaction_name(파이썬 에이전트 API)

통사론

newrelic.agent.set_transaction_name(name, group=None, priority=None)

현재 트랜잭션의 이름을 설정합니다.

설명

이 호출은 현재 트랜잭션의 이름을 설정합니다.

다음은 namegroup 매개변수를 구현하는 한 가지 방법을 보여주는 예입니다.

name = '%s/%s' % (controller, function)
group = 'Python/WebFramework/Controller'newrelic.agent.set_transaction_name(name, group)

이름을 설정하려는 여러 지점(예: 미들웨어, 보기 처리기 또는 오류 처리기)이 있을 수 있는 웹 프레임워크에 대한 사용자 정의 계측을 구현하지 않는 한 일반적으로 우선순위 매개변수를 무시할 수 있습니다.

매개변수

매개변수

설명

name

필수의. 현재 트랜잭션의 원하는 이름입니다. 이름 설정의 예는 설명 을 참조하십시오.

group

선택 과목. group 은 UI에서 트랜잭션 유형 을 설정하는 데 사용되는 name 매개변수의 이름 지정 구조를 나타냅니다. 그룹 설정의 예는 설명 을 참조하십시오.

제공되지 않은 경우 그룹은 이름이 module:class.function 또는 module:function 형식이고 실행 중인 함수의 이름을 나타내는 것으로 가정하여 기본적으로 Function 이름을 사용합니다. 사용자 지정 그룹을 생성하는 경우 접두사 Python/ 를 사용하는 것이 좋습니다.

트랜잭션의 이름을 지정하는 데 사용되는 이름 지정 구조입니다. 이 값은 URL의 일부로 렌더링되므로 ASCII가 아닌 인코딩은 피해야 합니다. 기본값은 Function 입니다. 이것을 사용하는 방법에 대한 자세한 내용은 설명 을 참조하십시오.

priority

정수

선택 과목. 우선 순위 값은 트랜잭션에 부여되는 이름을 결정하는 데 사용됩니다. 높은 숫자가 낮은 숫자보다 우선합니다. 기본값은 None 이며, 이는 트랜잭션 이름이 기존 값을 재정의함을 의미합니다. 우선순위가 None 로 남아 있으면 새 이름이 항상 기존 값보다 우선합니다. 다음은 우선 순위가 작동하는 방식의 예입니다.

newrelic.agent.set_transaction_name('first', 'Python/CustomGroup')
# transaction name becomes 'first'.
newrelic.agent.set_transaction_name('second', 'Python/CustomGroup', priority=10)
# transaction name becomes 'second'. The priority becomes 10.
newrelic.agent.set_transaction_name('third', 'Python/CustomGroup', priority=5)
# transaction name is still 'second' because 5 < 10.
newrelic.agent.set_transaction_name('fourth', 'Python/CustomGroup', priority=15)
# transaction name becomes 'fourth' because 15 > 10. The priority becomes 15.
newrelic.agent.set_transaction_name('fifth', 'Python/CustomGroup')
# transaction name becomes 'fifth'. The priority remains 15.

반환 값

없음.

이름 및 그룹 매개변수 사용

namegroup 매개변수를 구현하는 한 가지 방법을 보여주는 예:

name = '%s/%s' % (controller, function)
group = 'Python/WebFramework/Controller'
newrelic.agent.set_transaction_name(name, group)

current_transaction을 사용하여 이름 설정

current_transaction 을 사용하여 현재 트랜잭션 이름을 설정하는 예:

transaction = newrelic.agent.current_transaction()
new_transaction_name = transaction.name
newrelic.agent.set_transaction_name(new_transaction_name)
Copyright © 2024 New Relic Inc.

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