Skip to content

Commit

Permalink
Expose to prometheus only if logConsumerMetricsInterval is set
Browse files Browse the repository at this point in the history
Issue: bb-561
  • Loading branch information
KillianG committed Nov 6, 2024
1 parent f3105f9 commit ae963f9
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions extensions/replication/queueProcessor/QueueProcessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -1021,6 +1021,18 @@ class QueueProcessor extends EventEmitter {
*/
static async handleMetrics(res, log) {
log.debug('metrics requested');

if (this.repConfig.queueProcessor.logConsumerMetricsIntervalS) {
// consumer stats lag is on a different update cycle so we need to
// update the metrics when requested
const lagStats = this._consumer.consumerStats.lag;
Object.keys(lagStats).forEach(partition => {
metricsHandler.lag({
partition,
serviceName: this.serviceName,
}, lagStats[partition]);
});
}
const metrics = await ZenkoMetrics.asPrometheus();
res.writeHead(200, {
'Content-Type': ZenkoMetrics.asPrometheusContentType(),
Expand Down

0 comments on commit ae963f9

Please sign in to comment.