-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
40 lines (33 loc) · 774 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// this is a test.
// - olipa kerran kaljaa
//
// for a go doc
package main
import (
initializers "github.com/happosade/csp-server/initializers"
"github.com/gin-gonic/gin"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
"github.com/prometheus/client_golang/prometheus/promhttp"
)
var (
opsProcessed = promauto.NewCounter(prometheus.CounterOpts{
Name: "ping_gets",
Help: "The total number of processed events",
})
)
func init() {
initializers.ConnectES8()
initializers.ConnectES7()
}
func main() {
r := gin.Default()
r.GET("/ping", func(c *gin.Context) {
go opsProcessed.Inc()
c.JSON(200, gin.H{
"message": "pong",
})
})
r.GET("/metrics", gin.WrapH(promhttp.Handler()))
r.Run()
}