Class StreamIntrospectionComputation

java.lang.Object
org.nuxeo.lib.stream.computation.AbstractComputation
org.nuxeo.ecm.core.bulk.introspection.StreamIntrospectionComputation
All Implemented Interfaces:
Computation

public class StreamIntrospectionComputation extends AbstractComputation
A computation that reads processor and metrics streams to build a representation of stream activities in the cluster. The representation is pushed to the KV Store.
Since:
11.5
  • Field Details

    • NAME

      public static final String NAME
      See Also:
    • INTROSPECTION_KV_STORE

      public static final String INTROSPECTION_KV_STORE
      See Also:
    • INTROSPECTION_KEY

      public static final String INTROSPECTION_KEY
      See Also:
    • OBJECT_MAPPER

      protected static final com.fasterxml.jackson.databind.ObjectMapper OBJECT_MAPPER
    • streams

      protected final Map<String,com.fasterxml.jackson.databind.JsonNode> streams
    • processors

      protected final Map<String,com.fasterxml.jackson.databind.JsonNode> processors
    • metrics

      protected final Map<String,com.fasterxml.jackson.databind.JsonNode> metrics
    • TTL_SECONDS

      protected static final long TTL_SECONDS
      See Also:
    • CHECK_INTERVAL_MS

      protected static final long CHECK_INTERVAL_MS
      See Also:
    • model

      protected String model
    • registry

      protected final io.dropwizard.metrics5.MetricRegistry registry
    • scaleMetric

      protected int scaleMetric
    • currentWorkerNodes

      protected int currentWorkerNodes
    • lastMetricsReceived

      protected long lastMetricsReceived
  • Constructor Details

    • StreamIntrospectionComputation

      public StreamIntrospectionComputation()
  • Method Details

    • init

      public void init(ComputationContext context)
      Description copied from interface: Computation
      Called when the framework has registered the computation successfully. Gives users a first opportunity to schedule timer callbacks and produce records. This method can be called multiple times.
      Specified by:
      init in interface Computation
      Overrides:
      init in class AbstractComputation
      Parameters:
      context - The computation context object provided by the system.
    • getCurrentWorkerNodes

      protected int getCurrentWorkerNodes()
    • getScaleMetric

      protected int getScaleMetric()
    • loadModel

      protected void loadModel(String modelJson)
    • processTimer

      public void processTimer(ComputationContext context, String key, long timestamp)
      Description copied from interface: Computation
      Process a timer callback previously set via ComputationContext.setTimer(String, long).
      Specified by:
      processTimer in interface Computation
      Overrides:
      processTimer in class AbstractComputation
      Parameters:
      context - The computation context object provided by the system.
      key - The name of the timer.
      timestamp - The timestamp (in ms) for which the callback was scheduled.
    • processRecord

      public void processRecord(ComputationContext context, String inputStreamName, Record record)
      Description copied from interface: Computation
      Process an incoming record on one of the computation's input streams.
      Parameters:
      context - The computation context object provided by the system.
      inputStreamName - Name of the input stream that provides the record.
      record - The record.
    • updateStreamsAndProcessors

      protected void updateStreamsAndProcessors(com.fasterxml.jackson.databind.JsonNode node)
    • getProcessorKey

      protected String getProcessorKey(com.fasterxml.jackson.databind.JsonNode json)
    • updateModel

      protected void updateModel()
    • getKvStore

      protected KeyValueStore getKvStore()
    • buildModel

      protected void buildModel()
    • removeOldNodes

      protected void removeOldNodes()
    • getJson

      protected com.fasterxml.jackson.databind.JsonNode getJson(Record record)