Class AnalyticsEvent
java.lang.Object
com.tccc.kos.core.service.analytics.AnalyticsEvent
Analytics event that can either be used as a base class for event data or as
a wrapper for existing objects when they are to be recorded as events.
Each analytics event records the following information:
- timestamp: By default the timestamp is the creation time of the event object but it can be overidden to use a different timestamp when recording event data after the fact. The timestamp is a standard UTC millisecond value for convenience, but will be converted to a timezone based value when processed. This ensures that time data can be various ways by upstream systems.
- type: The type of the event. This is generally a dotted notation hierarchical name for the event. Policy can be applied on the type or type prefix.
- priority: The priority of the information in the event. Higher priority events will cause more frequent flushing / uploading of data. This should not be used as the severity of an event, just an indication of how quickly the data should be processed. The default priority is LOW.
- view: The json view to apply to the data to serialize the
data object to event json. By default this will be
AnalyticsEvent.View
but can be overridden as needed. Setting to null will use no json view. - data: The data for the event. This will be converted to json using the associated view. This is commonly a complex live object where a view is used to control what parts of the object should actually be included in the serialized event object.
- Since:
- 1.0
- Version:
- 2024-03-12
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetData()
long
getType()
Class<?>
getView()
Set the data for the event.setPriority
(AnalyticsPriority priority) Set the priority of how the event should be processed.setTimestamp
(long timestamp) Override the timestamp of the event if the event occurred at a different time from creation of this analytics object.Set the type of the event.Set the json view to use when serializing the data to json.
-
Constructor Details
-
AnalyticsEvent
public AnalyticsEvent()
-
-
Method Details
-
setTimestamp
Override the timestamp of the event if the event occurred at a different time from creation of this analytics object.- Parameters:
timestamp
- the new timestamp in utc
-
setType
Set the type of the event. This is typically a dotted notation, hierarchical string.- Parameters:
type
- the event type
-
setPriority
Set the priority of how the event should be processed. This is not event severity, it only impacts how quickly the event is processed and forwarded to other systems.- Parameters:
priority
- the new priority
-
setData
Set the data for the event. This will be serialized to json using the associated view. -
setView
Set the json view to use when serializing the data to json. -
getTimestamp
public long getTimestamp() -
getType
-
getPriority
-
getView
-
getData
-