Class Exemplar
java.lang.Object
io.prometheus.client.exemplars.Exemplar
Immutable data class holding an Exemplar.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreate an ExemplarCreate an ExemplarCreate an Exemplar without a timestampCreate an Exemplar -
Method Summary
Modifier and TypeMethodDescriptionbooleangetLabelName(int i) Get the label name at indexi.getLabelValue(int i) Get the label value at indexi.intdoublegetValue()inthashCode()static String[]mapToArray(Map<String, String> labelMap) Convert the map to an array[key1, value1, key2, value2, ...].private String[]sortedCopy(String... labels)
-
Field Details
-
labels
-
value
private final double value -
timestampMs
-
labelNameRegex
-
-
Constructor Details
-
Exemplar
Create an Exemplar without a timestamp- Parameters:
value- the observed valuelabels- name/value pairs. Expecting an even number of strings. The combined length of the label names and values must not exceed 128 UTF-8 characters. Neither a label name nor a label value may be null.
-
Exemplar
Create an Exemplar- Parameters:
value- the observed valuetimestampMs- as inSystem.currentTimeMillis()labels- name/value pairs. Expecting an even number of strings. The combined length of the label names and values must not exceed 128 UTF-8 characters. Neither a label name nor a label value may be null.
-
Exemplar
-
Exemplar
Create an Exemplar- Parameters:
value- the observed valuetimestampMs- as inSystem.currentTimeMillis()labels- the labels. Must not be null. The combined length of the label names and values must not exceed 128 UTF-8 characters. Neither a label name nor a label value may be null.
-
-
Method Details
-
getNumberOfLabels
public int getNumberOfLabels() -
getLabelName
Get the label name at indexi.- Parameters:
i- the index, must be >= 0 and <getNumberOfLabels().- Returns:
- the label name at index
i
-
getLabelValue
Get the label value at indexi.- Parameters:
i- the index, must be >= 0 and <getNumberOfLabels().- Returns:
- the label value at index
i
-
getValue
public double getValue() -
getTimestampMs
- Returns:
- Unix timestamp or
nullif no timestamp is present.
-
sortedCopy
-
mapToArray
-
equals
-
hashCode
-