Equivalent usage of Simpleclient in micrometer-registry-prometheus `1.13.x`

未关闭
#1,226 5 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
25/100
Issue 类型
文档
描述清晰度
需要澄清
活跃度
停滞
技术栈
java, prometheus
领域
observability

调研方向

从 1.13 Migration Guide 以及 issue 中提到的 PrometheusMeterRegistry、Collector、MetricFamilySamples 和 TextFormat API 开始。跟踪当前 client_java 版本中的对应 API,并为全部三个场景记录迁移等价方案,包括任何必需的代码更改。当迁移指南清楚地解释这些替换项时,即视为完成。

由索引模型根据 Issue 内容生成。

描述

Hi Team! We are migrating our project from micrometer-registry-prometheus:1.12.8 to version 1.13.8 . I see that the io.prometheus:simpleclient:jar:0.16.0 has been deprecated.

We have few scenarios which I do not see in the migration guide.

Here are few scenarios,

  1. What is the equivalent of io.prometheus.client.Collector.MetricFamilySamples and the MetricFamilySamples.Sample
   PrometheusMeterRegistry instance = new PrometheusMeterRegistry(PrometheusConfig.DEFAULT);
   MetricFamilySamples samples =  instance.getPrometheusRegistry().metricFamilySamples()
 if (sample == null || sample.name == null || sample.labelNames == null || sample.labelValues == null) {
      LOGGER.error("The provided Sample object is either null or one of its fields is null: {}", sample);
      throw new IllegalArgumentException("The provided Sample object is either null or one of its fields is null: " + sample);
    }
  1. Is the import io.prometheus.metrics.model.registry.Collector a replacement of io.prometheus.client.Collector, however, I couldn't find the below in the new Collector.
Enumeration<Collector.MetricFamilySamples> metricFamilySamples;
  1. Similarly how we can replace the io.prometheus.client.exporter.common.TextFormat?

Could you please help me with the code changes. Also, can you share any additional docs available that we can follow for migrating from the usage of simpleclient.

主要语言
Java
星标
2.3k
派生
833
平均合并
2 天 16 小时
30 天内合并 PR
86

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

prometheus/client_java 的其他 Issue

查看 prometheus/client_java 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。