Prometheus 客户端如何识别指标类型?

How do Prometheus clients identify metric types?

根据官方文档,Prometheus 不保留数据类型。

These are currently only differentiated in the client libraries (to enable APIs tailored to the usage of the specific types) and in the wire protocol. The Prometheus server does not yet make use of the type information and flattens all data into untyped time series.

我正在使用 remote storage adapter 并且需要将数据类型与每个指标一起发送。我该怎么做?

正如您从文档中指出的那样,度量类型未保留。

您可以使用指标名称来获得有关该指标代表什么的提示。例如,对于仪表良好的应用程序和导出器,后缀 _total_count_bucket_sum... 表示计数器。