From 65363d49c2eae934feb6d7cdbd06ae05a4992891 Mon Sep 17 00:00:00 2001 From: Aaron Schlesinger Date: Fri, 12 Nov 2021 17:56:33 +0000 Subject: [PATCH 1/3] Adding prometheus metrics to the interceptor Signed-off-by: Aaron Schlesinger --- go.mod | 1 + interceptor/main.go | 3 +++ 2 files changed, 4 insertions(+) diff --git a/go.mod b/go.mod index d4a02a50..d69c007c 100644 --- a/go.mod +++ b/go.mod @@ -21,6 +21,7 @@ require ( k8s.io/apimachinery v0.22.2 k8s.io/client-go v0.22.2 sigs.k8s.io/controller-runtime v0.10.1 + github.com/prometheus/client_golang/promhttp v1.11.0 ) require ( diff --git a/interceptor/main.go b/interceptor/main.go index 9b744e49..5b66863b 100644 --- a/interceptor/main.go +++ b/interceptor/main.go @@ -17,6 +17,7 @@ import ( kedanet "github.com/kedacore/http-add-on/pkg/net" "github.com/kedacore/http-add-on/pkg/queue" "github.com/kedacore/http-add-on/pkg/routing" + "github.com/prometheus/client_golang/prometheus/promhttp" "golang.org/x/sync/errgroup" "k8s.io/client-go/kubernetes" "k8s.io/client-go/rest" @@ -183,7 +184,9 @@ func runAdminServer( timeoutConfig *config.Timeouts, ) error { lggr = lggr.WithName("runAdminServer") + promHdl := promhttp.Handler() adminServer := nethttp.NewServeMux() + adminServer.Handle("/prometheus", promHdl) queue.AddCountsRoute( lggr, adminServer, From be10b5b6936663de4396c31cd52c59856b31ed7a Mon Sep 17 00:00:00 2001 From: Aaron Schlesinger Date: Fri, 12 Nov 2021 20:06:16 +0000 Subject: [PATCH 2/3] Updating GH action for tests to use go 1.17 Signed-off-by: Aaron Schlesinger --- .github/workflows/tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 88004ed8..ef695d06 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -15,6 +15,6 @@ jobs: - name: Install Go uses: actions/setup-go@v2 with: - go-version: 1.16.x + go-version: 1.17.x - name: Test run: go test ./... From ead732b1c705d1a5caad599d8fa928d42bd38864 Mon Sep 17 00:00:00 2001 From: Aaron Schlesinger Date: Fri, 12 Nov 2021 20:06:36 +0000 Subject: [PATCH 3/3] moving prometheus dependency to direct Signed-off-by: Aaron Schlesinger --- go.mod | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/go.mod b/go.mod index d69c007c..2b59c5a3 100644 --- a/go.mod +++ b/go.mod @@ -12,6 +12,7 @@ require ( github.com/onsi/ginkgo v1.16.5 github.com/onsi/gomega v1.17.0 github.com/pkg/errors v0.9.1 + github.com/prometheus/client_golang v1.11.0 github.com/stretchr/testify v1.7.0 go.uber.org/zap v1.19.1 golang.org/x/sync v0.0.0-20210220032951-036812b2e83c @@ -21,7 +22,6 @@ require ( k8s.io/apimachinery v0.22.2 k8s.io/client-go v0.22.2 sigs.k8s.io/controller-runtime v0.10.1 - github.com/prometheus/client_golang/promhttp v1.11.0 ) require ( @@ -44,7 +44,6 @@ require ( github.com/modern-go/reflect2 v1.0.1 // indirect github.com/nxadm/tail v1.4.8 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/prometheus/client_golang v1.11.0 // indirect github.com/prometheus/client_model v0.2.0 // indirect github.com/prometheus/common v0.26.0 // indirect github.com/prometheus/procfs v0.6.0 // indirect