Skip to content

Commit

Permalink
feat: add zone name to prometheus (#422)
Browse files Browse the repository at this point in the history
* feat: add zone label to zonemta_delivery_status prometheus

* feat: add zone to other metrics

* Revert "feat: add zone to other metrics"

This reverts commit a37cb70.
  • Loading branch information
bennet-esyoil authored Sep 10, 2024
1 parent 33c5d28 commit df06cba
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ The exposed metrics include a lot of different data but the most important ones

##### zonemta_delivery_status

`zonemta_delivery_status` exposes counters for delivery statuses. There are 3 different `result` label values
`zonemta_delivery_status` exposes counters for delivery statuses. There are 3 different `result` label values. The zone name is exposed in the `zone` label.

- `result="delivered"` – count of deliveries accepted by remote MX
- `result="rejected"` – count of deliveries that hard bounced
Expand Down
8 changes: 5 additions & 3 deletions lib/queue-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const promClient = require('prom-client');
const deliveryStatusCounter = new promClient.Counter({
name: 'zonemta_delivery_status',
help: 'Delivery status',
labelNames: ['status']
labelNames: ['status', 'zone']
});
const messagePushCounter = new promClient.Counter({
name: 'zonemta_message_push',
Expand Down Expand Up @@ -155,7 +155,8 @@ class QueueServer {
deliveryStatus = data.status.delivered ? 'delivered' : 'rejected';
}
deliveryStatusCounter.inc({
status: deliveryStatus
status: deliveryStatus,
zone: client.zone.name
});
return this.releaseDelivery(client.zone, client.id, data, (err, response) => {
if (!client) {
Expand Down Expand Up @@ -188,7 +189,8 @@ class QueueServer {
});
}
deliveryStatusCounter.inc({
status: 'deferred'
status: 'deferred',
zone: client.zone.name
});

return this.deferDelivery(client.zone, client.id, data, (err, response) => {
Expand Down

0 comments on commit df06cba

Please sign in to comment.