Class MetricsService
- java.lang.Object
-
- de.digitalcollections.commons.springboot.metrics.MetricsService
-
@Service public class MetricsService extends Object
-
-
Constructor Summary
Constructors Constructor Description MetricsService(io.micrometer.core.instrument.MeterRegistry meterRegistry)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Map<String,Long>getCounters()protected Map<String,Set<io.micrometer.core.instrument.Tag>>getCounterTags()protected Map<String,io.micrometer.core.instrument.Timer>getTimers()voidincreaseCounter(String name, String tag)Increases the gauge counter by onevoidincreaseCounter(String name, String tag, long increment)Increases the gauge counter with a custom incrementvoidincreaseCounterWithDuration(String name, String tag, Long durationMillis)Increases the gauge counter and logs its accompanied durationvoidincreaseCounterWithDurationAndPercentiles(String name, String tag, Long durationMillis)Increases the gauge counter and logs its accompanied duration including percentiles (0.5 and 0.95) and histogramvoidsetGauge(String name, long value)Sets the value of a gaugevoidsetGauge(String name, String tag, long value)Sets the value of a gaugevoidsetGauge(String name, String tagKey, String tagValue, long value)Sets the value of a gauge
-
-
-
Method Detail
-
setGauge
public void setGauge(String name, long value)
Sets the value of a gauge- Parameters:
name- Name of the gauge, postfixed with.amountvalue- Value of the gauge
-
setGauge
public void setGauge(String name, String tag, long value)
Sets the value of a gauge- Parameters:
name- Name of the gauge, postfixed with.amounttag- Name of the tag (key istype)value- Value of the gauge
-
setGauge
public void setGauge(String name, String tagKey, String tagValue, long value)
Sets the value of a gauge- Parameters:
name- Name of the gauge, postfixed with.amounttagKey- Name of the tagtagValue- Value of the tagvalue- Value of the gauge
-
increaseCounter
public void increaseCounter(String name, String tag)
Increases the gauge counter by one- Parameters:
name- Name of the gauge, postfixed with.amounttag- Name of the tag
-
increaseCounter
public void increaseCounter(String name, String tag, long increment)
Increases the gauge counter with a custom increment- Parameters:
name- Name of the gauge, postfixed with.amounttag- Name of the tagincrement- Increment value
-
increaseCounterWithDuration
public void increaseCounterWithDuration(String name, String tag, Long durationMillis)
Increases the gauge counter and logs its accompanied duration- Parameters:
name- Name of the gauge, postfixed with.amountand name of the timer, postfixed with.durationtag- Name of the tagdurationMillis- Duration in milliseconds
-
increaseCounterWithDurationAndPercentiles
public void increaseCounterWithDurationAndPercentiles(String name, String tag, Long durationMillis)
Increases the gauge counter and logs its accompanied duration including percentiles (0.5 and 0.95) and histogram- Parameters:
name- Name of the gauge, postfixed with.amountand name of the timer, postfixed with.durationtag- Name of the tag (must not be null)durationMillis- Duration in milliseconds
-
-