Package io.prometheus.client
Class Counter.Child
- java.lang.Object
-
- io.prometheus.client.Counter.Child
-
- Enclosing class:
- Counter
public static class Counter.Child extends Object
The value of a single Counter.Warning: References to a Child become invalid after using
SimpleCollector.remove(java.lang.String...)orSimpleCollector.clear(),
-
-
Constructor Summary
Constructors Constructor Description Child()Child(Boolean exemplarsEnabled, CounterExemplarSampler exemplarSampler)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longcreated()Get the created time of the counter in milliseconds.doubleget()Get the value of the counter.voidinc()Increment the counter by 1.voidinc(double amt)Increment the counter by the given amount.voidincWithExemplar(double amt, String... exemplarLabels)Likeinc(double), but additionally creates an exemplar.voidincWithExemplar(double amt, Map<String,String> exemplarLabels)Same asincWithExemplar(double, String...), but the exemplar labels are passed as aMap.voidincWithExemplar(String... exemplarLabels)Same asincWithExemplar(1, exemplarLabels).voidincWithExemplar(Map<String,String> exemplarLabels)Same asincWithExemplar(1, exemplarLabels).
-
-
-
Constructor Detail
-
Child
public Child()
-
Child
public Child(Boolean exemplarsEnabled, CounterExemplarSampler exemplarSampler)
-
-
Method Detail
-
inc
public void inc()
Increment the counter by 1.
-
incWithExemplar
public void incWithExemplar(String... exemplarLabels)
Same asincWithExemplar(1, exemplarLabels).
-
incWithExemplar
public void incWithExemplar(Map<String,String> exemplarLabels)
Same asincWithExemplar(1, exemplarLabels).
-
inc
public void inc(double amt)
Increment the counter by the given amount.- Throws:
IllegalArgumentException- If amt is negative.
-
incWithExemplar
public void incWithExemplar(double amt, String... exemplarLabels)
Likeinc(double), but additionally creates an exemplar.This exemplar takes precedence over any exemplar returned by the
CounterExemplarSamplerconfigured inExemplarConfig.The exemplar will have
amtas the value,System.currentTimeMillis()as the timestamp, and the specified labels.- Parameters:
amt- same as ininc(double)exemplarLabels- list of name/value pairs, as documented inExemplar(double, String...). A commonly used name is"trace_id". CallingincWithExemplar(amt)means that an exemplar without labels will be created. CallingincWithExemplar(amt, (String[]) null)is equivalent to callinginc(amt).
-
incWithExemplar
public void incWithExemplar(double amt, Map<String,String> exemplarLabels)
Same asincWithExemplar(double, String...), but the exemplar labels are passed as aMap.
-
get
public double get()
Get the value of the counter.
-
created
public long created()
Get the created time of the counter in milliseconds.
-
-