public class CustomMappingSampleBuilder extends Object implements SampleBuilder
SampleBuilder implementation 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 of MapperConfigs.
The FIRST matching config will be used.
If no config is matched, the DefaultSampleBuilder is used.| Constructor and Description |
|---|
CustomMappingSampleBuilder(List<MapperConfig> mapperConfigs) |
| Modifier and Type | Method and Description |
|---|---|
io.prometheus.client.Collector.MetricFamilySamples.Sample |
createSample(String dropwizardName,
String nameSuffix,
List<String> additionalLabelNames,
List<String> additionalLabelValues,
double value)
Creates a new
Collector.MetricFamilySamples.Sample for the given parameters. |
protected io.prometheus.client.dropwizard.samplebuilder.CustomMappingSampleBuilder.NameAndLabels |
getNameAndLabels(MapperConfig config,
Map<String,String> parameters) |
public CustomMappingSampleBuilder(List<MapperConfig> mapperConfigs)
public io.prometheus.client.Collector.MetricFamilySamples.Sample createSample(String dropwizardName, String nameSuffix, List<String> additionalLabelNames, List<String> additionalLabelValues, double value)
SampleBuilderCollector.MetricFamilySamples.Sample for the given parameters.createSample in interface SampleBuilderdropwizardName - 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 valueCollector.MetricFamilySamples.Sample.protected io.prometheus.client.dropwizard.samplebuilder.CustomMappingSampleBuilder.NameAndLabels getNameAndLabels(MapperConfig config, Map<String,String> parameters)
Copyright © 2019. All rights reserved.