Skip to main content
BuildBuddy exposes Prometheus metrics that allow monitoring the four golden signals: latency, traffic, errors, and saturation.

Overview

On-prem BuildBuddy deployments expose detailed operational metrics for:
  • Server health and performance
  • Request rates and latency
  • Cache performance
  • Remote execution metrics
  • Database and storage metrics
  • Resource utilization

Endpoint

Prometheus metrics are exposed under the path:
Default configuration:
  • Port: 9090
  • Path: /metrics/
  • Format: Prometheus text format

Configuration

BuildBuddy Server

Metrics are enabled by default. You can customize the port:

Prometheus Scrape Config

Add BuildBuddy to your Prometheus scrape configuration:

Multiple Instances

For multiple BuildBuddy servers:

Kubernetes Service Discovery

For Kubernetes deployments:

Visualization with Grafana

To view these metrics in a live-updating dashboard, we recommend using Grafana.

Setup

  1. Install Grafana:
  2. Add Prometheus data source:
    • Navigate to Configuration > Data Sources
    • Click “Add data source”
    • Select Prometheus
    • Enter Prometheus URL (e.g., http://prometheus:9090)
    • Click “Save & Test”
  3. Import BuildBuddy dashboard:
    • Go to Dashboards > Import
    • Upload BuildBuddy dashboard JSON (if available)
    • Or create custom dashboard

Example Dashboard Panels

Request Rate:
Request Latency (p95):
Cache Hit Rate:
Active Executors:

Metric Categories

HTTP/gRPC Metrics

  • Request count by method and status
  • Request duration histograms
  • Request size histograms
  • Response size histograms
  • Concurrent requests

Cache Metrics

  • Cache hits and misses
  • Cache read/write bytes
  • Cache evictions
  • Cache size and utilization
  • Digest computation time

Remote Execution Metrics

  • Executors connected
  • Tasks queued, running, completed
  • Task duration histograms
  • Executor utilization
  • Upload/download bytes

Build Event Metrics

  • Build events received
  • Event processing duration
  • Events by type
  • Stream errors

Database Metrics

  • Query duration
  • Connection pool stats
  • Transaction counts
  • Slow queries

Storage Metrics

  • Bytes read/written
  • Object count
  • Storage errors
  • Backend latency

System Metrics

  • CPU usage
  • Memory usage
  • Goroutines
  • File descriptors
  • GC pause times

Alerting

Example Alert Rules

Create alert rules in Prometheus:

Alertmanager Integration

Configure Alertmanager for notifications:

Performance Monitoring

Key Metrics to Monitor

Latency:
  • API request duration (p50, p95, p99)
  • Cache read/write latency
  • Database query duration
  • Remote execution task duration
Traffic:
  • Requests per second
  • Bytes transferred (cache, storage)
  • Build events per second
  • Active executors
Errors:
  • HTTP/gRPC error rates
  • Cache errors
  • Storage errors
  • Execution failures
Saturation:
  • CPU utilization
  • Memory usage
  • Disk usage
  • Connection pool utilization
  • Executor queue depth

Capacity Planning

Resource Utilization Queries

CPU Usage:
Memory Usage:
Disk Usage:
Connection Pool:

Troubleshooting

Metrics not available

  1. Verify BuildBuddy is running:
  2. Check metrics endpoint:
  3. Verify Prometheus can reach BuildBuddy:
    • Check firewall rules
    • Test network connectivity
  4. Check Prometheus logs:

High cardinality

If metrics cause performance issues:
  1. Reduce scrape frequency
  2. Use recording rules for expensive queries
  3. Drop high-cardinality labels
  4. Increase Prometheus resources

Best Practices

  1. Set up dashboards early: Establish baselines before issues occur
  2. Configure alerts: Be proactive about performance degradation
  3. Monitor trends: Look for gradual changes over time
  4. Document incidents: Note when alerts fire and resolution steps
  5. Regular review: Periodically review and update alert thresholds
For a complete list of available metrics with descriptions, build the BuildBuddy source:
This generates comprehensive metric documentation at bazel-bin/server/metrics/generate_docs/docs.mdx