AdRecon’s production monitoring spans Vercel serverless functions, Supabase database metrics, and custom rate limiting logs.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/MatthewSabia1/AdRecon/llms.txt
Use this file to discover all available pages before exploring further.
Monitoring Stack
Vercel Logs
Function execution logs, deployment history, and edge network metrics
Supabase Metrics
Query performance, connection pools, RLS policy hits, and storage usage
Admin Dashboard
Real-time user stats, saved ads, projects, and feed health
Rate Limit Logs
Page Ripper usage tracking via
page_rip_log tableVercel Monitoring
Function Logs
Access real-time serverless function logs in the Vercel dashboard:Filter by Function
Use the function filter to isolate specific endpoints:
/api/download-page— Page Ripper captures/api/admin/users— Admin user management/api/ad-media— Media proxy requests/api/admin/scrape— Admin scraping operations/api/landing-ripper/webhook— Webhook events
Key Metrics
Vercel provides these critical metrics per function:- Invocation count: Total requests per time window
- Error rate: Percentage of failed invocations
- Duration (p50, p95, p99): Response time percentiles
- Memory usage: Peak RAM consumption
- Timeout rate: Functions exceeding max duration
The
/api/download-page function has a 120-second timeout (configured in vercel.json:8). Monitor timeout rates — values above 5% indicate sites with heavy lazy-loading or slow networks.Function Timeout Configuration
These functions have extended timeouts due to expensive operations:vercel.json
Monitor these functions closely — hitting the max duration triggers a 504 Gateway Timeout and burns execution time budget.
Supabase Monitoring
Database Metrics
Access Supabase metrics in the project dashboard:Monitor Query Performance
Track slow queries:
- Top slow queries: Queries exceeding 100ms
- Most frequent queries: High-traffic feed lookups
- Index usage: Verify indexes are hit for
ads_feed_v2scans
Critical Tables to Monitor
RLS Policy Performance
Row-Level Security (RLS) policies can impact query performance. Monitor policy hit rates:- Index Scan (good) vs Seq Scan (bad)
- Rows Removed by Filter — high values indicate missing indexes
If
user_saved_ads queries show sequential scans, verify the user_id column has an index.Admin Dashboard Stats
The admin dashboard (/admin or /app/admin) provides real-time operational metrics.
Available Metrics
Accessed viaGET /api/admin/users, the admin API returns:
Admin Stats Response
These stats are cached for 60 seconds (see
api/admin/users.js:21) to reduce database load during repeated admin dashboard views.Metric Definitions
- totalUsers: All registered accounts (confirmed + unconfirmed)
- adminUsers: Users with
app_metadata.user_type = 'admin' - recentlyActiveUsers7d: Users with
last_sign_in_atwithin 7 days - confirmedUsers: Users with
email_confirmed_atset - savedAds: Total rows in
user_saved_adstable - projects: Total rows in
user_projectstable - indexedAds: Total rows in
ads_feed_v2view
Cache Invalidation
The admin API caches two datasets:- Admin promotes/demotes a user (
PATCH /api/admin/users) - Admin deletes a user (
DELETE /api/admin/users)
Page Ripper Rate Limiting
The Page Ripper feature includes per-user rate limiting to prevent abuse.Rate Limit Configuration
Defined inapi/download-page.js:52-53:
Monitoring Rate Limits
Query recent activity:page_rip_log Analysis
The rate limiter fails open — if the
page_rip_log table is missing or queries error, requests proceed without rate limiting (see api/download-page.js:249).Rate Limit Response
When a user exceeds the limit, the API returns:429 Too Many Requests
Retry-After: 900(15 minutes in seconds)
Historical Analysis
Track Page Ripper usage trends:Historical Rip Activity
Error Tracking Patterns
Common Error Signatures
Logging Best Practices
All serverless functions follow this pattern:- Context prefix:
[function-name]for easy log filtering - Stack traces: Automatically captured by Vercel
- User-facing message: Sanitized error returned in JSON response
Alerts and Thresholds
Recommended monitoring alerts:Vercel Pro and Enterprise plans support custom alerting via integrations with Datadog, New Relic, and other APM tools.
Performance Baselines
Normal operating ranges:/api/ad-media(p95): < 200ms/api/admin/users(p95): < 500ms (uncached), < 50ms (cached)/api/download-page(p50): 15-30 secondsads_feed_v2query (p95): < 300msuser_saved_adsinsert: < 50ms
Baseline times assume healthy Supabase instance. If p95 query times exceed 1 second, investigate missing indexes or RLS policy overhead.