-
- All Implemented Interfaces:
public class MetricsContainerMetricsContainergathers and exports metrics from Jitsi components.
-
-
Field Summary
Fields Modifier and Type Field Description private BooleancheckForNameConflictsprivate final StringjsonStringprivate final CollectorRegistryregistry
-
Constructor Summary
Constructors Constructor Description MetricsContainer(CollectorRegistry registry)MetricsContainer()
-
Method Summary
Modifier and Type Method Description final BooleangetCheckForNameConflicts()Defines the behavior when registering a metric with a name in use by an existing metric. final UnitsetCheckForNameConflicts(Boolean checkForNameConflicts)Defines the behavior when registering a metric with a name in use by an existing metric. final StringgetJsonString()final CollectorRegistrygetRegistry()the registry used to register metrics final StringgetPrometheusMetrics(String contentType)Returns the metrics in this instance in the Prometheus text-based format. final BooleanMetricregisterBooleanMetric(String name, String help, Boolean initialValue)Creates and registers a BooleanMetric with the given name, help string and optional initialValue. final BooleanMetricregisterBooleanMetric(String name, String help)Creates and registers a BooleanMetric with the given name, help string and optional initialValue. final CounterMetricregisterCounter(String name, String help, Long initialValue)Creates and registers a CounterMetric with the given name, help string and optional initialValue. final CounterMetricregisterCounter(String name, String help)Creates and registers a CounterMetric with the given name, help string and optional initialValue. final LongGaugeMetricregisterLongGauge(String name, String help, Long initialValue)Creates and registers a LongGaugeMetric with the given name, help string and optional initialValue. final LongGaugeMetricregisterLongGauge(String name, String help)Creates and registers a LongGaugeMetric with the given name, help string and optional initialValue. final InfoMetricregisterInfo(String name, String help, String value)Creates and registers an InfoMetric with the given name, help string and value. final UnitresetAll()Resets all metrics in this container to their default values. -
-
Method Detail
-
getCheckForNameConflicts
final Boolean getCheckForNameConflicts()
Defines the behavior when registering a metric with a name in use by an existing metric. Useful for testing. Defaults to
true.If
true, throws an exception if a metric with a given name already exists. Iffalse, attempts to return the existing metric, throwing an exception if there is a type mismatch.
-
setCheckForNameConflicts
final Unit setCheckForNameConflicts(Boolean checkForNameConflicts)
Defines the behavior when registering a metric with a name in use by an existing metric. Useful for testing. Defaults to
true.If
true, throws an exception if a metric with a given name already exists. Iffalse, attempts to return the existing metric, throwing an exception if there is a type mismatch.
-
getJsonString
final String getJsonString()
-
getRegistry
final CollectorRegistry getRegistry()
the registry used to register metrics
-
getPrometheusMetrics
final String getPrometheusMetrics(String contentType)
Returns the metrics in this instance in the Prometheus text-based format. See Formats.
- Parameters:
contentType- the Content-Type header string
-
registerBooleanMetric
@JvmOverloads() final BooleanMetric registerBooleanMetric(String name, String help, Boolean initialValue)
Creates and registers a BooleanMetric with the given name, help string and optional initialValue.
Throws an exception if a metric with the same name but a different type exists.
-
registerBooleanMetric
@JvmOverloads() final BooleanMetric registerBooleanMetric(String name, String help)
Creates and registers a BooleanMetric with the given name, help string and optional initialValue.
Throws an exception if a metric with the same name but a different type exists.
-
registerCounter
@JvmOverloads() final CounterMetric registerCounter(String name, String help, Long initialValue)
Creates and registers a CounterMetric with the given name, help string and optional initialValue. If omitted, a "_total" suffix is added to the metric name to ensure consistent (Counter) metric naming.
Throws an exception if a metric with the same name but a different type exists.
-
registerCounter
@JvmOverloads() final CounterMetric registerCounter(String name, String help)
Creates and registers a CounterMetric with the given name, help string and optional initialValue. If omitted, a "_total" suffix is added to the metric name to ensure consistent (Counter) metric naming.
Throws an exception if a metric with the same name but a different type exists.
-
registerLongGauge
@JvmOverloads() final LongGaugeMetric registerLongGauge(String name, String help, Long initialValue)
Creates and registers a LongGaugeMetric with the given name, help string and optional initialValue.
Throws an exception if a metric with the same name but a different type exists.
-
registerLongGauge
@JvmOverloads() final LongGaugeMetric registerLongGauge(String name, String help)
Creates and registers a LongGaugeMetric with the given name, help string and optional initialValue.
Throws an exception if a metric with the same name but a different type exists.
-
registerInfo
final InfoMetric registerInfo(String name, String help, String value)
Creates and registers an InfoMetric with the given name, help string and value.
Throws an exception if a metric with the same name but a different type exists.
-
-
-
-