@Test public void testBuilderStyleUsage() { class YourCustomCollector extends Collector { public List<MetricFamilySamples> collect() { return Arrays.<MetricFamilySamples>asList( new SummaryMetricFamily("my_metric", "help", Arrays.asList("name")) .addMetric(Arrays.asList("value1"), 1, 1.0) .addMetric(Arrays.asList("value2"), 2, 2.0) ); } } new YourCustomCollector().register(registry); assertEquals(1.0, registry.getSampleValue("my_metric_count", new String[]{"name"}, new String[]{"value1"}) .doubleValue(), .001); assertEquals(2.0, registry.getSampleValue("my_metric_count", new String[]{"name"}, new String[]{"value2"}) .doubleValue(), .001); }
public SummaryMetricFamily addMetric(List<String> labelValues, double count, double sum) { return addMetric(labelValues, count, sum, Collections.<Double>emptyList()); }
SummaryMetricFamily extends Collector.MetricFamilySamples { public SummaryMetricFamily addMetric(List<String> labelValues, double count, double sum) { return addMetric(labelValues, count, sum, Collections.<Double>emptyList()); } }
SummaryMetricFamily extends Collector.MetricFamilySamples { public SummaryMetricFamily addMetric(List<String> labelValues, double count, double sum) { return addMetric(labelValues, count, sum, Collections.<Double>emptyList()); } SummaryMetricFamily(String name, String help, double count, double sum);  SummaryMetricFamily(String name, String help, List<String> labelNames);  SummaryMetricFamily(String name, String help, List<String> labelNames, List<Double>quantiles); }
SummaryMetricFamily extends Collector.MetricFamilySamples { public SummaryMetricFamily addMetric(List<String> labelValues, double count, double sum) { return addMetric(labelValues, count, sum, Collections.<Double>emptyList()); } SummaryMetricFamily(String name, String help, double count, double sum);  SummaryMetricFamily(String name, String help, List<String> labelNames);  SummaryMetricFamily(String name, String help, List<String> labelNames, List<Double>quantiles); SummaryMetricFamily addMetric(List<String> labelValues, double count, double sum); SummaryMetricFamily addMetric(List<String> labelValues, double count, double sum, List<Double> quantiles); }
SummaryMetricFamily extends Collector.MetricFamilySamples { public SummaryMetricFamily addMetric(List<String> labelValues, double count, double sum) { return addMetric(labelValues, count, sum, Collections.<Double>emptyList()); } SummaryMetricFamily(String name, String help, double count, double sum);  SummaryMetricFamily(String name, String help, List<String> labelNames);  SummaryMetricFamily(String name, String help, List<String> labelNames, List<Double>quantiles); SummaryMetricFamily addMetric(List<String> labelValues, double count, double sum); SummaryMetricFamily addMetric(List<String> labelValues, double count, double sum, List<Double> quantiles);  }