2023-01-06 12:32:20 +01:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/VictoriaMetrics/metrics"
|
2023-03-13 16:05:53 +01:00
|
|
|
"github.com/grassrootseconomics/cic-chain-events/pkg/echopprof"
|
2023-01-06 12:32:20 +01:00
|
|
|
"github.com/labstack/echo/v4"
|
|
|
|
)
|
|
|
|
|
|
|
|
func initApiServer() *echo.Echo {
|
|
|
|
server := echo.New()
|
|
|
|
server.HideBanner = true
|
|
|
|
server.HidePort = true
|
|
|
|
|
|
|
|
if ko.Bool("metrics.go_process") {
|
|
|
|
server.GET("/metrics", func(c echo.Context) error {
|
|
|
|
metrics.WritePrometheus(c.Response(), true)
|
|
|
|
return nil
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2023-03-13 16:05:53 +01:00
|
|
|
echopprof.Wrap(server)
|
2023-03-13 15:30:55 +01:00
|
|
|
|
2023-01-06 12:32:20 +01:00
|
|
|
return server
|
|
|
|
}
|