I have an application that spawns many worker threads. In the main application I create a PrometheusMetrics() helper class that registers the metrics the threads will report on with the appropriate label names. I pass the PrometheusMetrics class into each thread, and then create local variables in each thread with the labels filled out differently per thread.
I start the server and I see the #HELP and #TYPE text per metric I've registered, but I don't see any of the metrics outputs.
class PrometheusMetrics() {
lateinit var iterations = Counter.build()
.name("a_metric")
.labelNames("a","b","c")
.help("some help")
}
class main(){
prometheusMetrics =PrometheusMetrics()
forEach (iterator){
spawnWorker(prometheusMetrics)
}
}
Worker(prometheusMetrics: PrometheusMetrics){
val localMetric = prometheusMetrics.iterations.labels('different","per","worker")
localMetric.inc()
}