I have coded a Prometheus client_java collector/exporter for a proprietary 
server that counts the number of its jobs and observes elapsed times and 
data lengths. This works fine. But, the requirement now is to expand on 
that, adding labels to the count of jobs; notionally:

type="PDF|HTML|TEXT|RTF"
status="fail|success"

Unfortunately, the labels example in 
https://github.com/prometheus/client_java#labels isn't enough for me to 
bridge my lack of Prometheus understanding. Is that example indicating that 
by coding labelNames("method") in the Counter declaration and then calling 
requests.labels("get").inc() that the get method count is being 
incremented? If so, that sounds like Prometheus dynamically use that method 
label to store the count for get or post or any other method name passed, 
is that correct?

In my experience, as soon as I add labelNames to a Counter declaration like 
this:
private static final Counter jobsSuccessful = 
Counter.build().namespace("curam_xmlserver").name("job_successes").help("Successful
 
xmlserver jobs").labelNames("type").register(); 

it breaks the Counter. That is, without labelNames coded I get this output 
(no activity):
curl -s http://localhost:8080/metrics | grep job_successes 
# HELP curam_xmlserver_job_successes_total Successful xmlserver jobs 
# TYPE curam_xmlserver_job_successes_total counter 
curam_xmlserver_job_successes_total 0.0 

And after adding labelNames there is no longer the zero counter 
(curam_xmlserver_job_successes_total 
0.0) and the collector doesn't count or observe anything.

Is this a bug that I should create an issue for, or what am I doing wrong, 
please? This is with release 0.15.0.

Thank you, 
www

-- 
You received this message because you are subscribed to the Google Groups 
"Prometheus Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-developers/ff51a99a-e7bb-46d7-a455-1dbda3f80556n%40googlegroups.com.

Reply via email to