Skip to content

Commit

Permalink
Merge pull request #11072 from RocketChat/fix-totlalLicechat
Browse files Browse the repository at this point in the history
[FIX] Exception in metrics generation
  • Loading branch information
engelgabriel authored Jun 9, 2018
2 parents 057ab30 + d5019dd commit 7bd51dc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/rocketchat-lib/server/lib/metrics.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ const setPrometheusData = () => {
RocketChat.metrics.ddpAthenticatedSessions.set(authenticatedSessions.length, date);
RocketChat.metrics.ddpConnectedUsers.set(_.unique(authenticatedSessions.map(s => s.userId)).length, date);

if (!RocketChat.models.Statistics) {
return;
}

const statistics = RocketChat.models.Statistics.findLast();
if (!statistics) {
return;
Expand All @@ -117,7 +121,7 @@ const setPrometheusData = () => {
RocketChat.metrics.totalChannels.set(statistics.totalChannels, date);
RocketChat.metrics.totalPrivateGroups.set(statistics.totalPrivateGroups, date);
RocketChat.metrics.totalDirect.set(statistics.totalDirect, date);
RocketChat.metrics.totalLivechat.set(statistics.totlalLivechat, date);
RocketChat.metrics.totalLivechat.set(statistics.totalLivechat, date);

// Message statistics
RocketChat.metrics.totalMessages.set(statistics.totalMessages, date);
Expand Down

0 comments on commit 7bd51dc

Please sign in to comment.