Skip to content

Commit

Permalink
update prom req mapping func (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
billiford authored Sep 22, 2021
1 parent e9c5152 commit e6686f5
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 2,260 deletions.
14 changes: 11 additions & 3 deletions cmd/clouddriver/clouddriver.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/homedepot/go-clouddriver/pkg/kubernetes"
"github.com/homedepot/go-clouddriver/pkg/server"
"github.com/homedepot/go-clouddriver/pkg/sql"
ginprometheus "github.com/mcuadros/go-gin-prometheus"
ginprometheus "github.com/zsais/go-gin-prometheus"
)

var (
Expand All @@ -27,7 +27,7 @@ func main() {

func init() {
// Setup metrics.
p := ginprometheus.NewPrometheus("gin")
p := ginprometheus.NewPrometheus("clouddriver")
p.MetricsPath = "/metrics"
p.Use(r)

Expand Down Expand Up @@ -86,8 +86,16 @@ func reqCntURLLabelMappingFn(c *gin.Context) string {
for _, p := range c.Params {
// The following replaces certain path params with a generic name.
switch p.Key {
case "account":
// Leave account information if this is the Manifests API.
if !strings.HasPrefix(url, "/manifests") {
url = strings.Replace(url, p.Value, ":"+p.Key, 1)
}
case "application":
url = strings.Replace(url, p.Value, ":"+p.Key, 1)
// Leave application information if this is the Applications API.
if !strings.HasPrefix(url, "/applications") {
url = strings.Replace(url, p.Value, ":"+p.Key, 1)
}
case "location":
url = strings.Replace(url, p.Value, ":"+p.Key, 1)
case "name":
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ require (
github.com/mattn/go-isatty v0.0.12 // indirect
github.com/mattn/go-sqlite3 v1.14.0
github.com/maxbrunsfeld/counterfeiter/v6 v6.2.3 // indirect
github.com/mcuadros/go-gin-prometheus v0.1.0
github.com/mitchellh/mapstructure v1.3.3 // indirect
github.com/nsf/gocode v0.0.0-20190302080247-5bee97b48836 // indirect
github.com/onsi/ginkgo v1.16.2
Expand All @@ -36,6 +35,7 @@ require (
github.com/sirupsen/logrus v1.6.0 // indirect
github.com/stamblerre/gocode v1.0.0 // indirect
github.com/stretchr/testify v1.5.1 // indirect
github.com/zsais/go-gin-prometheus v0.1.1-0.20200217150448-2199a42d96c1
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d
golang.org/x/sys v0.0.0-20210514084401-e8d321eab015 // indirect
golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,8 @@ github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/zsais/go-gin-prometheus v0.1.1-0.20200217150448-2199a42d96c1 h1:I0mc2IYyLOIg7m6/efsLimk77Nnzn83VGijD2Bu+jwg=
github.com/zsais/go-gin-prometheus v0.1.1-0.20200217150448-2199a42d96c1/go.mod h1:Slirjzuz8uM8Cw0jmPNqbneoqcUtY2GGjn2bEd4NRLY=
go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
Expand Down
98 changes: 0 additions & 98 deletions manifests/artifacts-config-map.yaml

This file was deleted.

109 changes: 0 additions & 109 deletions manifests/deployment.yaml

This file was deleted.

18 changes: 0 additions & 18 deletions manifests/go-clouddriver-service-monitor.yaml

This file was deleted.

Loading

0 comments on commit e6686f5

Please sign in to comment.