prometheus / prometheus/client_java

Exporter Pushgateway runtime issue in versions 1.3.4 and above

Open
#1,411 11 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

Version 1.3.3 works correctly
I believe it is caused by https://github.com/prometheus/client_java/pull/1190
I am using default format in pushgateway which I think is protobuf.

Dependencies in pom.xml:

<dependency>
  <groupId>io.prometheus</groupId>
  <artifactId>prometheus-metrics-core</artifactId>
  <version>1.3.4</version>
</dependency>
<dependency>
  <groupId>io.prometheus</groupId>
  <artifactId>prometheus-metrics-exporter-pushgateway</artifactId>
  <version>1.3.4</version>
</dependency>

Runtime issue from shaded jar:

Exception in thread (...) java.lang.ExceptionInInitializerError
Caused by: java.lang.RuntimeException: class io.prometheus.metrics.expositionformats.PrometheusProtobufWriter is not available
at io.prometheus.metrics.exporter.pushgateway.PushGateway.<init>(PushGateway.java:99)
at io.prometheus.metrics.exporter.pushgateway.PushGateway.<init>(PushGateway.java:77)
at io.prometheus.metrics.exporter.pushgateway.PushGateway$Builder.build(PushGateway.java:456)
(...)
Caused by: java.lang.ExceptionInInitializerError: Exception java.lang.RuntimeException: class io.prometheus.metrics.expositionformats.PrometheusProtobufWriter is not available

So I guess it complains about
https://github.com/prometheus/client_java/blob/main/prometheus-metrics-exporter-pushgateway/src/main/java/io/prometheus/metrics/exporter/pushgateway/PushGateway.java#L9
or
https://github.com/prometheus/client_java/blob/main/prometheus-metrics-exporter-pushgateway/src/main/java/io/prometheus/metrics/exporter/pushgateway/PushGateway.java#L114

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

Compare the 1.3.3 and 1.3.4 dependency behavior in pom.xml, then inspect PushGateway.java around the referenced lines and the shaded-jar packaging. Trace why PrometheusProtobufWriter is unavailable at runtime and confirm that the default Pushgateway format initializes successfully in a shaded jar.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
observability-sre
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.