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_successesAnd 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