Class EventData

java.lang.Object
com.dynatrace.agent.api.EventData

public final class EventData extends Object
Holds the configuration for a RUM event to be sent via Dynatrace#sendEvent.

Configure the event by specifying the duration and user event properties. User event properties must have keys prefixed with "event_properties.". Any property without this prefix will be dropped.

OneAgent will verify the reported monitoring data based on the Semantic Dictionary. Invalid fields will be removed and invalid events will be dropped.

Example (Kotlin)

 Dynatrace.sendEvent(
     EventData()
         .withDuration(250)
         .addEventProperty("event_properties.userId", "12345")
 )
 
Since:
8.329
  • Constructor Details

    • EventData

      public EventData()
      Creates a new RUM event configuration to be sent via Dynatrace#sendEvent.
  • Method Details

    • withDuration

      public EventData withDuration(long durationMilliseconds)
      Sets the request duration in milliseconds.
      Parameters:
      durationMilliseconds - the duration of the request in milliseconds
      Returns:
      this instance for chaining
    • addEventProperty

      public EventData addEventProperty(String key, String value)
      Adds a user event property with a String value.
      Parameters:
      key - name of the event property. Has to start with "event_properties." or it will be dropped
      value - property value
      Returns:
      this instance for chaining
    • addEventProperty

      public EventData addEventProperty(String key, int value)
      Adds a user event property with an Integer value.
      Parameters:
      key - name of the event property. Has to start with "event_properties." or it will be dropped
      value - property value
      Returns:
      this instance for chaining
    • addEventProperty

      public EventData addEventProperty(String key, long value)
      Adds a user event property with a Long value.
      Parameters:
      key - name of the event property. Has to start with "event_properties." or it will be dropped
      value - property value
      Returns:
      this instance for chaining
    • addEventProperty

      public EventData addEventProperty(String key, double value)
      Adds a user event property with a Double value.

      Note: Double.NaN, Double.POSITIVE_INFINITY or Double.NEGATIVE_INFINITY are not allowed and will be dropped

      Parameters:
      key - name of the event property. Has to start with "event_properties." or it will be dropped
      value - property value
      Returns:
      this instance for chaining
    • addEventProperty

      public EventData addEventProperty(String key, boolean value)
      Adds a user event property with a Boolean value.
      Parameters:
      key - name of the event property. Has to start with "event_properties." or it will be dropped
      value - property value
      Returns:
      this instance for chaining