Package io.prometheus.client.exemplars
Class Exemplar
- java.lang.Object
-
- io.prometheus.client.exemplars.Exemplar
-
-
Constructor Summary
Constructors Constructor Description Exemplar(double value, Long timestampMs, String... labels)Create an ExemplarExemplar(double value, Long timestampMs, Map<String,String> labels)Create an ExemplarExemplar(double value, String... labels)Create an Exemplar without a timestampExemplar(double value, Map<String,String> labels)Create an Exemplar
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)StringgetLabelName(int i)Get the label name at indexi.StringgetLabelValue(int i)Get the label value at indexi.intgetNumberOfLabels()LonggetTimestampMs()doublegetValue()inthashCode()static String[]mapToArray(Map<String,String> labelMap)Convert the map to an array[key1, value1, key2, value2, ...].
-
-
-
Constructor Detail
-
Exemplar
public Exemplar(double value, String... labels)
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
public Exemplar(double value, Long timestampMs, String... labels)
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
public Exemplar(double value, Map<String,String> labels)
Create an Exemplar- Parameters:
value- the observed valuelabels- 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.
-
Exemplar
public Exemplar(double value, Long timestampMs, Map<String,String> labels)
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 Detail
-
getNumberOfLabels
public int getNumberOfLabels()
-
getLabelName
public String getLabelName(int i)
Get the label name at indexi.- Parameters:
i- the index, must be >= 0 and <getNumberOfLabels().- Returns:
- the label name at index
i
-
getLabelValue
public String getLabelValue(int i)
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
public Long getTimestampMs()
- Returns:
- Unix timestamp or
nullif no timestamp is present.
-
mapToArray
public static String[] mapToArray(Map<String,String> labelMap)
Convert the map to an array[key1, value1, key2, value2, ...].
-
-