Skip to content

Commit

Permalink
Stop passing error details to prometheus metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
martinboehm committed Jun 4, 2019
1 parent c409a35 commit d7d596b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions bchain/coins/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ type blockChainWithMetrics struct {
func (c *blockChainWithMetrics) observeRPCLatency(method string, start time.Time, err error) {
var e string
if err != nil {
e = err.Error()
e = "failure"
}
c.m.RPCLatency.With(common.Labels{"method": method, "error": e}).Observe(float64(time.Since(start)) / 1e6) // in milliseconds
}
Expand Down Expand Up @@ -301,7 +301,7 @@ type mempoolWithMetrics struct {
func (c *mempoolWithMetrics) observeRPCLatency(method string, start time.Time, err error) {
var e string
if err != nil {
e = err.Error()
e = "failure"
}
c.m.RPCLatency.With(common.Labels{"method": method, "error": e}).Observe(float64(time.Since(start)) / 1e6) // in milliseconds
}
Expand Down
6 changes: 3 additions & 3 deletions db/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func (w *SyncWorker) ResyncIndex(onNewBlock bchain.OnNewBlockFunc, initialSync b
return nil
}

w.metrics.IndexResyncErrors.With(common.Labels{"error": err.Error()}).Inc()
w.metrics.IndexResyncErrors.With(common.Labels{"error": "failure"}).Inc()

return err
}
Expand Down Expand Up @@ -300,7 +300,7 @@ func (w *SyncWorker) ConnectBlocksParallel(lower, higher uint32) error {
return
}
glog.Error("getBlockWorker ", i, " connect block error ", err, ". Retrying...")
w.metrics.IndexResyncErrors.With(common.Labels{"error": err.Error()}).Inc()
w.metrics.IndexResyncErrors.With(common.Labels{"error": "failure"}).Inc()
time.Sleep(time.Millisecond * 500)
} else {
break
Expand Down Expand Up @@ -338,7 +338,7 @@ ConnectLoop:
hash, err = w.chain.GetBlockHash(h)
if err != nil {
glog.Error("GetBlockHash error ", err)
w.metrics.IndexResyncErrors.With(common.Labels{"error": err.Error()}).Inc()
w.metrics.IndexResyncErrors.With(common.Labels{"error": "failure"}).Inc()
time.Sleep(time.Millisecond * 500)
continue
}
Expand Down
4 changes: 2 additions & 2 deletions server/socketio.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ func (s *SocketIoServer) onMessage(c *gosocketio.Channel, req map[string]json.Ra
return rv
}
glog.Error(c.Id(), " onMessage ", method, ": ", errors.ErrorStack(err))
s.metrics.SocketIORequests.With(common.Labels{"method": method, "status": err.Error()}).Inc()
s.metrics.SocketIORequests.With(common.Labels{"method": method, "status": "failure"}).Inc()
e := resultError{}
e.Error.Message = err.Error()
return e
Expand Down Expand Up @@ -670,7 +670,7 @@ func (s *SocketIoServer) onSubscribe(c *gosocketio.Channel, req []byte) interfac

onError := func(id, sc, err, detail string) {
glog.Error(id, " onSubscribe ", err, ": ", detail)
s.metrics.SocketIOSubscribes.With(common.Labels{"channel": sc, "status": err}).Inc()
s.metrics.SocketIOSubscribes.With(common.Labels{"channel": sc, "status": "failure"}).Inc()
}

r := string(req)
Expand Down
2 changes: 1 addition & 1 deletion server/websocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ func (s *WebsocketServer) onRequest(c *websocketChannel, req *websocketReq) {
s.metrics.WebsocketRequests.With(common.Labels{"method": req.Method, "status": "success"}).Inc()
} else {
glog.Error("Client ", c.id, " onMessage ", req.Method, ": ", errors.ErrorStack(err))
s.metrics.WebsocketRequests.With(common.Labels{"method": req.Method, "status": err.Error()}).Inc()
s.metrics.WebsocketRequests.With(common.Labels{"method": req.Method, "status": "failure"}).Inc()
e := resultError{}
e.Error.Message = err.Error()
data = e
Expand Down

0 comments on commit d7d596b

Please sign in to comment.