Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add zone name to prometheus #422

Merged
merged 3 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading