-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.go
35 lines (28 loc) · 919 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
package main
import (
_ "expvar"
"flag"
"log"
"net/http"
"github.com/dimmyjr/goku/cmd/server"
"github.com/dimmyjr/goku/types"
"github.com/prometheus/client_golang/prometheus/promhttp"
)
func main() {
var kafkaURL, topic, provider, grpcPort, prometheusPort string
flag.StringVar(&kafkaURL, "kafkaURL", "", "Kafka Url")
flag.StringVar(&topic, "topic", "", "Topic Name")
flag.StringVar(&provider, "provider", "", "confluent, sarama, segmentio")
flag.StringVar(&grpcPort, "grpcPort", "", "gRPC Port")
flag.StringVar(&prometheusPort, "prometheusPort", "", "Prometheus Port")
flag.Parse()
http.Handle("/metrics", promhttp.Handler())
go prometheus(prometheusPort)
server.Start(kafkaURL, topic, grpcPort, types.Provider(provider))
}
func prometheus(prometheusPort string) {
err := http.ListenAndServe(":"+prometheusPort, nil)
if err != nil {
log.Fatal("Error to initialize prometheus metrics")
}
}