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

Metrics for MatrixHandler - Iline Kicks #644

Merged
merged 5 commits into from Aug 15, 2018
Merged

Conversation

Half-Shot
Copy link
Contributor

@Half-Shot Half-Shot commented Aug 10, 2018

To help us determine the damage when we kick lots of people for failing to get a client.

@Half-Shot Half-Shot requested a review from a team August 10, 2018 18:11

matrixHandlerConnFailureKicks.set(
{server: server.domain},
mxMetrics["connection_failure_kicks"] ? mxMetrics["connection_failure_kicks"] : 0
Copy link
Member

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

YES AAAAAARGH

let metricSet = this.metrics[serverDomain];
if (metricSet === undefined) {
metricSet = this.metrics[serverDomain] = {

Copy link
Member

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?

@@ -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) {
Copy link
Member

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?

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 = {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

semicolon

@@ -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) {
Copy link
Member

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

@Half-Shot Half-Shot merged commit a0dfb92 into develop Aug 15, 2018
@Half-Shot Half-Shot deleted the hs/iline-kick-metrics branch October 1, 2018 10:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants