Skip to content

feat(telemetry): Prometheus /metrics endpoint with a sample Grafana dashboard - #279

Merged
adeelahmad merged 1 commit into
mainfrom
claude/project-thread-kxit86
Oct 10, 2026
Merged

adeelahmad merged 1 commit into
mainfrom
claude/project-thread-kxit86

Conversation

@adeelahmad

Copy link
Copy Markdown
Owner

Requested by Adeel · project thread

Description

Before: Lens could only push OpenTelemetry to a collector; Prometheus couldn't scrape it.

After: Settings → Telemetry has a Prometheus block (or LENS_PROMETHEUS=on + LENS_PROMETHEUS_TOKEN). Turned on, /metrics on the web app's address (so it follows LENS_BIND) serves Prometheus text format to a scraper sending Authorization: Bearer <scrape token>: jobs by status and pipeline (queue depth), routine runs, resources by status and imports, the activity ledger's calls, tokens, cost, failures and time by kind and model over 1h/24h, budgets (caps, spent, share, over), workers, disk and data folder size. Off by default (404); on without a token answers 401 to everyone. No personal content in labels.

How: app/domain/prometheus.py renders from existing tables per scrape; app/api/metrics.py gates it; Next proxies /metrics like /mcp. Docs in docs/prometheus.md with a scrape config and docs/grafana/lens-dashboard.json.

Motivation and Context

Ask in the project thread: build a Prometheus exporter.

Types of changes

  • New feature (non-breaking change which adds functionality)

Checklist:

  • The title is a Conventional Commit.
  • My code follows the code style of this project.
  • I added or updated tests.
  • I have updated docs/ accordingly.
  • Wrote it under ## Unreleased in CHANGELOG.md.

🤖 Generated with Claude Code

https://claude.ai/code/session_01XCh396xzDRUrSuH1xohcXR


Generated by Claude Code

…ashboard

Off by default; turned on in Settings > Telemetry (or LENS_PROMETHEUS), /metrics answers
only a scraper with the scrape token and is served where the web app is, so it follows
LENS_BIND. Exposes jobs by status and pipeline, routine runs, resources and imports, the
activity ledger's calls, tokens, cost and failures by model, budgets, workers and disk.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XCh396xzDRUrSuH1xohcXR
@adeelahmad adeelahmad self-assigned this Oct 10, 2026
@adeelahmad
adeelahmad merged commit 6a91357 into main Oct 10, 2026
7 checks passed
@adeelahmad
adeelahmad deleted the claude/project-thread-kxit86 branch October 10, 2026 20:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants