diff --git a/src/Prometheus.jl b/src/Prometheus.jl index 47d2f1f..0e5baa0 100644 --- a/src/Prometheus.jl +++ b/src/Prometheus.jl @@ -422,7 +422,7 @@ function collect!(metrics::Vector, histogram::Histogram) samples[2] = Sample("_sum", nothing, nothing, @atomic(histogram._sum)) for i in 1:length(histogram.buckets) sample = Sample( - nothing, label_names, make_label_values(label_names, (histogram.buckets[i],)), + "_bucket", label_names, make_label_values(label_names, (histogram.buckets[i],)), histogram.bucket_counters[i][], ) samples[2 + i] = sample diff --git a/test/runtests.jl b/test/runtests.jl index 3b3056a..65007e1 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -220,7 +220,7 @@ end @test s1.value == 2 @test s2.value == 0.5 + 1.6 for (ub, counter, sample, known_count) in zip(c.buckets, c.bucket_counters, metric.samples[3:end], [1, 2, 2]) - @test sample.suffix === nothing + @test sample.suffix == "_bucket" @test (sample.label_names::Prometheus.LabelNames{1}).label_names === (:le,) @test (sample.label_values::Prometheus.LabelValues{1}).label_values == (string(ub),) @test sample.value == counter[] == known_count @@ -233,9 +233,9 @@ end # TYPE metric_name_histogram histogram metric_name_histogram_count 2 metric_name_histogram_sum 2.1 - metric_name_histogram{le="1.0"} 1 - metric_name_histogram{le="2.0"} 2 - metric_name_histogram{le="Inf"} 2 + metric_name_histogram_bucket{le="1.0"} 1 + metric_name_histogram_bucket{le="2.0"} 2 + metric_name_histogram_bucket{le="Inf"} 2 """ end @@ -491,7 +491,7 @@ end # {le} samples for (ls, subrange) in ((l1, 7:8), (l2, 3:4)) for (ub, counter, sample) in zip(buckets, Prometheus.labels(c, ls).bucket_counters, metric.samples[subrange]) - @test sample.suffix === nothing + @test sample.suffix == "_bucket" @test (sample.label_names::Prometheus.LabelNames{3}).label_names === (:endpoint, :status_code, :le) @test (sample.label_values::Prometheus.LabelValues{3}).label_values ==