Skip to main content

A window into your running agent

Your agent is up. But how do you know it’s healthy? How many requests is it handling? Is it getting slower? Are errors piling up? This release adds a simple answer: a /metrics page. Visit it, and your agent tells you exactly how it’s doing — in a format that Prometheus (a popular monitoring tool) understands. You don’t need to install anything extra. It’s built in.

What’s new

The /metrics page

Every Bindu agent now has a live stats page. A small piece of code sits in front of every request, quietly counting things. The /metrics endpoint then hands all those numbers over whenever you ask. Here’s what gets counted:
TypeWhat it tells you
CountersTotal HTTP requests (split by method, endpoint, and status), completed tasks, and errors
HistogramsHow long requests and tasks take (bucketed: 0.1s, 0.5s, 1s, 5s, 10s, 30s, 60s)
GaugesHow many tasks are running right now, how many requests are in flight
SummariesSize of incoming requests and outgoing responses
Don’t worry if these terms feel fuzzy — Prometheus uses four shapes:
  • Counters only go up (e.g. total requests ever).
  • Histograms bucket values (e.g. how many requests took under 1 second).
  • Gauges go up and down (e.g. active tasks right now).
  • Summaries track sizes or averages over time.

Try it in one line

curl http://localhost:3773/metrics
You’ll see a wall of numbers. That’s the raw data Prometheus reads.

Point Prometheus at your agent

In your prometheus.yml:
scrape_configs:
  - job_name: 'bindu-agent'
    static_configs:
      - targets: ['localhost:3773']
    metrics_path: '/metrics'
Now Prometheus checks on your agent every few seconds.

Useful questions, in PromQL

Once Prometheus has the data, you can ask it things:
# How many requests per second, averaged over 5 minutes?
rate(http_requests_total[5m])

# What's the 95th percentile latency? (95% of requests are faster than this)
histogram_quantile(0.95, rate(http_request_duration_seconds_bucket[5m]))

# How fast are errors happening?
rate(agent_errors_total[5m])

# Average task duration
rate(task_duration_seconds_sum[5m]) / rate(task_duration_seconds_count[5m])

How it fits together

The metrics middleware is placed last in the request pipeline on purpose. That way it sees the complete picture — the full response, its size, everything. The code lives in three small files: one for collecting numbers, one for the middleware, one for the endpoint. Clean and easy to follow.

Do I need to do anything?

No. Metrics are on the moment you upgrade. Visit /metrics to see them. Hook up Prometheus whenever you’re ready.