Skip to content

Commit

Permalink
Merge pull request #142 from devtron-labs/customizing-metrics-data
Browse files Browse the repository at this point in the history
feat: customizing metrics data
  • Loading branch information
Laeeqdev authored May 20, 2024
2 parents cf29379 + a4eb136 commit b5c65c3
Show file tree
Hide file tree
Showing 14 changed files with 537 additions and 26 deletions.
4 changes: 4 additions & 0 deletions App.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ import (
"fmt"
"github.com/devtron-labs/common-lib/constants"
"github.com/devtron-labs/common-lib/middlewares"
"github.com/devtron-labs/common-lib/pubsub-lib/metrics"
"github.com/devtron-labs/kubelink/api/router"
client "github.com/devtron-labs/kubelink/grpc"
"github.com/devtron-labs/kubelink/internals/middleware"
"github.com/devtron-labs/kubelink/pkg/k8sInformer"
"github.com/devtron-labs/kubelink/pkg/service"
"github.com/go-pg/pg"
Expand Down Expand Up @@ -57,6 +59,7 @@ func (app *App) Start() {
}

grpcPanicRecoveryHandler := func(p any) (err error) {
metrics.IncPanicRecoveryCount("grpc", "", "", "")
app.Logger.Error(constants.PanicLogIdentifier, "recovered from panic", "panic", p, "stack", string(debug.Stack()))
return status.Errorf(codes.Internal, "%s", p)
}
Expand All @@ -72,6 +75,7 @@ func (app *App) Start() {
grpc_prometheus.UnaryServerInterceptor,
recovery.UnaryServerInterceptor(recoveryOption)), // panic interceptor, should be at last
}
app.router.Router.Use(middleware.PrometheusMiddleware)
app.router.InitRouter()
app.grpcServer = grpc.NewServer(opts...)
client.RegisterApplicationServiceServer(app.grpcServer, app.ServerImpl)
Expand Down
2 changes: 0 additions & 2 deletions api/router/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package router

import (
"encoding/json"

"github.com/devtron-labs/common-lib/monitoring"
"github.com/gorilla/mux"
"github.com/prometheus/client_golang/prometheus/promhttp"
Expand Down Expand Up @@ -35,7 +34,6 @@ func (r *RouterImpl) InitRouter() {
statsVizRouter := r.Router.PathPrefix("/kubelink").Subrouter()

r.monitoringRouter.InitMonitoringRouter(pProfListenerRouter, statsVizRouter, "/kubelink")

r.Router.PathPrefix("/metrics").Handler(promhttp.Handler())
r.Router.Path("/health").HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
writer.Header().Set("Content-Type", "application/json")
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
//github.com/argoproj/gitops-engine v0.7.1-0.20231013183858-f15cf615b814
github.com/aws/aws-sdk-go v1.44.285
github.com/caarlos0/env v3.5.0+incompatible
github.com/devtron-labs/common-lib v0.0.16-0.20240509124735-240663359542
github.com/devtron-labs/common-lib v0.0.18-0.20240520062828-c6c38c3f135e
github.com/docker/docker-credential-helpers v0.7.0 // indirect
github.com/evanphx/json-patch v5.7.0+incompatible
github.com/go-pg/pg v6.15.1+incompatible
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -716,8 +716,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/devtron-labs/authenticator v0.4.31 h1:CEMLek3JnMuH9ULsC6BHNJr+NiyGzBd4lgdSxH2IGnc=
github.com/devtron-labs/authenticator v0.4.31/go.mod h1:ozNfT8WcruiSgnUbyp48WVfc41++W6xYXhKFp67lNTU=
github.com/devtron-labs/common-lib v0.0.16-0.20240509124735-240663359542 h1:yCuktNTDqGqn813wX29PmsGTJF8EuiNCrl1cFcNhY34=
github.com/devtron-labs/common-lib v0.0.16-0.20240509124735-240663359542/go.mod h1:Kd0C3v9ulmQfpmq17w/gJfToZ4JrfUGp5haptczHUxE=
github.com/devtron-labs/common-lib v0.0.18-0.20240520062828-c6c38c3f135e h1:feRK1mshlcKh9/dV5sWUtZTsMEBV3perE/OjmnvulQg=
github.com/devtron-labs/common-lib v0.0.18-0.20240520062828-c6c38c3f135e/go.mod h1:deAcJ5IjUjM6ozZQLJEgPWDUA0mKa632LBsKx8uM9TE=
github.com/distribution/distribution/v3 v3.0.0-20221208165359-362910506bc2 h1:aBfCb7iqHmDEIp6fBvC/hQUddQfg+3qdYjwzaiP9Hnc=
github.com/distribution/distribution/v3 v3.0.0-20221208165359-362910506bc2/go.mod h1:WHNsWjnIn2V1LYOrME7e8KxSeKunYHsxEm4am0BUtcI=
github.com/docker/cli v24.0.6+incompatible h1:fF+XCQCgJjjQNIMjzaSmiKJSCcfcXb3TWTcc7GAneOY=
Expand Down
Loading

0 comments on commit b5c65c3

Please sign in to comment.