Imran Ansari
unread,Aug 26, 2020, 5:16:44 PM8/26/20Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Prometheus Users
Hello,
Not sure why I get a NPE when setting the `labelNames`, I'm able to provide labels just fine using the REST API directly but not with the Java Client, skipping the labels in Java does work fine as well, what gives ?
CollectorRegistry registry = new CollectorRegistry();
final Gauge duration = Gauge.build()
.name(metricName)
.labelNames("l1", "l2")
.help("Duration in seconds.")
.register(registry)
Gauge.Timer durationTimer = duration.startTimer();
java.lang.NullPointerException
at io.prometheus.client.Gauge.startTimer(Gauge.java:283)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)