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
Metrics for MatrixHandler - Iline Kicks #644
Conversation
lib/bridge/IrcBridge.js
Outdated
|
||
matrixHandlerConnFailureKicks.set( | ||
{server: server.domain}, | ||
mxMetrics["connection_failure_kicks"] ? mxMetrics["connection_failure_kicks"] : 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mxMetrics["connection_failure_kicks"] || 0
also works
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
YES AAAAAARGH
lib/bridge/MatrixHandler.js
Outdated
let metricSet = this.metrics[serverDomain]; | ||
if (metricSet === undefined) { | ||
metricSet = this.metrics[serverDomain] = { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the linter isn't actually forcing you to have this empty line, is it?
lib/bridge/MatrixHandler.js
Outdated
@@ -1481,6 +1485,22 @@ MatrixHandler.prototype._onUserQuery = Promise.coroutine(function*(req, userId) | |||
yield this.ircBridge.getMatrixUser(ircUser); | |||
}); | |||
|
|||
MatrixHandler.prototype._incrementMetric = function(serverDomain, metricName) { | |||
let metricSet = this.metrics[serverDomain]; | |||
if (metricSet === undefined) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually can we just have this be a !metricSet
?
lib/bridge/IrcBridge.js
Outdated
metrics.addCollector(() => { | ||
this.ircServers.forEach((server) => { | ||
reconnQueue.set({server: server.domain}, | ||
this._clientPool.totalReconnectsWaiting(server.domain) | ||
); | ||
let mxMetrics = this.matrixHandler.getMetrics(server.domain); | ||
if (mxMetrics === null) { | ||
mxMetrics = {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
semicolon
lib/bridge/MatrixHandler.js
Outdated
@@ -1515,6 +1535,13 @@ MatrixHandler.prototype.onUserQuery = function(req, userId) { | |||
return reqHandler(req, this._onUserQuery(req, userId)) | |||
}; | |||
|
|||
MatrixHandler.prototype.getMetrics = function(serverDomain) { | |||
if (this.metrics[serverDomain] === undefined) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This if statement isn't guarding anything
To help us determine the damage when we kick lots of people for failing to get a client.