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

Remove statsd #949

Merged
merged 4 commits into from
Jan 21, 2020
Merged
Show file tree
Hide file tree
Changes from 2 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
1 change: 1 addition & 0 deletions changelog.d/949.removal
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove `statsd` support as per #818
Copy link
Member

Choose a reason for hiding this comment

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

this will probably need a real link to work

9 changes: 0 additions & 9 deletions src/bridge/IrcBridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { BridgedClient } from "../irc/BridgedClient";
import { IrcUser } from "../models/IrcUser";
import { IrcRoom } from "../models/IrcRoom";
import { BridgeRequest, BridgeRequestErr } from "../models/BridgeRequest";
import stats from "../config/stats";
import { NeDBDataStore } from "../datastore/NedbDataStore";
import { PgDataStore } from "../datastore/postgres/PgDataStore";
import { getLogger } from "../logging";
Expand Down Expand Up @@ -523,29 +522,21 @@ export class IrcBridge {
return;
}
logMessage(req, "SUCCESS");
const isFromIrc = Boolean((req.getData() || {}).isFromIrc);
stats.request(isFromIrc, "success", req.getDuration());
this.logMetric(req, "success");
});
// FAILURE
this.bridge.getRequestFactory().addDefaultRejectCallback((req) => {
const isFromIrc = Boolean((req.getData() || {}).isFromIrc);
logMessage(req, "FAILED");
stats.request(isFromIrc, "fail", req.getDuration());
this.logMetric(req, "fail");
BridgeRequest.HandleExceptionForSentry(req, "fail");
});
// DELAYED
this.bridge.getRequestFactory().addDefaultTimeoutCallback((req) => {
logMessage(req, "DELAYED");
const isFromIrc = Boolean((req.getData() || {}).isFromIrc);
stats.request(isFromIrc, "delay", req.getDuration());
}, DELAY_TIME_MS);
// DEAD
this.bridge.getRequestFactory().addDefaultTimeoutCallback((req) => {
logMessage(req, "DEAD");
const isFromIrc = Boolean((req.getData() || {}).isFromIrc);
stats.request(isFromIrc, "dead", req.getDuration());
this.logMetric(req, "dead");
BridgeRequest.HandleExceptionForSentry(req, "dead");
}, DEAD_TIME_MS);
Expand Down
5 changes: 0 additions & 5 deletions src/bridge/IrcHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { BridgedClient } from "../irc/BridgedClient";
import { MatrixRoom, MatrixUser } from "matrix-appservice-bridge";
import { IrcUser } from "../models/IrcUser";
import { IrcAction } from "../models/IrcAction";
import stats from "../config/stats";
import { IrcRoom } from "../models/IrcRoom";
import { MatrixAction } from "../models/MatrixAction";
import { RequestLogger } from "../logging";
Expand Down Expand Up @@ -661,9 +660,6 @@ export class IrcHandler {
if (matrixRooms.length === 0) {
req.log.info("No mapped matrix rooms for IRC channel %s", chan);
}
else {
stats.membership(true, "join");
}
await Promise.all(promises);
return undefined;
}
Expand Down Expand Up @@ -824,7 +820,6 @@ export class IrcHandler {
req.log.warn("Failed to remove power levels for leaving user.");
}
}));
stats.membership(true, "part");
await promise;
return undefined;
}
Expand Down
3 changes: 0 additions & 3 deletions src/bridge/MatrixHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { IrcRoom } from "../models/IrcRoom";
import logging from "../logging";
import { BridgedClient } from "../irc/BridgedClient";
import { IrcServer } from "../irc/IrcServer";
import stats from "../config/stats";
import Bluebird = require("bluebird");
import { IrcAction } from "../models/IrcAction";
import { toIrcLowerCase } from "../irc/formatting";
Expand Down Expand Up @@ -522,7 +521,6 @@ export class MatrixHandler {
return BridgeRequestErr.ERR_VIRTUAL_USER;
}

stats.membership(false, "join");
await Promise.all(promises);
return null;
}
Expand Down Expand Up @@ -691,7 +689,6 @@ export class MatrixHandler {
}
}
}));
stats.membership(false, "part");
await Promise.all(promises);
return null;
}
Expand Down
2 changes: 0 additions & 2 deletions src/bridge/MemberListSyncer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { IrcRoom } from "../models/IrcRoom";
import { BridgeRequest } from "../models/BridgeRequest";
import * as promiseutil from "../promiseutil";
import { Queue } from "../util/Queue";
import stats from "../config/stats";

const log = logging("MemberListSyncer");

Expand Down Expand Up @@ -364,7 +363,6 @@ export class MemberListSyncer {
// Do this here, we might not manage to leave but we won't retry.
this.usersToLeave--;
await this.ircBridge.getAppServiceBridge().getIntent(userId).leave(item.roomId);
stats.membership(true, "part");
});

await Promise.all(item.userIds.map((userId) =>
Expand Down
80 changes: 0 additions & 80 deletions src/config/stats.js

This file was deleted.

8 changes: 0 additions & 8 deletions src/irc/ClientPool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

import * as stats from "../config/stats";
import { getLogger } from "../logging";
import { QueuePool } from "../util/QueuePool";
import Bluebird from "bluebird";
Expand Down Expand Up @@ -395,7 +394,6 @@ export class ClientPool {
}

const numConnections = this.getNumberOfConnections(server);
this.sendConnectionMetric(server);

if (numConnections < server.getMaxClients()) {
// under the limit, we're good for now.
Expand Down Expand Up @@ -509,10 +507,6 @@ export class ClientPool {
return this.virtualClientCounts[server.domain];
}

private sendConnectionMetric(server: IrcServer): void {
stats.ircClients(server.domain, this.getNumberOfConnections(server));
}

private removeBridgedClient(bridgedClient: BridgedClient): void {
const server = bridgedClient.server;
if (bridgedClient.userId) {
Expand Down Expand Up @@ -549,7 +543,6 @@ export class ClientPool {

private async onClientDisconnected(bridgedClient: BridgedClient) {
this.removeBridgedClient(bridgedClient);
this.sendConnectionMetric(bridgedClient.server);

// remove the pending nick we had set for this user
if (this.virtualClients[bridgedClient.server.domain]) {
Expand Down Expand Up @@ -615,7 +608,6 @@ export class ClientPool {
private async reconnectClient(cliChan: ReconnectionItem) {
try {
await cliChan.cli.reconnect();
this.sendConnectionMetric(cliChan.cli.server);
}
catch (ex) {
log.error(
Expand Down
2 changes: 0 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import https from "https";
import { RoomBridgeStore, UserBridgeStore } from "matrix-appservice-bridge";
import { IrcBridge } from "./bridge/IrcBridge";
import { IrcServer } from "./irc/IrcServer";
import stats from "./config/stats";
import ident from "./irc/Ident";
import * as logging from "./logging";
import { LoggerInstance } from "winston";
Expand Down Expand Up @@ -97,7 +96,6 @@ export async function runBridge(port: number, config: BridgeConfig, reg: AppServ
if (config.ircService.statsd.hostname) {
log.warn("STATSD WILL BE DEPRECATED SOON")
log.warn("SEE https://github.com/matrix-org/matrix-appservice-irc/issues/818")
stats.setEndpoint(config.ircService.statsd);
}
if (config.ircService.ident && config.ircService.ident.enabled) {
ident.configure(config.ircService.ident);
Expand Down