-
Notifications
You must be signed in to change notification settings - Fork 152
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 #480
Metrics #480
Conversation
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.
Soru is a bit confused, are these metrics only in-memory? are they saved somehow? if yes, how? If it is just a json blob file thingy like old user and room store, wouldn't that introduce a significant bottleneck?
src/clientfactory.ts
Outdated
// tslint:disable-next-line:only-arrow-functions | ||
channel.send = function() { | ||
MetricPeg.get.remoteCall("channel.send"); | ||
return channel.send.apply(channel, arguments); |
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.
doesn't this recurse? What if we call bindMetricsToChannel
twice on a channel object, won't it do the metrics twice?
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 hello I'm dumb, I wonder how we do this sanely.
@@ -389,6 +392,7 @@ export class DiscordBot { | |||
} | |||
const channel = guild.channels.get(room); | |||
if (channel && channel.type === "text") { | |||
this.ClientFactory.bindMetricsToChannel(channel as Discord.TextChannel); |
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.
shouldn't we always bind the channel on message processing? Or even better, right when the message enters via the event listeners?
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.
Nope, because we only call the send function when sending stuff that came via matrix. Though I guess we should also bind in the event listeners too.
src/bot.ts
Outdated
@@ -766,14 +776,13 @@ export class DiscordBot { | |||
let rooms; | |||
try { | |||
rooms = await this.channelSync.GetRoomIdsFromChannel(msg.channel); | |||
if (rooms === null) { throw Error(); } |
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.
new lines for if-condition due to {}
?
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.
I think I was being lazy, sorry.
private matrixRequest: Histogram; | ||
private requestsInFlight: Map<string, number>; | ||
private bridgeGauges: IBridgeGauges = { | ||
matrixGhosts: 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.
are these autofilled somehow?
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, by the bridge lib. Though some of them will remain 0
By default it blackholes the metrics unless you enable prometheus in the config. If enabled, the bridge will simply add another endpoint onto the bridge's http listener which will spit out a line seperated list of values which are kept in memory. A prometheus instance will then poll this endpoint every X seconds. It's not at all memory intensive since reads are done asyncronously and writes are just updating integer values. |
ah, so you need to run another program (prometheus server) to read out the metrics? makes sense, then |
why don't we bind |
Signed-off-by: pacien <pacien.trangirard@pacien.net>
Signed-off-by: pacien <pacien.trangirard@pacien.net>
Signed-off-by: pacien <pacien.trangirard@pacien.net>
github: closes #487 Signed-off-by: pacien <pacien.trangirard@pacien.net>
fixing compilation with Typescript 3.5.1 github: closes #487 Signed-off-by: pacien <pacien.trangirard@pacien.net>
Fix compilation failure with TS 3.5.1
Override config with environment variables
Signed-off-by: pacien <pacien.trangirard@pacien.net>
Signed-off-by: pacien <pacien.trangirard@pacien.net>
Signed-off-by: pacien <pacien.trangirard@pacien.net>
github: closes #487 Signed-off-by: pacien <pacien.trangirard@pacien.net>
fixing compilation with Typescript 3.5.1 github: closes #487 Signed-off-by: pacien <pacien.trangirard@pacien.net>
…iscord into hs/metrics
💥 |
This PR enables metrics support for the bridge. The way we are doing this is slightly weird. Rather than passing around a metrics instance to all of the handlers, I've just made a MetricPeg static class, which will host a
IBridgeMetrics
instance of your choosing. Personally, this feels more elegant.