api: remove service health from prometheus, implement godoxy metrics

This commit is contained in:
yusing
2025-02-12 05:30:34 +08:00
parent 72dc76ec74
commit c807b30c8f
21 changed files with 531 additions and 152 deletions

View File

@@ -1,7 +1,9 @@
package utils
import (
"context"
"encoding/json"
"errors"
"net/http"
E "github.com/yusing/go-proxy/internal/error"
@@ -17,7 +19,13 @@ func HandleErr(w http.ResponseWriter, r *http.Request, err error, code ...int) {
if err == nil {
return
}
if errors.Is(err, context.Canceled) {
return
}
LogError(r).Msg(err.Error())
if r.Header.Get("Upgrade") == "websocket" {
return
}
if len(code) == 0 {
code = []int{http.StatusInternalServerError}
}