• /
  • EnglishEspañol日本語한국어Português
  • EntrarComeçar agora

record_ml_event (Python agent API)

Syntax

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

Records a machine learning event for use in querying

Requirements

Python agent version 9.1.0 or higher.

Description

This records a machine learning event that can be viewed and queried in the New Relic UI. If you want to use this outside of the context of a monitored transaction, use the application parameter.

Importante

For limits and restrictions on event_type and params, see Limits and restricted characters and Reserved words.

Importante

This setting is disabled when high security mode is enabled.

Parameters

Parameter

Description

event_type

string

Required. The event_type defines the name (or type) of the machine learning event, and must be a string. No additional attributes recorded for the transaction are added to machine learning events.

params

dict

Required. Attaches machine learning attributes to the event. Only attributes passed in as params are added. No additional attributes recorded for the transaction are added to machine learning events.

application

object

Optional. If you want to record an event outside of the context of a monitored transaction, use this to associate the call with a specific application object. An application object can be obtained using the newrelic.agent.application function.

Return values

None.

Examples

Record machine learning event in background task

Here's an example of recording a machine learning event associated with a background task:

@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 Inc.

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