Typesense Monitoring
Overview
This setup provides full monitoring of your Typesense cluster with:
- Prometheus - Metrics collection and storage
- Typesense Exporter - Converts Typesense metrics to Prometheus format
- Grafana - Beautiful dashboards and visualizations
Services Added
1. Prometheus (Port 9090)
- Scrapes metrics from the Typesense exporter every 15 seconds
- Stores time-series data
- Access at: http://localhost:9090
2. Typesense Exporter (Port 8908)
- Exposes Typesense
/metrics.jsonand/stats.jsonas Prometheus metrics - Collects:
- CPU, Memory, Disk usage
- Network activity
- Query statistics
- Indexed documents count
- Search performance metrics
3. Grafana (Port 2290)
- Visualizes Prometheus metrics
- Pre-built dashboards available
- Access at: http://localhost:2290
- Default credentials: admin / admin
Getting Started
1. Start the Services
bash
docker-compose up -dThis will start:
wedissimo-prometheus- Metrics collectionwedissimo-typesense-exporter- Typesense metrics exporterwedissimo-grafana- Visualization dashboard
2. Access Grafana
- Open http://localhost:2290
- Login with: admin / admin
- Change password when prompted
3. Add Prometheus Data Source
- Go to Configuration → Data Sources
- Click Add data source
- Select Prometheus
- Set URL to:
http://wedissimo-prometheus:9090 - Click Save & Test
4. Import Typesense Dashboards
The Typesense exporter includes pre-built Grafana dashboards. To import them:
- Go to Dashboards → Import
- Download dashboards from: https://github.com/akyriako/typesense-prometheus-exporter/tree/main/assets/grafana
- Upload the JSON files or paste their content
- Select Prometheus as the data source
- Click Import
Available Metrics
System Metrics
typesense_metrics_cpu_*- CPU usage per coretypesense_metrics_memory_*- Memory (active, allocated, retained)typesense_metrics_disk_*- Disk usagetypesense_metrics_network_*- Network bytes sent/received
Typesense-Specific Metrics
typesense_stats_total_requests- Total requeststypesense_stats_requests_per_second- Request ratetypesense_stats_latency_*- Query latencytypesense_stats_documents_*- Document counts per collection
Troubleshooting
Prometheus not scraping metrics
bash
# Check Prometheus targets
curl http://localhost:9090/api/v1/targetsExporter not connecting to Typesense
bash
# Check exporter logs
docker-compose logs wedissimo-typesense-exporterGrafana can't connect to Prometheus
- Ensure Prometheus is running:
docker-compose ps - Check data source URL is:
http://wedissimo-prometheus:9090
Ports Reference
| Service | Port | URL |
|---|---|---|
| Prometheus | 9090 | http://localhost:9090 |
| Typesense Exporter | 8908 | http://localhost:8908/metrics |
| Grafana | 3000 | http://localhost:3000 |
| Typesense | 2226 | http://localhost:2226 |
Next Steps
- Create custom dashboards for your specific metrics
- Set up alerts in Grafana for important thresholds
- Monitor query performance and optimize as needed
- Track indexed documents and collection growth