構文
newrelic.agent.current_transaction(active_only=True)
現在のトランザクションに対応するオブジェクトを返します。
説明
current_transaction
を使用して、現在の トランザクションを表すオブジェクトを取得します 。アクティブなトランザクションがない場合は、 None
を返します。
パラメータ
パラメーター | 説明 |
---|---|
boolean | オプションです。デフォルトは |
戻り値
現在のトランザクションに対応するトランザクションオブジェクトを返します。アクティブなトランザクションがない場合は None
を返します。
例
現在のトランザクションの取得
import newrelic.agent
@newrelic.agent.background_task()def main(): transaction = newrelic.agent.current_transaction()