prometheus / prometheus/client_java

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

Open
#1,226 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
2.3k
Forks
833
Avg merge
2d 16h
Merged PRs (30d)
86

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the 1.13 Migration Guide and the PrometheusMeterRegistry, Collector, MetricFamilySamples, and TextFormat APIs mentioned in the issue. Trace the corresponding APIs in the current client_java version and document migration equivalents for all three scenarios, including any required code changes. Done means the migration guide explains these replacements clearly.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, prometheus
Domain
observability
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.