-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
38 lines (30 loc) · 891 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
package main
import (
"fmt"
"net/http"
"github.com/nszilard/log"
"github.com/nszilard/prometheus-custom-metrics/internal/config"
"github.com/nszilard/prometheus-custom-metrics/internal/router"
"github.com/nszilard/prometheus-custom-metrics/metrics"
)
func init() {
// Register Prometheus metrics
metrics.Register()
}
// -----------------------------------
// Swagger annotations
// -----------------------------------
// @title Prometheus Custom Metrics
// @version 1.0
// @description API documentation for the 'Prometheus Custom Metrics' application.
// @BasePath /
func main() {
conf := config.Get()
port := fmt.Sprintf(":%v", conf.Port)
router := router.Create()
log.Infof("%v: listening on port %v", conf.System, port[1:])
if err := http.ListenAndServe(port, router); err != nil {
log.Fatalf("%v: error while serving api: %v", conf.System, err)
panic(err)
}
}