Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ go 1.18
// replace github.com/cortezaproject/corteza-locale => ../locale

require (
github.com/766b/chi-prometheus v0.0.0-20211217152057-87afa9aa2ca8
github.com/99designs/basicauth-go v0.0.0-20160802081356-2a93ba0f464d
github.com/Masterminds/sprig v2.22.0+incompatible
github.com/PaesslerAG/gval v1.2.1
Expand Down Expand Up @@ -54,6 +53,7 @@ require (
github.com/modern-go/reflect2 v1.0.2
github.com/ngrok/sqlmw v0.0.0-20211220175533-9d16fdc47b31
github.com/pkg/errors v0.9.1
github.com/ppaanngggg/chi-prometheus v0.0.0-20221020042937-f4c7b7b4b782
github.com/prometheus/client_golang v1.12.1
github.com/sony/sonyflake v1.0.0
github.com/spf13/afero v1.8.2
Expand Down
10 changes: 2 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RX
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
github.com/766b/chi-prometheus v0.0.0-20211217152057-87afa9aa2ca8 h1:hK1G69lDhhrGqJbRA5i1rmT2KI/W77MSdr7hEGHqWdQ=
github.com/766b/chi-prometheus v0.0.0-20211217152057-87afa9aa2ca8/go.mod h1:X/LhbmoBoRu8TxoGIOIraVNhfz3hhikJoaelrOuhdPY=
github.com/99designs/basicauth-go v0.0.0-20160802081356-2a93ba0f464d h1:j6oB/WPCigdOkxtuPl1VSIiLpy7Mdsu6phQffbF19Ng=
github.com/99designs/basicauth-go v0.0.0-20160802081356-2a93ba0f464d/go.mod h1:3cARGAK9CfW3HoxCy1a0G4TKrdiKke8ftOMEOHyySYs=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
Expand Down Expand Up @@ -114,12 +112,6 @@ github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWH
github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
github.com/cortezaproject/corteza-locale v0.0.0-20220930135020-6f4d92edd5b4 h1:FJSAEVsGOxxuJe5Thv+iueTlCMhF1S3kBPpvhU0K4N8=
github.com/cortezaproject/corteza-locale v0.0.0-20220930135020-6f4d92edd5b4/go.mod h1:wsI1UftEdBqTuEDKBZmx2LfNu/kZun5pRbCAi420JCg=
github.com/cortezaproject/corteza-locale v0.0.0-20221012174025-3ac04a48dbf2 h1:gs9uyW9DN413tbKMsR+ZRFubrlbguWehUzNb1BumCsI=
github.com/cortezaproject/corteza-locale v0.0.0-20221012174025-3ac04a48dbf2/go.mod h1:wsI1UftEdBqTuEDKBZmx2LfNu/kZun5pRbCAi420JCg=
github.com/cortezaproject/corteza-locale v0.0.0-20221013092948-9ccdcae2b2b4 h1:yYX5kXcFhTpQx1LJsvu9xQqmok3bUZ6JbvUqS/T6FNE=
github.com/cortezaproject/corteza-locale v0.0.0-20221013092948-9ccdcae2b2b4/go.mod h1:wsI1UftEdBqTuEDKBZmx2LfNu/kZun5pRbCAi420JCg=
github.com/cortezaproject/corteza-locale v0.0.0-20221026122439-c3b0d9b15a4f h1:vH+jAx/EYDYDAOTyfW1yrsyUSEu6J2U0AGKRYSMUJSs=
github.com/cortezaproject/corteza-locale v0.0.0-20221026122439-c3b0d9b15a4f/go.mod h1:wsI1UftEdBqTuEDKBZmx2LfNu/kZun5pRbCAi420JCg=
github.com/cortezaproject/corteza-locale v0.0.0-20221028080428-f7a520f4dd45 h1:qflhq7ByHkuDyPK6RetuE6MJRB0rcBTF3Cv5+SYzphQ=
Expand Down Expand Up @@ -464,6 +456,8 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE
github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/ppaanngggg/chi-prometheus v0.0.0-20221020042937-f4c7b7b4b782 h1:KD0We5YNmmdbWbu7krzOj2zrHPbzYyVvFO5J6tMpwek=
github.com/ppaanngggg/chi-prometheus v0.0.0-20221020042937-f4c7b7b4b782/go.mod h1:q18fjhrJcxePeK35L4gejIIH1FvLgDeX0qgaIXvSMWY=
github.com/pquerna/cachecontrol v0.0.0-20180517163645-1555304b9b35 h1:J9b7z+QKAmPf4YLrFg6oQUotqHQeUNWwkvo7jZp1GLU=
github.com/pquerna/cachecontrol v0.0.0-20180517163645-1555304b9b35/go.mod h1:prYjPmNq4d1NPVmpShWobRqXY3q7Vp+80DqgxxUrUIA=
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
Expand Down
15 changes: 9 additions & 6 deletions pkg/api/server/metrics.go
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
package server

import (
"github.com/99designs/basicauth-go"
"net/http"

"github.com/766b/chi-prometheus"
"github.com/99designs/basicauth-go"

"github.com/go-chi/chi/v5"
"github.com/ppaanngggg/chi-prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
)

// MetricsMiddleware is the request logger that provides metrics to prometheus
func metricsMiddleware(name string) func(http.Handler) http.Handler {
return chiprometheus.NewMiddleware(name)
return chiprometheus.NewPatternMiddleware(name)
}

func metricsMount(r chi.Router, username, password string) {
r.Route("/metrics", func(r chi.Router) {
r.Use(basicauth.New("Metrics", map[string][]string{
username: {password},
}))
if len(password) > 0 {
r.Use(basicauth.New("Metrics", map[string][]string{
username: {password},
}))
}
r.Handle("/", promhttp.Handler())
})
}
3 changes: 0 additions & 3 deletions vendor/github.com/go-chi/chi/.gitignore

This file was deleted.

18 changes: 0 additions & 18 deletions vendor/github.com/go-chi/chi/.travis.yml

This file was deleted.

116 changes: 0 additions & 116 deletions vendor/github.com/go-chi/chi/CHANGELOG.md

This file was deleted.

31 changes: 0 additions & 31 deletions vendor/github.com/go-chi/chi/CONTRIBUTING.md

This file was deleted.

20 changes: 0 additions & 20 deletions vendor/github.com/go-chi/chi/LICENSE

This file was deleted.

Loading