Skip to content

feat(observability): translate browserless's JSON /metrics into real Prometheus text format #5368

Description

@JSONbored

Part of #5365.

Context: browserless (the headless-Chromium visual-review screenshot capture service, --profile visual-review) exposes a /metrics?token=<BROWSERLESS_TOKEN> endpoint, confirmed live — but it returns JSON ([{"error":0,"maxConcurrent":...,"queued":0,"running":0,"successful":1,"cpu":...,"memory":...,...}]), not Prometheus text format, so Prometheus can't scrape it directly.

Requirements:

  1. Add a small translator sidecar (or a lightweight script-based service) that polls browserless's JSON /metrics endpoint and re-exposes the same data as real Prometheus text (# HELP/# TYPE + metric lines) on its own port.
  2. Mirror the existing backup-exporter pattern already in this repo — described in prometheus/prometheus.yml's own comment as "a tiny BusyBox httpd wrapper around Prometheus text output" — rather than inventing a new architecture. Check scripts/ for the backup-exporter's actual implementation as the concrete template.
  3. Map the meaningful fields from browserless's JSON shape to real metrics: queue depth (queued), concurrency (running/maxConcurrent), rejection/timeout/error counts, and per-session CPU/memory if worth exposing as a gauge.
  4. Add the new sidecar to docker-compose.yml, --profile visual-review-gated (matching browserless's own profile), with deploy.resources.limits.memory and .env.example documentation per the established pattern.
  5. Add a prometheus.yml scrape target for it.
  6. Add panels to a relevant dashboard (queue depth, concurrency, rejection rate are the most actionable — a self-hoster capturing a lot of visual-review screenshots needs to know if browserless itself is the bottleneck).
  7. Full test coverage for the new sidecar + scrape config + dashboard.

Deliverables:

  • New translator sidecar service (script + Docker service definition).
  • prometheus.yml scrape target.
  • Dashboard panel(s) for browserless queue/concurrency/rejection signal.
  • Tests.

Expected outcomes: A self-hoster running visual-review PR screenshot capture can see, in Grafana, whether browserless itself is queuing/rejecting/erroring — instead of only noticing when screenshot capture silently stops working.

Links/resources:

  • browserless's JSON /metrics shape confirmed live on 2026-07-12 (see this issue's context above for the actual field names returned).
  • The existing backup-exporter service in docker-compose.yml + its script under scripts/ as the concrete "translate non-Prometheus output into Prometheus text" template already proven in this repo.

Metadata

Metadata

Assignees

Labels

maintainer-onlyOwner-only work — yields no Gittensor points.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions