diff --git a/kube_cache/main.go b/kube_cache/main.go index b86d13c..cdb44a1 100644 --- a/kube_cache/main.go +++ b/kube_cache/main.go @@ -3,6 +3,7 @@ package main import ( "log" "os" + "strings" "github.com/CosmicKube/kube_cache/aiStuff" "github.com/CosmicKube/kube_cache/model" @@ -34,6 +35,22 @@ func main() { router := gin.Default() p := ginpromehteus.NewPrometheus("gin") + p.ReqCntURLLabelMappingFn = func(c *gin.Context) string { + url := c.Request.URL.Path + for _, p := range c.Params { + if p.Key == "id" { + url = strings.Replace(url, p.Value, ":id", 1) + break + } else if p.Key == "id1" { + url = strings.Replace(url, p.Value, ":id1", 1) + break + } else if p.Key == "id2" { + url = strings.Replace(url, p.Value, ":id2", 1) + break + } + } + return url + } p.Use(router) router.Use(cors.New(cors.Config{