Repository navigation
feat(integrations): Prometheus metrics base view (0.4.0) - #29
Merged
Merged
Conversation
New module basicbar_integrations.metrics: Gauges renders gauge families in the Prometheus text format 0.0.4 (dependency-free), MetricsView is a GET/HEAD-only APIView that returns 404 while METRICS_TOKEN is empty and 401 (WWW-Authenticate: Bearer) unless the exact bearer token is sent. Subclasses implement collect(); the package registers no URL. Bumps basicbar-integrations to 0.4.0. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
- Ignore Accept/?format= via a custom content negotiation, so scrapers' `Accept: text/plain;version=0.0.4` no longer gets 406 (also before the token check). - Validate metric/label names with fullmatch (a trailing newline passed). - Reject duplicate label sets within one family. - throttle_classes = (): project default throttles never hit scrapes. - Move the test subclass to tests/views.py; README: ASCII token, wording. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.
Neues Modul
basicbar_integrations.metrics(→integrations/v0.4.0): ein generischer, token-geschützter Prometheus-Exporter, den die -bar-Tools nur noch mit ihren Kennzahlen füllen (erster Nutzer: Ausleihbar; abstimmbar und ansehbar können nachziehen).Gauges: sammelt Gauge-Familien (mit/ohne Labels) und rendert das Prometheus-Textformat 0.0.4 – Namensprüfung (fullmatch), Label-Escaping, int/float-Darstellung, Abweisung doppelter Label-Sets.MetricsView(APIView):GETonly, keine DRF-Auth/-Permissions/-Throttles, ignoriertAccept; Token ausMETRICS_TOKEN(conf-Default""): leer → 404, fehlend/falsch → 401 mitWWW-Authenticate: Bearer, Vergleich perhmac.compare_digest; Antworttext/plain; version=0.0.4,Cache-Control: no-store. Unterklassen implementierencollect(gauges)./api/ein (README mit Beispiel inkl. Caddy-Block).runtests.py: 91 OK, auch unter Python 3.12); CHANGELOG mit Migrationshinweis; Version 0.4.0.🤖 Generated with Claude Code