use of io.prometheus.client.Collector.MetricFamilySamples in project instrumentation-java by census-instrumentation.
the class PrometheusStatsCollectorTest method testDescribe_WithNamespace.
@Test
public void testDescribe_WithNamespace() {
String namespace = "myorg";
PrometheusStatsCollector collector = new PrometheusStatsCollector(mockMetricProducerManager, namespace);
assertThat(collector.describe()).containsExactly(new MetricFamilySamples(namespace + '_' + METRIC_NAME, Type.HISTOGRAM, METRIC_DESCRIPTION, Collections.<Sample>emptyList()));
}
use of io.prometheus.client.Collector.MetricFamilySamples in project instrumentation-java by census-instrumentation.
the class PrometheusStatsCollectorTest method testDescribe.
@Test
public void testDescribe() {
PrometheusStatsCollector collector = new PrometheusStatsCollector(mockMetricProducerManager, "");
assertThat(collector.describe()).containsExactly(new MetricFamilySamples(METRIC_NAME, Type.HISTOGRAM, METRIC_DESCRIPTION, Collections.<Sample>emptyList()));
}
use of io.prometheus.client.Collector.MetricFamilySamples in project instrumentation-java by census-instrumentation.
the class PrometheusExportUtilsTest method createDescribableMetricFamilySamples.
@Test
public void createDescribableMetricFamilySamples() {
assertThat(PrometheusExportUtils.createDescribableMetricFamilySamples(CUMULATIVE_METRIC_DESCRIPTOR, "")).isEqualTo(new MetricFamilySamples(METRIC_NAME, Type.COUNTER, METRIC_DESCRIPTION, Collections.<Sample>emptyList()));
assertThat(PrometheusExportUtils.createDescribableMetricFamilySamples(SUMMARY_METRIC_DESCRIPTOR, "")).isEqualTo(new MetricFamilySamples(METRIC_NAME2, Type.SUMMARY, METRIC_DESCRIPTION, Collections.<Sample>emptyList()));
assertThat(PrometheusExportUtils.createDescribableMetricFamilySamples(HISTOGRAM_METRIC_DESCRIPTOR, "")).isEqualTo(new MetricFamilySamples(METRIC_NAME3, Type.HISTOGRAM, METRIC_DESCRIPTION, Collections.<Sample>emptyList()));
}
use of io.prometheus.client.Collector.MetricFamilySamples in project instrumentation-java by census-instrumentation.
the class PrometheusExportUtilsTest method createMetricFamilySamples_WithNamespace.
@Test
public void createMetricFamilySamples_WithNamespace() {
String namespace = "opencensus_";
assertThat(PrometheusExportUtils.createMetricFamilySamples(LONG_METRIC, namespace)).isEqualTo(new MetricFamilySamples(namespace + METRIC_NAME, Type.COUNTER, METRIC_DESCRIPTION, Collections.singletonList(new Sample(namespace + METRIC_NAME, Arrays.asList("k1", "k2"), Arrays.asList("v1", "v2"), 123456789))));
}
use of io.prometheus.client.Collector.MetricFamilySamples in project instrumentation-java by census-instrumentation.
the class PrometheusExportUtilsTest method createMetricFamilySamples.
@Test
public void createMetricFamilySamples() {
assertThat(PrometheusExportUtils.createMetricFamilySamples(LONG_METRIC, "")).isEqualTo(new MetricFamilySamples(METRIC_NAME, Type.COUNTER, METRIC_DESCRIPTION, Collections.singletonList(new Sample(METRIC_NAME, Arrays.asList("k1", "k2"), Arrays.asList("v1", "v2"), 123456789))));
assertThat(PrometheusExportUtils.createMetricFamilySamples(SUMMARY_METRIC, "")).isEqualTo(new MetricFamilySamples(METRIC_NAME2, Type.SUMMARY, METRIC_DESCRIPTION, Arrays.asList(new Sample(METRIC_NAME2 + "_count", Collections.singletonList("k_3"), Collections.singletonList("v1"), 22), new Sample(METRIC_NAME2 + "_sum", Collections.singletonList("k_3"), Collections.singletonList("v1"), 74.8), new Sample(METRIC_NAME2, Arrays.asList("k_3", LABEL_NAME_QUANTILE), Arrays.asList("v1", "0.99"), 10.2))));
assertThat(PrometheusExportUtils.createMetricFamilySamples(DISTRIBUTION_METRIC, "")).isEqualTo(new MetricFamilySamples(METRIC_NAME3, Type.HISTOGRAM, METRIC_DESCRIPTION, Arrays.asList(new Sample(METRIC_NAME3 + "_bucket", Arrays.asList("k1", "le"), Arrays.asList("v-3", "1.0"), 0), new Sample(METRIC_NAME3 + "_bucket", Arrays.asList("k1", "le"), Arrays.asList("v-3", "2.0"), 2), new Sample(METRIC_NAME3 + "_bucket", Arrays.asList("k1", "le"), Arrays.asList("v-3", "5.0"), 4), new Sample(METRIC_NAME3 + "_bucket", Arrays.asList("k1", "le"), Arrays.asList("v-3", "+Inf"), 5), new Sample(METRIC_NAME3 + "_count", Collections.singletonList("k1"), Collections.singletonList("v-3"), 5), new Sample(METRIC_NAME3 + "_sum", Collections.singletonList("k1"), Collections.singletonList("v-3"), 22.0))));
}
Aggregations