001package io.prometheus.metrics.core.datapoints;
002
003import io.prometheus.metrics.annotations.StableApi;
004
005/**
006 * Represents a single StateSet data point.
007 *
008 * <p>See JavaDoc of {@link CounterDataPoint} on how using data points directly can improve
009 * performance.
010 */
011@StableApi
012public interface StateSetDataPoint extends DataPoint {
013
014  /**
015   * {@code state} must be one of the states from when the {@code StateSet} was created with {@link
016   * io.prometheus.metrics.core.metrics.StateSet.Builder#states(String...)}.
017   */
018  void setTrue(String state);
019
020  /**
021   * {@code state} must be one of the states from when the {@code StateSet} was created with {@link
022   * io.prometheus.metrics.core.metrics.StateSet.Builder#states(Class)}.
023   */
024  default void setTrue(Enum<?> state) {
025    setTrue(state.toString());
026  }
027
028  /**
029   * {@code state} must be one of the states from when the {@code StateSet} was created with {@link
030   * io.prometheus.metrics.core.metrics.StateSet.Builder#states(String...)}.
031   */
032  void setFalse(String state);
033
034  /**
035   * {@code state} must be one of the states from when the {@code StateSet} was created with {@link
036   * io.prometheus.metrics.core.metrics.StateSet.Builder#states(Class)}.
037   */
038  default void setFalse(Enum<?> state) {
039    setFalse(state.toString());
040  }
041}