Overview
Amp provides comprehensive observability through OpenTelemetry, exporting metrics and traces to compatible backends. The built-in telemetry stack includes support for Prometheus metrics and distributed tracing.OpenTelemetry Configuration
Configure OpenTelemetry in the[opentelemetry] section:
Configuration Fields
Remote OpenTelemetry metrics collector endpoint (binary HTTP protocol).The endpoint should accept OTLP metrics in binary format over HTTP.Environment variable override:
Interval in seconds between metric exports to the collector.Lower values provide fresher metrics but increase network traffic.
Remote OpenTelemetry traces collector endpoint (HTTP protocol).The endpoint should accept OTLP traces over HTTP.Environment variable override:
Ratio of traces to sample (0.0 to 1.0).
1.0: Sample all traces (100%)0.1: Sample 10% of traces0.01: Sample 1% of traces
Local Development with Grafana
For local development and testing, Amp provides a pre-configured Grafana telemetry stack using Docker Compose.Starting the Stack
Start the Grafana OTEL stack:grafana/otel-lgtm image, which includes:
- Grafana: Visualization and dashboards (port 3000)
- OpenTelemetry Collector: Receives metrics and traces
- Prometheus: Stores metrics
- Tempo: Stores traces
Connecting Amp to Grafana Stack
Configure Amp to send telemetry to the local Grafana stack:- 4317: gRPC endpoint (for
trace_urlin this setup) - 4318: HTTP endpoint (for
metrics_url)
docker-compose.yaml exposes these ports (default configuration does).
Accessing Grafana
Open Grafana in your browser:- Username:
admin - Password:
admin(you’ll be prompted to change it)
Metrics
Amp exports comprehensive metrics for monitoring:Server Metrics
- Query execution: Query count, duration, errors
- Streaming: Active streams, microbatch size/duration
- HTTP metrics: Request count, duration, status codes (via OpenTelemetry instrumentation)
Worker Metrics
- Extraction: Rows ingested, blocks processed, extraction duration
- File operations: Files written, bytes written
- Compaction: Files compacted, compaction success/failures
- Garbage collection: Files deleted, expired files, collection success/failures
Extractor Metrics
- EVM RPC: RPC requests, errors, duration
- Firehose: Blocks received, stream errors, connection status
Traces
Distributed traces help debug query execution and extraction flows:Trace Coverage
- Query execution: Full query lifecycle from request to response
- Extraction jobs: Block fetching, parsing, writing
- File operations: Parquet writes, compaction, garbage collection
- RPC calls: External provider requests
Viewing Traces in Grafana
- Navigate to Explore in Grafana
- Select Tempo as the data source
- Search by:
- Trace ID: Direct trace lookup
- Service name: Filter by component (e.g.,
amp-server,amp-worker) - Operation: Filter by operation type
- Duration: Find slow traces
Custom Dashboards
Amp includes pre-configured Grafana dashboards in thegrafana/dashboards/ directory.
Loading Custom Dashboards
- Navigate to:
http://localhost:3000/dashboards/import - Upload the dashboard JSON file or paste its contents
- Select Prometheus as the data source
- Click Import
Creating New Dashboards
- Create a dashboard in Grafana UI
- Click Share → Export → Save to file
- Save the JSON file to
grafana/dashboards/in the repository - The dashboard will be automatically loaded on next
docker-compose up
Available Pre-Configured Dashboards
Check thegrafana/dashboards/ directory in the source repository for:
- Worker Overview: Extraction metrics, job status, throughput
- Server Overview: Query performance, active streams, error rates
- Storage Overview: File counts, bytes written, compaction status
Production Deployments
Using Grafana Cloud
Configure Amp to send telemetry to Grafana Cloud:Using Custom OpenTelemetry Collector
Deploy your own OpenTelemetry Collector:Sampling Configuration for Production
Reduce trace volume in production:- High traffic: 0.01 (1%) or lower
- Medium traffic: 0.1 (10%)
- Low traffic / debugging: 1.0 (100%)
Security Considerations
Best practices:- Use HTTPS endpoints for remote collectors
- Implement authentication at the collector level
- Restrict network access to telemetry endpoints
- Avoid sending sensitive data in trace attributes
- Use collector-side filtering for PII
Alerting
Set up alerts in Grafana for:Critical Alerts
- Extraction failures: Worker job failures
- Database connection failures: Metadata database unavailable
- High error rates: Query errors above threshold
- Compaction failures: Failed compaction jobs
Warning Alerts
- High query latency: P95 latency above threshold
- Storage growth: Rapid increase in bytes written
- File count growth: Too many small files (compaction needed)
- Memory usage: High memory usage on server or workers
Example Alert Rules
Disabling Telemetry
To disable telemetry, simply omit the[opentelemetry] section from your config file or leave the URLs empty:
Troubleshooting
Metrics Not Appearing
- Check configuration: Verify
metrics_urlis correct - Check collector logs: Ensure collector is receiving metrics
- Check network: Verify connectivity from Amp to collector
- Check interval: Metrics export every
metrics_export_interval_secs
Traces Not Appearing
- Check configuration: Verify
trace_urlis correct - Check sampling: Ensure
trace_ratiois > 0 - Check collector: Verify collector is configured for traces
- Generate traffic: Some traces may not appear until traffic flows
High Memory Usage
If telemetry causes high memory usage:- Reduce
trace_ratioto sample fewer traces - Increase
metrics_export_interval_secsto export less frequently - Check collector backpressure and buffering
Next Steps
Metrics Reference
Complete list of available metrics
Configuration Overview
Back to configuration overview