Select the types of activity you want to include in your feed.
QuickDID is a high-performance AT Protocol identity resolution service written in Rust. It provides handle-to-DID resolution with Redis-backed caching and queue processing.
···11+-- Test script to verify all metrics queries work correctly
22+-- Run this after sending test metrics with send-metrics.sh
33+44+\echo '===== CHECKING AVAILABLE TABLES ====='
55+SELECT table_name
66+FROM information_schema.tables
77+WHERE table_schema = 'public'
88+ AND table_name LIKE 'quickdid%'
99+ORDER BY table_name;
1010+1111+\echo ''
1212+\echo '===== CHECKING TABLE STRUCTURES ====='
1313+\echo 'Structure of quickdid.http.request.count table:'
1414+\d "quickdid.http.request.count"
1515+1616+\echo ''
1717+\echo 'Structure of quickdid.http.request.duration_ms table:'
1818+\d "quickdid.http.request.duration_ms"
1919+2020+\echo ''
2121+\echo '===== QUERY 1: Recent HTTP Request Counts ====='
2222+SELECT
2323+ time,
2424+ tags,
2525+ tags->>'method' as method,
2626+ tags->>'path' as path,
2727+ tags->>'status' as status,
2828+ value
2929+FROM "quickdid.http.request.count"
3030+WHERE time > NOW() - INTERVAL '1 hour'
3131+ORDER BY time DESC
3232+LIMIT 10;
3333+3434+\echo ''
3535+\echo '===== QUERY 2: HTTP Request Duration Statistics by Endpoint ====='
3636+SELECT
3737+ time_bucket('1 minute', time) AS minute,
3838+ tags->>'method' as method,
3939+ tags->>'path' as path,
4040+ tags->>'status' as status,
4141+ COUNT(*) as request_count,
4242+ AVG(mean) as avg_duration_ms,
4343+ MAX(p99) as p99_duration_ms,
4444+ MIN(mean) as min_duration_ms
4545+FROM "quickdid.http.request.duration_ms"
4646+WHERE time > NOW() - INTERVAL '1 hour'
4747+ AND tags IS NOT NULL
4848+GROUP BY minute, tags->>'method', tags->>'path', tags->>'status'
4949+ORDER BY minute DESC
5050+LIMIT 10;
5151+5252+\echo ''
5353+\echo '===== QUERY 3: Rate Limiter Status Over Time ====='
5454+SELECT
5555+ time,
5656+ value as available_permits
5757+FROM "quickdid.resolver.rate_limit.available_permits"
5858+WHERE time > NOW() - INTERVAL '1 hour'
5959+ORDER BY time DESC
6060+LIMIT 10;
6161+6262+\echo ''
6363+\echo '===== QUERY 4: Resolver Performance Comparison ====='
6464+SELECT
6565+ tags->>'resolver' as resolver_type,
6666+ COUNT(*) as sample_count,
6767+ AVG(mean) as avg_resolution_time_ms,
6868+ MAX(p99) as p99_resolution_time_ms,
6969+ MIN(mean) as min_resolution_time_ms
7070+FROM "quickdid.resolver.resolution_time"
7171+WHERE time > NOW() - INTERVAL '1 hour'
7272+ AND tags->>'resolver' IS NOT NULL
7373+GROUP BY tags->>'resolver'
7474+ORDER BY avg_resolution_time_ms;
7575+7676+\echo ''
7777+\echo '===== QUERY 5: Cache Hit Rate Analysis ====='
7878+WITH cache_stats AS (
7979+ SELECT
8080+ 'hits' as metric_type,
8181+ SUM(value) as total_count
8282+ FROM "quickdid.cache.hit.count"
8383+ WHERE time > NOW() - INTERVAL '1 hour'
8484+ UNION ALL
8585+ SELECT
8686+ 'misses' as metric_type,
8787+ SUM(value) as total_count
8888+ FROM "quickdid.cache.miss.count"
8989+ WHERE time > NOW() - INTERVAL '1 hour'
9090+)
9191+SELECT
9292+ SUM(CASE WHEN metric_type = 'hits' THEN total_count ELSE 0 END) as total_hits,
9393+ SUM(CASE WHEN metric_type = 'misses' THEN total_count ELSE 0 END) as total_misses,
9494+ CASE
9595+ WHEN SUM(total_count) > 0 THEN
9696+ ROUND(100.0 * SUM(CASE WHEN metric_type = 'hits' THEN total_count ELSE 0 END) / SUM(total_count), 2)
9797+ ELSE 0
9898+ END as hit_rate_percentage
9999+FROM cache_stats;
100100+101101+\echo ''
102102+\echo '===== QUERY 6: Hypertable Information ====='
103103+SELECT
104104+ hypertable_schema,
105105+ hypertable_name,
106106+ owner,
107107+ num_dimensions,
108108+ num_chunks,
109109+ compression_enabled
110110+FROM timescaledb_information.hypertables
111111+WHERE hypertable_name LIKE 'quickdid%'
112112+ORDER BY hypertable_name;
113113+114114+\echo ''
115115+\echo '===== QUERY 7: HTTP Error Rate by Endpoint ====='
116116+WITH status_counts AS (
117117+ SELECT
118118+ time_bucket('5 minutes', time) as period,
119119+ tags->>'path' as path,
120120+ CASE
121121+ WHEN (tags->>'status')::int >= 400 THEN 'error'
122122+ ELSE 'success'
123123+ END as status_category,
124124+ SUM(value) as request_count
125125+ FROM "quickdid.http.request.count"
126126+ WHERE time > NOW() - INTERVAL '1 hour'
127127+ GROUP BY period, path, status_category
128128+)
129129+SELECT
130130+ period,
131131+ path,
132132+ SUM(CASE WHEN status_category = 'error' THEN request_count ELSE 0 END) as error_count,
133133+ SUM(CASE WHEN status_category = 'success' THEN request_count ELSE 0 END) as success_count,
134134+ CASE
135135+ WHEN SUM(request_count) > 0 THEN
136136+ ROUND(100.0 * SUM(CASE WHEN status_category = 'error' THEN request_count ELSE 0 END) / SUM(request_count), 2)
137137+ ELSE 0
138138+ END as error_rate_percentage
139139+FROM status_counts
140140+GROUP BY period, path
141141+HAVING SUM(request_count) > 0
142142+ORDER BY period DESC, error_rate_percentage DESC;
143143+144144+\echo ''
145145+\echo '===== TEST COMPLETED ====='