Package com.dynatrace.agent.api
Class ExceptionEventData
java.lang.Object
com.dynatrace.agent.api.ExceptionEventData
Holds the configuration for an exception event to be sent via the
Dynatrace#sendExceptionEvent.
Configure the event by providing the required Throwable and any optional
user event properties. A null throwable will cause the event to be discarded. 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)
catch(exception: Exception) {
Dynatrace.sendExceptionEvent(
ExceptionEventData(exception)
.addEventProperty("event_properties.userId", "12345")
)
}
- Since:
- 8.329
-
Constructor Summary
ConstructorsConstructorDescriptionExceptionEventData(Throwable throwable) Creates a new exception event configuration to be sent viaDynatrace#sendExceptionEvent. -
Method Summary
Modifier and TypeMethodDescriptionaddEventProperty(String key, boolean value) Adds a user event property with aBooleanvalue.addEventProperty(String key, double value) Adds a user event property with aDoublevalue.addEventProperty(String key, int value) Adds a user event property with anIntegervalue.addEventProperty(String key, long value) Adds a user event property with aLongvalue.addEventProperty(String key, String value) Adds a user event property with aStringvalue.
-
Constructor Details
-
ExceptionEventData
Creates a new exception event configuration to be sent viaDynatrace#sendExceptionEvent.- Parameters:
throwable- theThrowablecausing this exception. Ifnullis passed instead, the event cannot be generated and will be discarded.
-
-
Method Details
-
addEventProperty
Adds a user event property with aStringvalue.- Parameters:
key- name of the event property. Has to start with "event_properties." or it will be droppedvalue- property value- Returns:
- this instance for chaining
-
addEventProperty
Adds a user event property with anIntegervalue.- Parameters:
key- name of the event property. Has to start with "event_properties." or it will be droppedvalue- property value- Returns:
- this instance for chaining
-
addEventProperty
Adds a user event property with aLongvalue.- Parameters:
key- name of the event property. Has to start with "event_properties." or it will be droppedvalue- property value- Returns:
- this instance for chaining
-
addEventProperty
Adds a user event property with aDoublevalue.Note:
Double.NaN,Double.POSITIVE_INFINITYorDouble.NEGATIVE_INFINITYare not allowed and will be dropped- Parameters:
key- name of the event property. Has to start with "event_properties." or it will be droppedvalue- property value- Returns:
- this instance for chaining
-
addEventProperty
Adds a user event property with aBooleanvalue.- Parameters:
key- name of the event property. Has to start with "event_properties." or it will be droppedvalue- property value- Returns:
- this instance for chaining
-