2022-11-09 14:00:44 +00:00
|
|
|
package main
|
2022-11-09 12:19:56 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"errors"
|
|
|
|
"fmt"
|
|
|
|
"log"
|
|
|
|
"net/http"
|
|
|
|
"os"
|
|
|
|
|
2022-11-09 14:00:44 +00:00
|
|
|
"git.k-space.ee/k-space/logmower-shipper/logmower"
|
2022-11-09 12:19:56 +00:00
|
|
|
"github.com/prometheus/client_golang/prometheus/promhttp"
|
|
|
|
)
|
|
|
|
|
2022-11-09 14:00:44 +00:00
|
|
|
const PrometheusPrefix = "logmower" // TODO:
|
2022-11-09 12:19:56 +00:00
|
|
|
|
|
|
|
func main() {
|
|
|
|
go func() {
|
|
|
|
metricsPort := 2112
|
|
|
|
|
|
|
|
log.Printf("serving /metrics on port %d", metricsPort)
|
|
|
|
|
|
|
|
http.Handle("/metrics", promhttp.Handler())
|
|
|
|
|
|
|
|
if err := http.ListenAndServe(fmt.Sprintf(":%d", metricsPort), nil); !errors.Is(err, http.ErrServerClosed) {
|
|
|
|
log.Fatalf("serving /metrics: %e", err)
|
|
|
|
}
|
|
|
|
}()
|
|
|
|
|
2022-11-09 14:00:44 +00:00
|
|
|
if err := logmower.App.Run(os.Args); err != nil {
|
2022-11-09 12:19:56 +00:00
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
}
|