Class 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 Detail

      • 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
      • 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 Detail

      • StreamIntrospectionComputation

        public StreamIntrospectionComputation()
    • Method Detail

      • 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)
      • 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()
      • buildModel

        protected void buildModel()
      • removeOldNodes

        protected void removeOldNodes()
      • getJson

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