Class AnalyticsServer

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

@ApiController(base="/server/analytics", title="Analytics server", desc="Endpoints for AnalyticsClient to hit.") public class AnalyticsServer extends AbstractService
Analytics server that only runs on the primary node. Used to register classifiers to categorize events into channels and exporters to send data off the device. All secondary nodes will send analytic events to the primary node to be classified and exported.

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

    • record

      @Deprecated public void record(AnalyticsEvent event)
      Deprecated.
      To be removed from SDK. Use AnalyticsService.record() instead.
    • register

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

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

      public void flush(String channel)
      Flush the contents of a channel. This causes the associated exporter to be called immediately with any pending analytic events.