| @@ -115,11 +115,43 @@ PushGateway pushGateway = PushGateway.builder() |
|
|
| 115 |
115 |
However, this requires that the JVM can validate the server certificate. |
| 116 |
116 |
|
| 117 |
117 |
If you want to skip certificate verification, you need to provide your own |
| 118 |
|
-[HttpConnectionFactory](/client_java/api/io/prometheus/metrics/exporter/pushgateway/HttpConnectionFactory.html). |
|
118 |
+`HttpConnectionFactory`. See the |
|
119 |
+[API docs](/client_java/api/io/prometheus/metrics/exporter/pushgateway/HttpConnectionFactory.html). |
| 119 |
120 |
The `PushGatewayTestApp` in `integration-tests/it-pushgateway` has a complete example of this. |
| 120 |
121 |
|
| 121 |
122 |
## Configuration Properties |
| 122 |
123 |
|
| 123 |
124 |
The [PushGateway](/client_java/api/io/prometheus/metrics/exporter/pushgateway/PushGateway.html) |
| 124 |
125 |
supports a couple of properties that can be configured at runtime. |
| 125 |
126 |
See [config]({{< relref "../config/config.md" >}}). |
|
127 |
+ |
|
128 |
+## Troubleshooting shaded jars |
|
129 |
+ |
|
130 |
+If you build a shaded jar with the Maven Shade Plugin and `minimizeJar=true`, the PushGateway may |
|
131 |
+fail at runtime with an error like this: |
|
132 |
+ |
|
133 |
+```text |
|
134 |
+java.lang.RuntimeException: class |
|
135 |
+io.prometheus.metrics.expositionformats.PrometheusProtobufWriter is not available |
|
136 |
+``` |
|
137 |
+ |
|
138 |
+This happens because the PushGateway loads the protobuf writer implementation via reflection. The |
|
139 |
+Maven Shade Plugin does not detect that reflective usage during minimization, so it may strip the |
|
140 |
+required classes from the final jar. |
|
141 |
+ |
|
142 |
+To avoid this, keep the `prometheus-metrics-exposition-formats` artifact on the classpath and |
|
143 |
+preserve the protobuf-related packages in your shade configuration: |
|
144 |
+ |
|
145 |
+```xml |
|
146 |
+<filters> |
|
147 |
+ <filter> |
|
148 |
+ <artifact>io.prometheus:prometheus-metrics-exposition-formats</artifact> |
|
149 |
+ <includes> |
|
150 |
+ <include>io/prometheus/metrics/expositionformats/**</include> |
|
151 |
+ <include>io/prometheus/metrics/shaded/**</include> |
|
152 |
+ </includes> |
|
153 |
+ </filter> |
|
154 |
+</filters> |
|
155 |
+``` |
|
156 |
+ |
|
157 |
+Alternatively, disable jar minimization for the shaded build. |