Skip to content

📝 [Proposal]: monitor middleware absolute counter #1282

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
3 tasks done
dolvany opened this issue Apr 14, 2025 · 8 comments
Open
3 tasks done

📝 [Proposal]: monitor middleware absolute counter #1282

dolvany opened this issue Apr 14, 2025 · 8 comments
Labels
✏️ Feature New feature or request v3

Comments

@dolvany
Copy link

dolvany commented Apr 14, 2025

Feature Proposal Description

Thanks for this awesome http framework. It is great that metrics are being bolted onto fiber, which allows me to poll the json and get those metrics into influx/grafana. Though, a connections gauge is not very useful for this purpose as it is lossy. Unless the gauge is polled during a connections spike, it goes unnoticed. An absolute counter would be vastly more useful.

Alignment with Express API

I am not familiar with monitoring in express.

HTTP RFC Standards Compliance

Not applicable.

API Stability

Not applicable.

Feature Examples

Not applicable.

Checklist:

  • I agree to follow Fiber's Code of Conduct.
  • I have searched for existing issues that describe my proposal before opening this one.
  • I understand that a proposal that does not meet these guidelines may be closed without explanation.
@dolvany dolvany added v3 ✏️ Feature New feature or request labels Apr 14, 2025
@gaby
Copy link
Member

gaby commented Apr 14, 2025

@dolvany Hello, for the next major version of Fiber we migrated the monitor middleware to the contrib repo.

We also have a draft of a Prometheus middleware that will provide more standard metrics for developers/users.

New monitor middleware for v3: https://github.com/gofiber/contrib/tree/main/monitor

Prometheus Middleware Draft: #1032

My guess is that the Prometheus middleware answers your proposal?

@gaby gaby transferred this issue from gofiber/fiber Apr 14, 2025
@dolvany
Copy link
Author

dolvany commented Apr 14, 2025

@gaby Thanks for the remarkably quick response. My preference is for an agnostic solution, precisely the functionality that currently exists. I will make this proposal over there. Ah, I see the issue is already moved. Thanks!

@gaby
Copy link
Member

gaby commented Apr 14, 2025

@dolvany By absolute counter, do you mean:

  • An absolute connection counter (hard to implement)
  • An absolute request counter

@dolvany
Copy link
Author

dolvany commented Apr 14, 2025

@gaby both would be more useful as a counter rather than a gauge. Gauges are fine for things like memory and cpu. Things like connections, requests and tx/rx bytes are more useful as counters.

@dolvany
Copy link
Author

dolvany commented Apr 14, 2025

@gaby thinking deeper, match counters would be awesome. Like every time something matches an app.Use or app.Get. Though I don't know if there is a good way to associate unique identifiers with each Use/Get/Etc.

@gaby
Copy link
Member

gaby commented Apr 16, 2025

@gaby thinking deeper, match counters would be awesome. Like every time something matches an app.Use or app.Get. Though I don't know if there is a good way to associate unique identifiers with each Use/Get/Etc.

There is ways, but this pushing into becoming the Prometheus middleware which already handles all that.

@gaby
Copy link
Member

gaby commented Apr 16, 2025

The monitor middleware is more for a quick glance at the server usage. Metrics are usually handle via Prometheus or OTEL, you don't want to create your own metrics format since it won't integrate with existing industry tools (ex: Grafana).

@dolvany
Copy link
Author

dolvany commented Apr 17, 2025

Curling json metrics on a cron and outputting influx format with jq is a simple solution that integrates perfectly with grafana. Even the aforementioned absolute request counter would be very useful. Just surfacing my use case. Thanks for the consideration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✏️ Feature New feature or request v3
Projects
None yet
Development

No branches or pull requests

2 participants