add monitoring #4

Open
alexandvvvvv wants to merge 13 commits from feature/mntr into main
Showing only changes of commit 97771b1023 - Show all commits

View File

@@ -4,6 +4,7 @@ import (
"log"
"net/http"
"strconv"
"strings"
"time"
"github.com/gin-gonic/gin"
@@ -115,7 +116,7 @@ func MetricsMiddleware() gin.HandlerFunc {
httpRequestDuration.WithLabelValues(method, path).Observe(duration)
// Record API-specific metrics for API routes
if c.Request.URL.Path[:4] == "/api" {
if strings.HasPrefix(c.Request.URL.Path, "/api") {
apiRequestsTotal.WithLabelValues(path, method).Inc()
}
}