mirror of
https://github.com/sot-tech/mochi.git
synced 2026-06-11 23:43:29 -07:00
frontend/*: only record ClientErrors to Prometheus
All ClientErrors are constant and should not cause Prometheus streams to be generated for all possible failure scenarios in the program. Fixes #294.
This commit is contained in:
@@ -39,7 +39,11 @@ var promResponseDurationMilliseconds = prometheus.NewHistogramVec(
|
||||
func recordResponseDuration(action string, af *bittorrent.AddressFamily, err error, duration time.Duration) {
|
||||
var errString string
|
||||
if err != nil {
|
||||
errString = err.Error()
|
||||
if _, ok := err.(bittorrent.ClientError); ok {
|
||||
errString = err.Error()
|
||||
} else {
|
||||
errString = "internal error"
|
||||
}
|
||||
}
|
||||
|
||||
var afString string
|
||||
|
||||
@@ -42,7 +42,11 @@ var promResponseDurationMilliseconds = prometheus.NewHistogramVec(
|
||||
func recordResponseDuration(action string, af *bittorrent.AddressFamily, err error, duration time.Duration) {
|
||||
var errString string
|
||||
if err != nil {
|
||||
errString = err.Error()
|
||||
if _, ok := err.(bittorrent.ClientError); ok {
|
||||
errString = err.Error()
|
||||
} else {
|
||||
errString = "internal error"
|
||||
}
|
||||
}
|
||||
|
||||
var afString string
|
||||
|
||||
Reference in New Issue
Block a user