Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • A StreamsMetrics class with the following methods:
    public interface StreamsMetrics {

    /**
    * @return The base registry where all the metrics are recorded.
    */
     Metrics registry();

     /**
    * Add a latency sensor. This is equivalent to adding a sensor with metrics on latency and rate.
    *
    * @param scopeName Name of the scope, could be the type of the state store, etc.
    * @param entityName Name of the entity, could be the name of the state store instance, etc.
    * @param recordLevel The recording level (e.g., INFO or DEBUG) for this sensor.
    * @param operationName Name of the operation, could be get / put / delete / etc.
    * @param tags Additional tags of the sensor.
    * @return The added sensor.
    */
     Sensor addLatencySensor(String scopeName, String entityName, String operationName, Sensor.RecordLevel recordLevel, String... tags);

     /**
    * Record the given latency value of the sensor.
    * @param sensor sensor whose latency we are recording.
    * @param startNs start of measurement time in nanoseconds.
    * @param endNs end of measurement time in nanoseconds.
    */
     void recordLatency(Sensor sensor, long startNs, long endNs);

     /**
    * Add a throughput sensor. This is equivalent to adding a sensor with metrics rate.
    *
    * @param scopeName Name of the scope, could be the type of the state store, etc.
    * @param entityName Name of the entity, could be the name of the state store instance, etc.
    * @param recordLevel The recording level (e.g., INFO or DEBUG) for this sensor.
    * @param operationName Name of the operation, could be get / put / delete / etc.
    * @param tags Additional tags of the sensor.
    * @return The added sensor.
    */
     Sensor addThroughputSensor(String scopeName, String entityName, String operationName, Sensor.RecordLevel recordLevel, String... tags);

     /**
    * Records the throughput value of a sensor.
    * @param sensor sensor whose throughput we are recording.
    * @param value throughput value.
    */
     void recordThroughput(Sensor sensor, long value);

    }

     

    /**
    * Remove a sensor with the given name.
    * @param name Sensor name to be removed.
    */
     void removeSensor(String name);
    }

  • Follows from the above that we are also for the first time exposing the Metrics interface. The Metrics class has always been internal so far. The argument for exposing it is that, unlike for simple Producers and Consumers, the application's code and stream's code co-exist and we have the objective of having app metrics in the same registry as stream metrics. We could attempt to provide yet another layer on top of Metrics, but we would be replicating a lot of code. 

Proposed Changes

  • Enumeration of Sensors: This KIP proposes the introduction of the following sensors

...