envoyproxy/envoy

prometheus metric exporter ignores units

Open

#15,768 创建于 2021年3月30日

在 GitHub 查看
 (2 评论) (0 反应) (0 负责人)C++ (5,373 fork)batch import
area/statshelp wanted

仓库指标

Star
 (27,997 star)
PR 合并指标
 (平均合并 8天) (30 天内合并 378 个 PR)

描述

The current exporter

   double bucket = supported_buckets[i];
    uint64_t value = computed_buckets[i];
...
    output.append(fmt::format("{0}_bucket{{{1}le=\"{2:.32g}\"}} {3}\n", prefixed_tag_extracted_name,
                              hist_tags, bucket, value));

outputs the bucket name without consideration for the units. However Prometheus has strong conventions for metrics which require the metric to be in base units. That is a time metric should have values comprised of seconds, not milliseconds or microseconds.

This is important as it allows timeseries operations between metrics from disparate sources without normalisation transformations scattered all over the place.

Prometheus should be normalising the sum and le fields for Microseconds and Milliseconds unit histograms into Seconds on output in the Prometheus exporter (and I think I read that the GRPC exporter is a separate codepath, so there too).

Repro steps:

Request a prometheus stats page from Envoy, and an internal stats page from a microservice, and try to compare time statistics between them.

I recognise that there are backwards compatibility considerations here, so perhaps an opt-out to allow organisations without other datasources and a strong investment solely in Envoy metrics would be a good idea.

贡献者指南