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

Better metric for notifications #10786

Merged
merged 1 commit into from
May 16, 2018
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
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export function shouldNotifyAudio({
}

export function notifyAudioUser(userId, message, room) {
RocketChat.metrics.audioNotificationsSent.inc();
RocketChat.metrics.notificationsSent.inc({ type: 'audio' }, 1, new Date());
RocketChat.Notifications.notifyUser(userId, 'audioNotification', {
payload: {
_id: message._id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export function notifyDesktopUser({
return;
}

RocketChat.metrics.desktopNotificationsSent.inc();
RocketChat.metrics.notificationsSent.inc({ type: 'desktop' }, 1, new Date());
RocketChat.Notifications.notifyUser(userId, 'notification', {
title,
text,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export function sendEmail({ message, user, subscription, room, emailAddress, toA
}

Meteor.defer(() => {
RocketChat.metrics.emailNotificationsSent.inc();
RocketChat.metrics.notificationsSent.inc({ type: 'email' }, 1, new Date());
Email.send(email);
});
}
Expand Down
2 changes: 1 addition & 1 deletion packages/rocketchat-lib/server/lib/PushNotification.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class PushNotification {
};
}

RocketChat.metrics.mobileNotificationsSent.inc();
RocketChat.metrics.notificationsSent.inc({ type: 'mobile' }, 1, new Date());
return Push.send(config);
}
}
Expand Down
5 changes: 1 addition & 4 deletions packages/rocketchat-lib/server/lib/metrics.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,7 @@ RocketChat.metrics.meteorSubscriptions = new client.Summary({
});

RocketChat.metrics.messagesSent = new client.Counter({'name': 'message_sent', 'help': 'cumulated number of messages sent'});
RocketChat.metrics.audioNotificationsSent = new client.Counter({'name': 'audio_sent', 'help': 'cumulated number of audio notifications sent'});
RocketChat.metrics.desktopNotificationsSent = new client.Counter({'name': 'desktop_sent', 'help': 'cumulated number of desktop notifications sent'});
RocketChat.metrics.mobileNotificationsSent = new client.Counter({'name': 'mobile_sent', 'help': 'cumulated number of mobile notifications sent'});
RocketChat.metrics.emailNotificationsSent = new client.Counter({'name': 'email_sent', 'help': 'cumulated number of email notifications sent'});
RocketChat.metrics.notificationsSent = new client.Counter({'name': 'notification_sent', labelNames: ['type'], 'help': 'cumulated number of notifications sent'});

RocketChat.metrics.ddpSessions = new client.Gauge({'name': 'ddp_sessions_count', 'help': 'number of open ddp sessions'});
RocketChat.metrics.ddpConnectedUsers = new client.Gauge({'name': 'ddp_connected_users', 'help': 'number of connected users'});
Expand Down