Class AnalyticsServer
- All Implemented Interfaces:
CtxEventListener
,ContextHandleAware
,HandleAware
,Ready
,ReadyListener
,AnalyticsService
AnalyticsService
for use on primary nodes. This introduces
additional functionality only available on the primary node.
Analytic events, whether originating on this node or any other node, are recorded in
separate channels as identified by user provided classifiers. A classifier simply
need to implement the AnalyticsClassifier
interface and be added to the
context to be autowired into this service. Once connected, the classifier starts
receiving events to classify. Every channel returned by the classifier for a given
event will result in a copy of the event being recorded in the corresponding channel.
Classifiers only receive new events, not events that have occurred before the
classifier existed.
Users can register exporters in the form of AnalyticsExporter
, with one or
more channels. The analytics service will periodically group events from a channel
together and send them to an exporter to be processed (uploaded to the cloud for
example). The service will manage durability of the events until they are uploaded
or the channel reaches size / date limits. Only one exporter can be registered per
channel.
- Since:
- 1.0
- Version:
- 2024-03-12
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoid
record
(AnalyticsEvent event) Record an analytics event.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.void
register
(String channel, AnalyticsExporter exporter) Register a exporter for a channel.void
unregister
(String channel, AnalyticsExporter exporter) Unregister a exporter from a channel.Methods inherited from class com.tccc.kos.commons.core.service.AbstractService
getHandle, getHandlePrefix
Methods inherited from class com.tccc.kos.commons.util.ready.ReadyBean
getReady, onBeanReady, onDependenciesReady
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.tccc.kos.core.service.analytics.AnalyticsService
record, recordAsync, recordHigh, recordHigh, recordLow, recordLow, recordMedium, recordMedium
Methods inherited from interface com.tccc.kos.commons.core.context.CtxEventListener
onCtxAutowiringCompleted, onCtxDestroyed, onCtxPhaseCompleted
Methods inherited from interface com.tccc.kos.commons.core.service.handle.HandleAware
addHandleChild, getName, getPath
Methods inherited from interface com.tccc.kos.commons.util.ready.ReadyListener
onDependenciesGroupReady
-
Field Details
-
DEFAULT_CHANNEL
- See Also:
-
DEFAULT_MAX_SIZE
public static final int DEFAULT_MAX_SIZE- See Also:
-
-
Method Details
-
recordAsync
Description copied from interface:AnalyticsService
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.- Specified by:
recordAsync
in interfaceAnalyticsService
- Parameters:
event
- the event to record
-
record
Description copied from interface:AnalyticsService
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.- Specified by:
record
in interfaceAnalyticsService
- Parameters:
event
- the event to record
-
register
Register a exporter for a channel. -
unregister
Unregister a exporter from a channel.
-