I'm using moleculer with prometheus reporter and I have a strange situation. I created a simple service that export a custom metric like so:
created() {
this.broker.metrics.register({
type: "gauge",
name: "firebase_push_total",
description: "Number of successful notifications",
unit: "notification",
rate: true // calculate 1-minute rate
});
},
And I increment this value when hitting an end point like so:
this.broker.metrics.increment("firebase_push_total",1);
the metrics are exported at http://localhost:3030/metrics and I can reach them.
When I run the project with npm run dev
on my dev machine the metrics are exported and I can see them
# HELP firebase_push_total Number of successful notifications
# TYPE firebase_push_total gauge
firebase_push_total{namespace="AKWA-PROD",nodeID="dsi-azza-34756"} 1
firebase_push_total_rate{namespace="AKWA-PROD",nodeID="dsi-azza-34756"} 5.9988002399520095
But when I run the code inside the container (npm run dc:up)
there are only default metrics but the custom ones don't appear.
Any ideas?