Class LastValueTracker<T>
java.lang.Object
io.confluent.telemetry.collector.LastValueTracker<T>
- Type Parameters:
T- The type of the value.
A LastValueTracker uses a ConcurrentMap to maintain historic values for a given key, and return
a previous value and an Instant for that value.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturn the last instant/value for the given MetricKey, or Optional.empty if there isn't one.
-
Constructor Details
-
LastValueTracker
public LastValueTracker()
-
-
Method Details
-
getAndSet
public Optional<LastValueTracker.InstantAndValue<T>> getAndSet(MetricKey metricKey, Instant now, T value) Return the last instant/value for the given MetricKey, or Optional.empty if there isn't one.- Parameters:
metricKey- the key for which to calculate a getAndSet.now- the timestamp for the new value.value- the current value.- Returns:
- the timestamp of the previous entry and its value. If there
isn't a previous entry, then this method returns
Optional.empty()
-
remove
-
contains
-