Skip to content

Commit 33752dd

Browse files
cleanup go prom code
1 parent 32877a1 commit 33752dd

File tree

1 file changed

+12
-12
lines changed
  • prometheus-monitoring/go-application

1 file changed

+12
-12
lines changed

prometheus-monitoring/go-application/main.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,25 @@ import (
99
"github.com/prometheus/client_golang/prometheus/promhttp"
1010
)
1111

12-
var (
13-
requestsProcessed = promauto.NewCounter(prometheus.CounterOpts{
14-
Name: "go_request_operations_total",
15-
Help: "The total number of processed requests",
12+
13+
var requestsProcessed = promauto.NewCounter(prometheus.CounterOpts{
14+
Name: "go_request_operations_total",
15+
Help: "The total number of processed requests",
1616
})
17+
18+
19+
var requestDuration = prometheus.NewHistogramVec(prometheus.HistogramOpts{
20+
Name: "go_request_duration_seconds",
21+
Help: "Histogram for the duration in seconds.",
22+
Buckets: []float64{1, 2, 5, 6, 10},
23+
} ,
24+
[]string{"endpoint"},
1725
)
1826

1927
func main() {
2028

2129
fmt.Println("starting...")
2230

23-
requestDuration := prometheus.NewHistogramVec(prometheus.HistogramOpts{
24-
Name: "go_request_duration_seconds",
25-
Help: "Histogram for the duration in seconds.",
26-
Buckets: []float64{1, 2, 5, 6, 10},
27-
},
28-
[]string{"endpoint"},
29-
)
30-
3131
prometheus.MustRegister(requestDuration)
3232

3333
http.HandleFunc("/", func (w http.ResponseWriter, r *http.Request) {

0 commit comments

Comments
 (0)