discordgo icon indicating copy to clipboard operation
discordgo copied to clipboard

Health checks - question

Open LyleDavis opened this issue 3 years ago • 1 comments

Is there a recommended and idiomatic way of implementing healthchecks for a bot making use of discordgo?

I'm thinking specifically about healthchecks in dockerfiles. The session has a LastHeartBeatAck time but I'm wondering how I could make use of that for a health check endpoint.

Is there a particular timeframe you'd recommend for the amount of time since LastHeartBeatAck at which I should label a container as unhealthy?

I see that discordgo implements it's own connection tracking with reconnects etc, it would be good if there were a way to hook into that from client code to determine the health status of the current session connection.

LyleDavis avatar Apr 19 '21 13:04 LyleDavis

It seems there's a HeartBeatLatency function.

Potentially the health check could check that: If it's negative beyond a particular figure, that means the last few heartbeats haven't been acknowledged. And if it's positive beyond a particular figure, that means the taken taken for the heartbeat ping is taking too long.

I can't seem to find other bots on GitHub making use of this which makes me think it's simply the wrong way to go about health checks.

LyleDavis avatar Apr 19 '21 14:04 LyleDavis