Skip to content

Instantly share code, notes, and snippets.

@tomerguttman
Created October 6, 2022 08:36
Show Gist options
  • Save tomerguttman/dd2995dea3f88bb17350c76f0f3de99f to your computer and use it in GitHub Desktop.
Save tomerguttman/dd2995dea3f88bb17350c76f0f3de99f to your computer and use it in GitHub Desktop.
Prometheus counters
const Prometheus = require('prom-client');
const reportsStartedCounter = Prometheus.register.getSingleMetric(prometheusConfig.METRIC_NAMES.REPORTS_STARTED_FLOW_COUNTER) ||
new Prometheus.Counter({
name: prometheusConfig.METRIC_NAMES.REPORTS_STARTED_FLOW_COUNTER,
labelNames: ['report_type', 'is_scheduled'],
help: 'Reports that are actually being generated'
});
function incReportsStartedCounter(reportType, isScheduled) {
reportsStartedCounter.inc({ report_type: reportType, is_scheduled: isScheduled });
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment