-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Feature Request: metrics or instrumentation #1526
Comments
Needs more discussion, but It could be a good idea! One thing I'd like to note for now is that we can't use a |
That sounds good. Given PostgREST + NGINX is the recommended/common deployment, one could easily expose the internal metrics prefix at their desired location. |
On #1933, we were thinking of using a special header for this and avoid creating an extra route. Seems Prometheus doesn't support adding headers for scraping though 😞 prometheus/prometheus#1724
But since Nginx would be present, then I guess it's not a problem because it can map the header to a url. Another option in the future might be #1909 as well. So a special header would do. |
Hmm at least for liveness/health checks, we'd want to be hitting the postgrest instances directly, rather than going through nginx or a similar rewriting layer. Even with an nginx setup, I'd imagine we generally have it load balancing between multiple postgrest instances transparently, so even for metrics you'd likely want to be hitting each instance directly, rather than going over nginx. One alternative would be to use a secondary port to host endpoints for liveness/metrics etc. This would avoid creating a breaking change where we reserve e.g. |
Can haskell run multiple web servers on different ports? That's how it's typically done in other languages so that you don't have route path conflicts + you typically don't expose the prometheus webserver port to the outside world. |
@rupurt Yeah, we already have that on latest https://postgrest.org/en/latest/configuration.html#admin-server-port |
@steve-chavez awesome. Would be great to have prometheus metrics in there 😄 |
Is it okay to use https://hackage.haskell.org/package/prometheus for this task? |
From #2477
|
Has this feature been released in any 10.x version? |
Nope, not yet implemented. (Issue would be closed if so) |
These days seems we should be using OpenTelemetry instead of Prometheus. Maybe with: Article about the differences: https://www.timescale.com/blog/prometheus-vs-opentelemetry-metrics-a-complete-guide/ |
A metric for the connection pool max acquisition time would be helpful to prevent acquisition timeouts. While it gets higher it will reach the timeout. Also OpenTelemetry Traces seem to correspond to Server Timing? |
@steve-chavez yep, they seem to be a perfect match. |
It would be nice to have a
/metrics
endpoint that exposes Prometheus-style metrics.Note that I might be opinionated for working mostly with the Prometheus ecosystem - perhaps a more general metrics library, with different exposition formats to choose from, could work? I also don't know which existing Haskell metrics libraries or Prometheus libraries exist or are good (but hackage shows there might be some).
I'm not sure what metrics are the best to expose. I bet PostgREST developers know more about essential PostgREST KPIs. But things like:
The text was updated successfully, but these errors were encountered: