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

問題を作成する

Record_ml_event (Python エージェント API)

構文

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

クエリに使用する機械学習イベントを記録します。

要件

Python エージェント バージョン 9.1.0以上。

説明

これにより、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_ml_event('your_event_type', {'param1':'value1'}, application)
Copyright © 2024 New Relic株式会社。

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