Forked from ipedrazas/gist:aa2b5550fd38446c131db0913e389b5e
Created
March 28, 2019 12:26
-
-
Save Shahid1993/a6e47c720b14aec9a4cc1931c51a1c96 to your computer and use it in GitHub Desktop.
Revisions
-
ipedrazas created this gist
Apr 23, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,28 @@ // https://github.com/stefanprodan/k8s-podinfo/blob/master/pkg/server/instrument.go func NewInstrument() *Instrument { // used for monitoring and alerting (RED method) histogram := prometheus.NewHistogramVec(prometheus.HistogramOpts{ Subsystem: "http", Name: "requests", Help: "Seconds spent serving HTTP requests.", Buckets: prometheus.DefBuckets, }, []string{"method", "path", "status"}) // used for horizontal pod auto-scaling (Kubernetes HPA v2) counter := prometheus.NewCounterVec( prometheus.CounterOpts{ Subsystem: "http", Name: "requests_total", Help: "The total number of HTTP requests.", }, []string{"status"}, ) prometheus.MustRegister(histogram) prometheus.MustRegister(counter) return &Instrument{ Histogram: histogram, Counter: counter, } }