Hi,
I'm new to the metrics scene so pardon my ignorance.
I've got java application that I want to expose some custom metrics for. Within it I have a MBean with some basic information and the JMX Exporter is setup to expose that data. Everything works fine when I'm using basic types like integers or doubles but if I want to expose the metrics with labels then I'm finding it doesn't work. The way I'm exposing them, however, is by using List<Collector.MetricFamilySamples>, is that the correct way?
For example, I register the meter like so:
resourcesIgnored = Counter.build("resources_ignored", "Number of resources ignored").labelNames("type").register();
and to increment I do this:
resourcesIgnored.labels(type).inc();
In the MBean to expose it I have the following code:
return resourcesIgnored.collect();
which returns a List of MetricFamilySamples.
The result is that the exporter doesn't return this in the end scrape.
If I change to List<Collector.MetricFamilySamples.Sample> by returning resourcesIgnored.collect().get(0).samples then I get the same, nothing is returned.
Is there a way I can get metrics that have labels exported?
Thanks