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 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
14 changes: 0 additions & 14 deletions HOWTO.md
Original file line number Diff line number Diff line change
Expand Up @@ -268,20 +268,6 @@ ircService:
port: 1113 # optional (default: 113) but this allows you to run the AS without root.
```

### Statsd
This application service supports sending metrics to a
[statsd server](https://github.com/etsy/statsd). Metrics monitored include:
- Memory usage (RSS, heap, etc)
- Request outcomes (success/fail) and durations (ms).
- Number of active IRC client connections
Sending metrics is disabled by default. To enable this:
```yaml
ircService:
statsd:
hostname: "127.0.0.1"
port: 8125
```

### Logging
Logging is configurable in the yaml, but there is also an extra verbose setting
you can enable. This is done by passing ``--verbose`` or ``-v`` to
Expand Down
1 change: 0 additions & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ new Cli({
level: "debug",
toConsole: true
},
statsd: {},
debugApi: {},
provisioning: {
enabled: false,
Expand Down
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 https://github.com/matrix-org/matrix-appservice-irc/issues/818
10 changes: 0 additions & 10 deletions config.schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,6 @@ properties:
items:
type: "string"
pattern: "^[0-9]+(h|d|w)$"
statsd:
type: "object"
properties:
hostname:
type: "string"
port:
type: "integer"
jobName:
type: "string"
required: ["hostname", "port"]
ident:
type: "object"
properties:
Expand Down
1 change: 0 additions & 1 deletion spec/util/test-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
"level": "debug",
"toConsole": true
},
"statsd": {},
"servers": {
"irc.example": {
"port": 6667,
Expand Down
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
4 changes: 0 additions & 4 deletions src/config/BridgeConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,6 @@ export interface BridgeConfig {
address: string;
port: number;
};
statsd: {
hostname: string;
port: number;
};
};
sentry?: {
enabled: boolean;
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
6 changes: 0 additions & 6 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 @@ -94,11 +93,6 @@ export async function runBridge(port: number, config: BridgeConfig, reg: AppServ
logging.configure(config.ircService.logging);
logging.setUncaughtExceptionLogger(log as LoggerInstance);
}
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);
ident.run();
Expand Down