From 2a73e751f3ddd0717445eb2a9a7da19f2783eb6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9?= Date: Wed, 9 Oct 2024 09:13:40 +0200 Subject: [PATCH] final polish of the new monitor middleware README.md --- README.md | 1 + monitor/README.md | 28 +++++++++++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 96086331..264208e1 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,7 @@ Repository for third party middlewares with dependencies. * [JWT](./jwt/README.md) * [Loadshed](./loadshed/README.md) * [NewRelic](./fibernewrelic/README.md) +* [Monitor](./monitor/README.md) * [Open Policy Agent](./opafiber/README.md) * [Otelfiber (OpenTelemetry)](./otelfiber/README.md) * [Paseto](./paseto/README.md) diff --git a/monitor/README.md b/monitor/README.md index dcb95c3d..0dd78fc7 100644 --- a/monitor/README.md +++ b/monitor/README.md @@ -5,10 +5,15 @@ id: monitor # Monitor ![Release](https://img.shields.io/github/v/tag/gofiber/contrib?filter=monitor*) +![Discord](https://img.shields.io/discord/704680098577514527?style=flat&label=%F0%9F%92%AC%20discord&color=00ACD7) ![Test](https://github.com/gofiber/contrib/workflows/Tests/badge.svg) ![Security](https://github.com/gofiber/contrib/workflows/Security/badge.svg) ![Linter](https://github.com/gofiber/contrib/workflows/Linter/badge.svg) +Monitor middleware for [Fiber](https://github.com/gofiber/fiber) that reports server metrics, inspired by [express-status-monitor](https://github.com/RafalWilinski/express-status-monitor) + +![](https://i.imgur.com/nHAtBpJ.gif) + ## Install This middleware supports Fiber v3. @@ -51,8 +56,29 @@ import ( func main() { app := fiber.New() - app.Use("/monitor", monitor.New()) + // Initialize default config (Assign the middleware to /metrics) + app.Get("/metrics", monitor.New()) + + // Or extend your config for customization + // Assign the middleware to /metrics + // and change the Title to `MyService Metrics Page` + app.Get("/metrics", monitor.New(monitor.Config{Title: "MyService Metrics Page"})) log.Fatal(app.Listen(":3000")) } ``` + + +## Default Config + +```go +var ConfigDefault = Config{ + Title: defaultTitle, + Refresh: defaultRefresh, + FontURL: defaultFontURL, + ChartJsURL: defaultChartJSURL, + CustomHead: defaultCustomHead, + APIOnly: false, + Next: nil, +} +```