PrometheusMetrics { public static Gauge.Child latestCommittedTimestampGauge(String eventName, int partition) { Gauge.Child gauge = buildChild(LATEST_COMMITTED_TIMESTAMPS, partition, eventName, String.valueOf(partition)); return new Gauge.Child() { @Override public void set(double val) { gauge.set(Double.max(gauge.get(), val)); } @Override public double get() { return gauge.get(); } }; } private  PrometheusMetrics(); static Counter.Child tmpFileOpenFailuresCounter(String eventName); static Counter.Child tmpFilesOpened(String eventName); static Counter.Child filesCommittedCounter(String eventName); static Counter.Child checkpointFailuresCounter(String eventName, int partition); static Counter.Child checkpointSuccessesCounter(String eventName, int partition); static Counter.Child messageWritingFailuresCounter(String eventName, int partition); static Counter.Child messageWrittenCounter(String eventName, int partition); static Counter.Child hearbeatsSentCounter(String eventName, int partition); static Gauge.Child currentRunningOffsetsGauge(String eventName, int partition); static Gauge.Child latestCommittedOffsetGauge(String eventName, int partition); static Gauge.Child latestCommittedTimestampGauge(String eventName, int partition); static void clearCollectors(); static void clearPartitionCollectors(int partition); static Map<Integer, Map<SimpleCollector<?>, Set<List<String>>>> getRegisteredCollectors();  }
@Test public void shouldSetLatestCommittedTimestampMaxSeenValue() { PrometheusMetrics.latestCommittedTimestampGauge("event", 0).set(0); PrometheusMetrics.latestCommittedTimestampGauge("event", 0).set(10); assertEquals(10, PrometheusMetrics.latestCommittedTimestampGauge("event", 0).get(), 0); PrometheusMetrics.latestCommittedTimestampGauge("event", 0).set(5); assertEquals(10, PrometheusMetrics.latestCommittedTimestampGauge("event", 0).get(), 0); PrometheusMetrics.latestCommittedTimestampGauge("event", 0).set(15); assertEquals(15, PrometheusMetrics.latestCommittedTimestampGauge("event", 0).get(), 0); }