use of org.apache.kafka.common.metrics.MeasurableStat in project ksql by confluentinc.
the class KsqlEngineMetrics method configureNumActiveQueries.
private Sensor configureNumActiveQueries(Metrics metrics) {
Sensor sensor = createSensor(metrics, metricGroupName + "-active-queries");
sensor.add(metrics.metricName("num-active-queries", this.metricGroupName, "The current number of active queries running in this engine"), new MeasurableStat() {
@Override
public double measure(MetricConfig metricConfig, long l) {
return ksqlEngine.numberOfLiveQueries();
}
@Override
public void record(MetricConfig metricConfig, double v, long l) {
// We don't want to record anything, since the live queries anyway.
}
});
sensor.add(metrics.metricName("num-persistent-queries", this.metricGroupName, "The current number of persistent queries running in this engine"), new MeasurableStat() {
@Override
public double measure(MetricConfig metricConfig, long l) {
return ksqlEngine.numberOfPersistentQueries();
}
@Override
public void record(MetricConfig metricConfig, double v, long l) {
// No action for record since we can read the desired results directly.
}
});
return sensor;
}
Aggregations