12345678910111213141516171819202122232425 |
- package fiber
- import (
- "fmt"
- "github.com/gofiber/fiber/v2"
- "github.com/gofiber/fiber/v2/middleware/basicauth"
- "github.com/gofiber/fiber/v2/middleware/monitor"
- )
- func initMetrics(app *fiber.App, sp ServiceProvider) {
- basicAuth := basicauth.New(basicauth.Config{
- Users: map[string]string{
- sp.ConfigService().BasicAuthUser(): sp.ConfigService().BasicAuthPassword(),
- },
- })
- app.Get(metricsURI, basicAuth, monitor.New(getMetricsConfig()))
- }
- func getMetricsConfig() monitor.Config {
- return monitor.Config{
- Title: fmt.Sprintf("%s metrics", appName),
- }
- }
|