Class AnalyticsServer

All Implemented Interfaces:
CtxEventListener, ContextHandleAware, HandleAware, Ready, ReadyListener, AnalyticsService

@ApiController(base="/server/analytics", title="Analytics server", desc="Endpoints for AnalyticsClient to hit.") public class AnalyticsServer extends AbstractService implements AnalyticsService
Implementation of 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 Details

  • Method Details

    • recordAsync

      public void recordAsync(AnalyticsEvent event)
      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 interface AnalyticsService
      Parameters:
      event - the event to record
    • record

      public void record(AnalyticsEvent event)
      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 use recordAsync() which queues the event to be recorded by a background thread.
      Specified by:
      record in interface AnalyticsService
      Parameters:
      event - the event to record
    • register

      public void register(String channel, AnalyticsExporter exporter)
      Register a exporter for a channel.
    • unregister

      public void unregister(String channel, AnalyticsExporter exporter)
      Unregister a exporter from a channel.