feat: add Prometheus metrics foundation with /metrics admin endpoint#80
Open
nerdalert wants to merge 1 commit intopraxis-proxy:mainfrom
Open
feat: add Prometheus metrics foundation with /metrics admin endpoint#80nerdalert wants to merge 1 commit intopraxis-proxy:mainfrom
nerdalert wants to merge 1 commit intopraxis-proxy:mainfrom
Conversation
Collaborator
|
Converted to draft: required checks failing. |
b4fe4aa to
d944e1c
Compare
- Add /metrics scrape endpoint to the admin listener alongside /healthy and /ready. - Install metrics + metrics-exporter-prometheus as workspace dependencies. - Emit praxis_http_requests_total counter and praxis_http_request_duration_seconds histogram from both HTTP handler logging hooks. - Labels: method, status_class (2xx/3xx/4xx/5xx), route (placeholder unknown), cluster (from router or none). Signed-off-by: Brent Salisbury <bsalisbu@redhat.com>
d944e1c to
1021bd7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Trying to keep this not obnoxiously large. Scoping to metrics foundation:
/metrics, the Prom recorder, and low cardinality HTTP request metrics to make sure cardinality is a first class citizen here. With/metricswe can start thinking about token usage, quota, rate-limit, PoCs and how to scale them.Summary
Details
Deferred to follow-up PRs to try and keep this already too large PR reviewable 😬: active request gauge, TCP metrics, upstream metrics, error counters, configurable label sets, path grouping, route name schema changes.
Cardinality
I intentionally kept the initial label set conservative to give some time to think about scaling.
status_classis used instead of raw status codes to avoid creating one series per status.routeis currently emitted asunknowninstead of using raw request paths. Raw paths are intentionally avoided because IDs, tenant names, model names, or arbitrary user-controlled path segments can create unbounded series.clustercomes from the configured router cluster name, ornonewhen no cluster was selected. This assumes clusters remain operator-controlled config values, not per-request dynamic values.methodis the only request-derived label. It is expected to remain low-cardinality; a follow-up can normalize unknown/custom methods toOTHERif needed.Follow-up work for #8 should keep this rule: metrics labels must come from bounded config or normalized enums, not raw request data. Route naming/path grouping should be added before
routeis populated with anything more specific thanunknown.Test plan
Manual validation/demo output: https://gist.github.com/nerdalert/e35609d4b38693fb27ae01e4b9644abd
Refs #8
Ty!