Class CustomMappingSampleBuilder
- java.lang.Object
-
- io.prometheus.client.dropwizard.samplebuilder.CustomMappingSampleBuilder
-
- All Implemented Interfaces:
SampleBuilder
public class CustomMappingSampleBuilder extends Object implements SampleBuilder
CustomSampleBuilderimplementation to allow Dropwizard metrics to be translated to Prometheus metrics including custom labels and names. Prometheus metric name and labels are extracted from the Dropwizard name based on the provided list ofMapperConfigs. The FIRST matching config will be used. If no config is matched, theDefaultSampleBuilderis used.
-
-
Constructor Summary
Constructors Constructor Description CustomMappingSampleBuilder(List<MapperConfig> mapperConfigs)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description io.prometheus.client.Collector.MetricFamilySamples.SamplecreateSample(String dropwizardName, String nameSuffix, List<String> additionalLabelNames, List<String> additionalLabelValues, double value)Creates a newCollector.MetricFamilySamples.Samplefor the given parameters.protected io.prometheus.client.dropwizard.samplebuilder.CustomMappingSampleBuilder.NameAndLabelsgetNameAndLabels(MapperConfig config, Map<String,String> parameters)
-
-
-
Constructor Detail
-
CustomMappingSampleBuilder
public CustomMappingSampleBuilder(List<MapperConfig> mapperConfigs)
-
-
Method Detail
-
createSample
public io.prometheus.client.Collector.MetricFamilySamples.Sample createSample(String dropwizardName, String nameSuffix, List<String> additionalLabelNames, List<String> additionalLabelValues, double value)
Description copied from interface:SampleBuilderCreates a newCollector.MetricFamilySamples.Samplefor the given parameters.- Specified by:
createSamplein interfaceSampleBuilder- Parameters:
dropwizardName- Metric name coming from Dropwizard.nameSuffix- Optional suffix to add.additionalLabelNames- Optional additional label names. Needs to have same size as additionalLabelValues.additionalLabelValues- Optional additional label values. Needs to have same size as additionalLabelNames.value- Metric value- Returns:
- A new
Collector.MetricFamilySamples.Sample.
-
getNameAndLabels
protected io.prometheus.client.dropwizard.samplebuilder.CustomMappingSampleBuilder.NameAndLabels getNameAndLabels(MapperConfig config, Map<String,String> parameters)
-
-