fix session connection status metrics

This commit is contained in:
c9s 2021-12-28 01:58:36 +08:00
parent 1a850876bf
commit 090d60b44e
2 changed files with 4 additions and 2 deletions

View File

@ -10,8 +10,8 @@ var (
},
[]string{
"exchange", // exchange name
"stream", // user data stream, market data stream
"margin", // margin of connection. 1 or 0
"channel", // channel: user or market
"margin", // margin type: none, margin or isolated
"symbol", // margin symbol of the connection.
},
)

View File

@ -876,6 +876,7 @@ func (session *ExchangeSession) bindUserDataStreamMetrics(stream types.Stream) {
stream.OnOrderUpdate(session.metricsOrderUpdater)
stream.OnDisconnect(func() {
metricsConnectionStatus.With(prometheus.Labels{
"channel": "user",
"exchange": session.ExchangeName.String(),
"margin": session.MarginType(),
"symbol": session.IsolatedMarginSymbol,
@ -883,6 +884,7 @@ func (session *ExchangeSession) bindUserDataStreamMetrics(stream types.Stream) {
})
stream.OnConnect(func() {
metricsConnectionStatus.With(prometheus.Labels{
"channel": "user",
"exchange": session.ExchangeName.String(),
"margin": session.MarginType(),
"symbol": session.IsolatedMarginSymbol,