Skip to main content

Metrics

Bindu automatically collects performance metrics to help you monitor agent health and identify issues.

Overview

Metrics provide quantitative measurements of your agent’s behavior:
  • Counters - Total count of events (tasks processed, errors)
  • Histograms - Distribution of values (task duration, response time)
  • Gauges - Current value (active tasks, memory usage)

Automatic Metrics

Task Metrics

MetricTypeDescription
bindu_tasks_totalCounterTotal tasks processed
bindu_task_duration_secondsHistogramTask execution duration
bindu_active_tasksUpDownCounterCurrently active tasks
bindu_task_errors_totalCounterTotal task errors

Context Metrics

MetricTypeDescription
bindu_contexts_totalCounterTotal contexts created
bindu_active_contextsUpDownCounterCurrently active contexts

Agent Metrics

MetricTypeDescription
bindu_agent_execution_timeHistogramAgent execution duration
bindu_agent_calls_totalCounterTotal agent invocations

Metric Attributes

Each metric includes labels for filtering:
  • operation - Operation name (send_message, get_task)
  • agent_name - Agent identifier
  • status - Success or error
  • error_type - Exception class (on error)
Example:
bindu_tasks_total{operation="send_message", agent_name="my-agent", status="success"} 150
bindu_tasks_total{operation="send_message", agent_name="my-agent", status="error"} 5

Viewing Metrics

Prometheus

Configure Prometheus to scrape metrics:
scrape_configs:
  - job_name: 'bindu-agent'
    static_configs:
      - targets: ['localhost:3773']

Grafana Dashboard

Create dashboards to visualize:
  • Task throughput over time
  • Error rates
  • P50/P95/P99 latencies
  • Active task count

Custom Metrics

Add custom metrics in your agent:
from opentelemetry import metrics

meter = metrics.get_meter(__name__)

# Counter
llm_calls = meter.create_counter(
    "llm_calls_total",
    description="Total LLM API calls"
)

# Histogram
llm_latency = meter.create_histogram(
    "llm_latency_seconds",
    description="LLM API latency"
)

# Usage
llm_calls.add(1, {"model": "gpt-4"})
llm_latency.record(1.5, {"model": "gpt-4"})

Next Steps