Skip to content

Commit

Permalink
Added the mechanism behind prometheus exposing metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
rv404674 committed Aug 1, 2020
1 parent 2930ba5 commit 4f98a99
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions handlers/route.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,15 @@ func New() http.Handler {

hist := HistPrometheus{}
hist.Populate()
// prometheusMonitoring and CheckApiKey will be applied to all middlewares prefixed by all
// prometheusMonitoring ,CheckApiKey, Logger will be applied to all middlewares prefixed by all
mainRoute.Use(hist.PrometheusMonitoring)
mainRoute.Use(middlewares.CheckApiKey)
mainRoute.Use(middlewares.Logger)

// WILL expose default metrics for go application
// also as we won't be passing "url" in body, so to prevent missing key from
// being returned from checkApiKey middleware, we wont prefix this with all
// WILL expose default metrics, along with our custom metrics for go application
// NOTE: Prometheus follows a Pull based Mechanism instead of Push Based.
// Monitored applications exposes an HTTP endpoint exposing monitoring metrics.
// Prometheus then periodically download the metrics.
route.Handle("/metrics", promhttp.Handler()).Methods("GET")

mainRoute.HandleFunc("/check", Hellohandler)
Expand Down

0 comments on commit 4f98a99

Please sign in to comment.