Parameters

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

params

dict

Required. Attaches custom attributes to the event. Only attributes passed in as params are added. No additional attributes recorded for the transaction are added to custom 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 value(s)

None.

Example(s)

Record custom event in background task

Here's an example of recording a custom 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_custom_event('your_event_type', {'param1':'value1'}, application)

Create a killed-query custom event

An example of creating a killed-query custom event inside a database-logging function: