• EnglishEspañol日本語한국어Português
  • Log inStart now

newrelic_record_custom_event (PHP agent API)


newrelic_record_custom_event(string $name, array $attributes)

Record a custom event with the given name and attributes.


Agent version or higher.


Records a custom event for use in New Relic. For more information, see Inserting custom events with the PHP agent.


When creating custom events, follow these rules:

  • The agent records a maximum of 30,000 events per minute by default. You can configure the agent to record up to 100,000 events per minute by changing this ini setting.
  • Limit the number of unique event type names that you create, and don't generate these names dynamically.
  • Avoid using reserved words and characters for the event and attributes names.
  • Ensure you don't exceed the event size and rate restrictions.
  • If newrelic_ignore_transaction is called within the same transaction as newrelic_record_custom_event, the custom event(s) won't be reported.






Required. Name of the custom event.



Required. Supply custom attributes as an associative array. Supply the attribute names as keys of up to 255 characters, and supply the values as scalar values. Arrays and objects are not supported.


Basic example

if (extension_loaded('newrelic')) { // Ensure PHP agent is available
newrelic_record_custom_event("WidgetSale", array("color"=>"red", "weight"=>12.5));
Copyright © 2024 New Relic Inc.

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