Interface AnalyticsService
public interface AnalyticsService
Interface for the analytics service which is used to record analytic
events for classification and exporting off device. In a multi-node
device, the implementation of this service differs in the following way:
- secondary nodes: Records analytic events and periodically transfers
them to the server running on the primary node.
AnalyticsClient
has configuration settings related to how this transfer takes place. - primary node: Records analytic events from all nodes in the device.
Events are split into channels using user provided classifiers and channel
data is exported via user provided exporters. Classifiers and exporters
are managed using
AnalyticeServer
.
KosCore.getAnalytics()
static accessor. This
avoids the need to inject this interface in difficult to reach code paths
that want to record events.- Since:
- 1.0
- Version:
- 2024-03-12
-
Method Summary
Modifier and TypeMethodDescriptionvoid
record
(AnalyticsEvent event) Record an analytics event.default void
record
(AnalyticsPriority priority, String type, Object data, Class<?> view) Record an analytics event with the specified settings.void
recordAsync
(AnalyticsEvent event) Record an analytics event by putting it into a queue so that a background thread can perform data serialization and database writes decoupled from the calling thread.default void
recordAsync
(AnalyticsPriority priority, String type, Object data, Class<?> view) Asynchronously record an analytics event with the specified settings.default void
recordHigh
(String type, Object data) Record an analytics event with HIGH priority and defaultAnalyticsEvent.View
json view to serialize data.default void
recordHigh
(String type, Object data, Class<?> view) Record an analytics event with HIGH prioritydefault void
Record an analytics event with LOW priority and defaultAnalyticsEvent.View
json view to serialize data.default void
Record an analytics event with LOW prioritydefault void
recordMedium
(String type, Object data) Record an analytics event with MEDIUM priority and defaultAnalyiticsEvent.View
json view to serialize data.default void
recordMedium
(String type, Object data, Class<?> view) Record an analytics event with MEDIUM priority
-
Method Details
-
record
Record an analytics event. This will perform all event processing in the calling thread. Normally this is nominal overhead, but for particularly time sensitive use cases userecordAsync()
which queues the event to be recorded by a background thread.- Parameters:
event
- the event to record
-
recordAsync
Record an analytics event by putting it into a queue so that a background thread can perform data serialization and database writes decoupled from the calling thread. Care should be taken when providing live data as it can change between the call to queue the data and when the background thread serializes it. This method is intended for low latency code paths.- Parameters:
event
- the event to record
-
record
Record an analytics event with the specified settings.- Parameters:
priority
- priority of the eventtype
- event typedata
- data for the eventview
- json view class for data serialization
-
recordAsync
Asynchronously record an analytics event with the specified settings.- Parameters:
priority
- priority of the eventtype
- event typedata
- data for the eventview
- json view class for data serialization
-
recordHigh
Record an analytics event with HIGH priority- Parameters:
type
- event typedata
- data for the eventview
- json view class for data serialization
-
recordHigh
Record an analytics event with HIGH priority and defaultAnalyticsEvent.View
json view to serialize data.- Parameters:
type
- event typedata
- data for the event
-
recordMedium
Record an analytics event with MEDIUM priority- Parameters:
type
- event typedata
- data for the eventview
- json view class for data serialization
-
recordMedium
Record an analytics event with MEDIUM priority and defaultAnalyiticsEvent.View
json view to serialize data.- Parameters:
type
- event typedata
- data for the event
-
recordLow
Record an analytics event with LOW priority- Parameters:
type
- event typedata
- data for the eventview
- json view class for data serialization
-
recordLow
Record an analytics event with LOW priority and defaultAnalyticsEvent.View
json view to serialize data.- Parameters:
type
- event typedata
- data for the event
-