feat(metrics): serve prometheus metrics at /metrics - #24
Merged
Merged
Conversation
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.
shadowstep now serves Prometheus metrics at
GET /metricsin text format 0.0.4, so operators can scrape request, cache and origin counts./healthreads the same counters, so the two cannot drift, and its JSON shape and values stay the same.Changes
prometheuscrate with default features off produces the exposition. It writes format 0.0.4 directly and adds one package to the lock file.prometheus-clientwrites only OpenMetrics text, whose counterTYPElines omit_totaland so mismatch the 0.0.4 media type.shadowstep_requests_total{route,cache},shadowstep_responses_total{route,status_class},shadowstep_origin_requests_total{kind,outcome},shadowstep_origin_body_idle_timeouts_total{kind}, theshadowstep_origin_response_secondshistogram (5 ms to 30 s), two cache counters and two cache gauges. No label holds a path.origin_requests_totalalready counted by status class.--metrics-addr(METRICS_ADDR) moves/metricsto a separate listener that serves nothing else. The proxy listeners then forward/metricsto the origin. Without the flag,/metricsstays on the proxy listeners, as/healthdoes. The README describes the exposure and the path shadowing.prometheus.io/scrapeannotations, because they are a scrape-config convention and not a standard.Verification
main, all 11 new tests intests/integration/metrics.rsfail, because the origin answers/metrics./metricskept on the proxy listener.Not run: a scrape by a real Prometheus server.