Log context in case of websocket and socketio error

This commit is contained in:
Martin Boehm 2019-06-10 14:27:11 +02:00
parent 34e5599362
commit c916d46763
2 changed files with 2 additions and 2 deletions

View File

@ -184,7 +184,7 @@ func (s *SocketIoServer) onMessage(c *gosocketio.Channel, req map[string]json.Ra
s.metrics.SocketIORequests.With(common.Labels{"method": method, "status": "success"}).Inc() s.metrics.SocketIORequests.With(common.Labels{"method": method, "status": "success"}).Inc()
return rv return rv
} }
glog.Error(c.Id(), " onMessage ", method, ": ", errors.ErrorStack(err)) glog.Error(c.Id(), " onMessage ", method, ": ", errors.ErrorStack(err), ", data ", string(params))
s.metrics.SocketIORequests.With(common.Labels{"method": method, "status": "failure"}).Inc() s.metrics.SocketIORequests.With(common.Labels{"method": method, "status": "failure"}).Inc()
e := resultError{} e := resultError{}
e.Error.Message = err.Error() e.Error.Message = err.Error()

View File

@ -340,7 +340,7 @@ func (s *WebsocketServer) onRequest(c *websocketChannel, req *websocketReq) {
glog.V(1).Info("Client ", c.id, " onRequest ", req.Method, " success") glog.V(1).Info("Client ", c.id, " onRequest ", req.Method, " success")
s.metrics.WebsocketRequests.With(common.Labels{"method": req.Method, "status": "success"}).Inc() s.metrics.WebsocketRequests.With(common.Labels{"method": req.Method, "status": "success"}).Inc()
} else { } else {
glog.Error("Client ", c.id, " onMessage ", req.Method, ": ", errors.ErrorStack(err)) glog.Error("Client ", c.id, " onMessage ", req.Method, ": ", errors.ErrorStack(err), ", data ", string(req.Params))
s.metrics.WebsocketRequests.With(common.Labels{"method": req.Method, "status": "failure"}).Inc() s.metrics.WebsocketRequests.With(common.Labels{"method": req.Method, "status": "failure"}).Inc()
e := resultError{} e := resultError{}
e.Error.Message = err.Error() e.Error.Message = err.Error()