Monitoring Stack
This cookbook sets up a complete monitoring stack for HEBBS using docker-compose, with Prometheus for metrics collection and Grafana for visualization.
docker-compose Setup
Section titled “docker-compose Setup”Create a docker-compose.yml with HEBBS, Prometheus, and Grafana:
version: "3.9"
services: hebbs: image: ghcr.io/hebbs-ai/hebbs:latest ports: - "50051:50051" - "9090:9090" volumes: - hebbs-data:/data environment: - HEBBS_LOG_LEVEL=info restart: unless-stopped healthcheck: test: ["CMD", "hebbs-cli", "status", "--address", "localhost:50051"] interval: 30s timeout: 5s retries: 3
prometheus: image: prom/prometheus:latest ports: - "9091:9090" volumes: - ./prometheus.yml:/etc/prometheus/prometheus.yml:ro - ./alert-rules.yml:/etc/prometheus/alert-rules.yml:ro - prometheus-data:/prometheus command: - "--config.file=/etc/prometheus/prometheus.yml" - "--storage.tsdb.retention.time=30d" depends_on: - hebbs restart: unless-stopped
grafana: image: grafana/grafana:latest ports: - "3000:3000" volumes: - grafana-data:/var/lib/grafana - ./grafana/provisioning:/etc/grafana/provisioning:ro - ./grafana/dashboards:/var/lib/grafana/dashboards:ro environment: - GF_SECURITY_ADMIN_PASSWORD=admin - GF_USERS_ALLOW_SIGN_UP=false depends_on: - prometheus restart: unless-stopped
volumes: hebbs-data: prometheus-data: grafana-data:Prometheus Configuration
Section titled “Prometheus Configuration”Create prometheus.yml:
global: scrape_interval: 15s evaluation_interval: 15s
rule_files: - "alert-rules.yml"
scrape_configs: - job_name: "hebbs" static_configs: - targets: ["hebbs:9090"] scrape_interval: 10sAlert Rules
Section titled “Alert Rules”Create alert-rules.yml:
groups: - name: hebbs-alerts rules: - alert: HebbsDown expr: up{job="hebbs"} == 0 for: 1m labels: severity: critical annotations: summary: "HEBBS server is unreachable"
- alert: HebbsHighRecallLatency expr: histogram_quantile(0.99, rate(hebbs_recall_duration_seconds_bucket[5m])) > 0.01 for: 5m labels: severity: warning annotations: summary: "HEBBS recall p99 > 10ms"
- alert: HebbsHighErrorRate expr: > rate(hebbs_operations_total{status="error"}[5m]) / rate(hebbs_operations_total[5m]) > 0.01 for: 5m labels: severity: critical annotations: summary: "HEBBS error rate > 1%"Grafana Provisioning
Section titled “Grafana Provisioning”Data Source
Section titled “Data Source”Create grafana/provisioning/datasources/prometheus.yml:
apiVersion: 1datasources: - name: Prometheus type: prometheus access: proxy url: http://prometheus:9090 isDefault: trueDashboard
Section titled “Dashboard”Create grafana/provisioning/dashboards/dashboards.yml:
apiVersion: 1providers: - name: "HEBBS" orgId: 1 folder: "HEBBS" type: file options: path: /var/lib/grafana/dashboardsImport the Dashboard
Section titled “Import the Dashboard”- Start the stack:
docker-compose up -d - Open Grafana at
http://localhost:3000(admin/admin) - Navigate to Dashboards > Import
- Upload the HEBBS dashboard JSON from the repository or paste the dashboard ID
Configure Alerts
Section titled “Configure Alerts”In Grafana, set up notification channels:
- Go to Alerting > Contact points
- Add your preferred channel (Slack, PagerDuty, email)
- Create alert rules based on the Prometheus metrics
Verify the Stack
Section titled “Verify the Stack”# Start everythingdocker-compose up -d
# Wait for services to be healthydocker-compose ps
# Store some test datahebbs-cli remember --entity test --content "monitoring stack test memory"hebbs-cli recall --entity test --query "test"
# Check Prometheus targetscurl http://localhost:9091/api/v1/targets | jq '.data.activeTargets[].health'
# Check Grafanaopen http://localhost:3000Key Dashboard Panels
Section titled “Key Dashboard Panels”Once configured, the dashboard shows:
- Operations/sec — throughput across all operation types
- Latency heatmap — request latency distribution over time
- Error rate — percentage of failed operations
- Memory count — total memories stored
- Storage size — RocksDB disk usage
- Active subscriptions — current streaming connections
- Reflection activity — insight generation rate
Teardown
Section titled “Teardown”docker-compose down
# To also remove data volumes:docker-compose down -v