[MM-64244] Add websocket disconnect reason metric (#31032)
We've recently spent some effort improving websocket reconnection logic. With this commit, I've augmented the websocket reconnect metric to include a disconnect reason. This will help us measure the impact of these changes in production.
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
611b2a8e79
Коммит
761584c040
@@ -726,7 +726,7 @@ func New(ps *platform.PlatformService, driver, dataSource string) *MetricsInterf
|
||||
Help: "Total number of websocket reconnect attempts",
|
||||
ConstLabels: additionalLabels,
|
||||
},
|
||||
[]string{"type"},
|
||||
[]string{"type", "disconnect_err_code"},
|
||||
)
|
||||
m.Registry.MustRegister(m.WebSocketReconnectCounter)
|
||||
|
||||
@@ -1822,8 +1822,14 @@ func (mi *MetricsInterfaceImpl) IncrementWebsocketEvent(eventType model.Websocke
|
||||
mi.WebsocketEventCounters.With(prometheus.Labels{"type": string(eventType)}).Inc()
|
||||
}
|
||||
|
||||
func (mi *MetricsInterfaceImpl) IncrementWebsocketReconnectEvent(eventType string) {
|
||||
mi.WebSocketReconnectCounter.With(prometheus.Labels{"type": eventType}).Inc()
|
||||
func (mi *MetricsInterfaceImpl) IncrementWebsocketReconnectEventWithDisconnectErrCode(eventType string, disconnectErrCode string) {
|
||||
if disconnectErrCode == "" {
|
||||
disconnectErrCode = "unknown"
|
||||
}
|
||||
mi.WebSocketReconnectCounter.With(prometheus.Labels{
|
||||
"type": eventType,
|
||||
"disconnect_err_code": disconnectErrCode,
|
||||
}).Inc()
|
||||
}
|
||||
|
||||
func (mi *MetricsInterfaceImpl) IncrementWebSocketBroadcastBufferSize(hub string, amount float64) {
|
||||
|
||||
Ссылка в новой задаче
Block a user