Class Counter.Child
java.lang.Object
io.prometheus.client.Counter.Child
- Enclosing class:
Counter
The value of a single Counter.
Warning: References to a Child become invalid after using
SimpleCollector.remove(String...) or SimpleCollector.clear(),
-
Constructor Summary
ConstructorsConstructorDescriptionChild()Child(Boolean exemplarsEnabled, CounterExemplarSampler exemplarSampler) -
Method Summary
Modifier and TypeMethodDescriptionlongcreated()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 Details
-
Child
public Child() -
Child
-
-
Method Details
-
inc
public void inc()Increment the counter by 1. -
incWithExemplar
Same asincWithExemplar(1, exemplarLabels). -
incWithExemplar
Same asincWithExemplar(1, exemplarLabels). -
inc
public void inc(double amt) Increment the counter by the given amount.- Throws:
IllegalArgumentException- If amt is negative.
-
incWithExemplar
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
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.
-