Add connection state to prometheus metrics

This commit is contained in:
Tulir Asokan
2020-09-27 22:30:08 +03:00
parent f88abe98bf
commit 3dae9b1999
4 changed files with 48 additions and 0 deletions

View File

@@ -551,6 +551,7 @@ func (handler *CommandHandler) CommandDeleteConnection(ce *CommandEvent) {
}
ce.User.Conn.RemoveHandlers()
ce.User.Conn = nil
ce.User.bridge.Metrics.TrackConnectionState(ce.User.JID, false)
ce.Reply("Successfully disconnected. Use the `reconnect` command to reconnect.")
}
@@ -572,6 +573,7 @@ func (handler *CommandHandler) CommandDisconnect(ce *CommandEvent) {
} else if len(sess.Wid) > 0 {
ce.User.SetSession(&sess)
}
ce.User.bridge.Metrics.TrackConnectionState(ce.User.JID, false)
ce.Reply("Successfully disconnected. Use the `reconnect` command to reconnect.")
}