cloudapi: record error metrics
Hook up the compose error metric for the prometheus alerts and grafana dashboard.
This commit is contained in:
parent
f8199ec41d
commit
297a60d238
1 changed files with 8 additions and 0 deletions
|
|
@ -3,8 +3,10 @@ package v2
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/labstack/echo/v4"
|
"github.com/labstack/echo/v4"
|
||||||
|
"github.com/osbuild/osbuild-composer/internal/prometheus"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
@ -249,6 +251,12 @@ func (s *Server) HTTPErrorHandler(echoError error, c echo.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if he.Code == http.StatusInternalServerError {
|
||||||
|
if strings.HasSuffix(c.Path(), "/compose") {
|
||||||
|
prometheus.ComposeFailures.Inc()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
sec, ok := he.Message.(ServiceErrorCode)
|
sec, ok := he.Message.(ServiceErrorCode)
|
||||||
if !ok {
|
if !ok {
|
||||||
// No service code was set, so Echo threw this error
|
// No service code was set, so Echo threw this error
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue