This guide walks you through setting up comprehensive monitoring for qtap using Prometheus for metrics collection and Grafana for visualization. By the end, you'll have dashboards showing request rates, error rates, latency percentiles, and traffic patterns.
CRITICAL FIRST STEP: Qtap requires the http_metrics plugin to expose HTTP-level Prometheus metrics. Without this plugin, you'll only see connection-level metrics.
Update Your Qtap Configuration
Edit your qtap configuration file to include the http_metrics plugin:
Restart Qtap
After adding the plugin, restart qtap:
Step 1: Verify Metrics Are Available
First, confirm qtap is exposing HTTP metrics:
You should see Prometheus-formatted metrics:
If you don't see qtap_http_requests_total, the http_metrics plugin is not configured. Go back to Step 0.
If metrics exist but show zero, generate test traffic:
Step 2: Deploy Prometheus
Already have Prometheus running? Skip the deployment sections below and jump to adding the qtap scrape configuration to your existing prometheus.yml.
Option A: Docker Compose
Create prometheus.yml:
Create docker-compose.yml:
Start the stack:
Option B: Kubernetes with ServiceMonitor
If using Prometheus Operator, create a ServiceMonitor:
Apply it:
Option C: Kubernetes with Pod Annotations
For standard Prometheus server, add annotations to your qtap DaemonSet:
Add Qtap Scrape Config to Existing Prometheus
If you already have Prometheus running, add these scrape configs to your existing prometheus.yml:
For Kubernetes with Prometheus Operator: If you already have Prometheus Operator installed, just apply the ServiceMonitor from Option B above - no need to modify Prometheus config files.
Reload Prometheus configuration:
Step 3: Verify Prometheus Is Scraping
Open Prometheus UI at http://localhost:9090 and check:
Status → Targets: Verify qtap and qtap-system jobs are "UP"
Run a query: Try qtap_http_requests_total in the query box
If targets show as DOWN:
Step 4: Import Grafana Dashboard
Already have Grafana running? Great! Skip ahead to Add Prometheus Data Source and use your existing Grafana instance.
Access Grafana
Navigate to http://localhost:3000 and log in:
Username: admin
Password: admin (or value from GF_SECURITY_ADMIN_PASSWORD)
Add Prometheus Data Source
Already have Prometheus configured as a data source? You can skip this section and go straight to Import Qtap Dashboard.
Click Upload JSON file and select the downloaded file
Select your Prometheus data source
Click Import
The official Grafana dashboard may need label adjustments. Qtap v0 uses host labels, not domain. If panels are empty, edit queries to replace domain with host.
# HELP qtap_http_requests_total Total HTTP requests observed
# TYPE qtap_http_requests_total counter
qtap_http_requests_total{host="httpbin.org",method="GET",protocol="http2",status_code="200"} 5
# Generate test traffic
curl https://httpbin.org/get
# Check metrics again (wait 5 seconds for metrics to update)
sleep 5
curl http://localhost:10001/metrics | grep qtap_http_requests_total
# Average end-to-end transaction time (combined request+response)
rate(qtap_http_duration_ms_sum[5m])
/
rate(qtap_http_duration_ms_count[5m])
# 95th percentile overall latency
histogram_quantile(0.95,
rate(qtap_http_duration_ms_bucket[5m])
)
# Total active connections
sum(qtap_connection_active_total)
# Active connections by destination
topk(10, qtap_connection_active_total)
# TLS handshake rate (HTTPS connection establishment)
sum(rate(qtap_connection_tls_handshake_total[5m]))
# Connections by TLS version
sum by (version) (rate(qtap_connection_tls_handshake_total[5m]))