> ## Documentation Index
> Fetch the complete documentation index at: https://docs.knoxcall.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Analytics Dashboard

> Visualize API performance with real-time charts, latency percentiles, error rates, and traffic patterns. Auto-refresh every 5 seconds.

# Analytics Dashboard

Visualize your API performance with real-time charts, latency percentiles (P50, P95, P99), error rates, and traffic patterns.

## Overview

The **Analytics Dashboard** provides comprehensive metrics visualization for your routes:

* 📊 **Status Code Distribution** - Success vs errors over time
* ⏱️ **Latency Metrics** - P50, P95, P99 response times
* 📈 **API Call Volume** - Request traffic patterns
* 🚨 **Alert Triggers** - Alert activity timeline
* ⏰ **Hourly Distribution** - Traffic by hour of day
* 🗺️ **Geographic Heatmap** - Request origins worldwide

**Auto-refresh:** Dashboard updates every 5 seconds for real-time monitoring.

## Key Metrics

### Status Code Distribution

**What it shows:** Success rate vs client errors (4xx) vs server errors (5xx)

**Chart type:** Stacked area chart

**Example:**

```text theme={"dark"}
10:00 AM: 150 success, 5 client errors, 2 server errors
10:15 AM: 200 success, 8 client errors, 0 server errors
10:30 AM: 180 success, 3 client errors, 1 server error
```

**Use cases:**

* Spot error rate spikes
* Identify problematic time periods
* Correlate errors with deployments

### Latency Percentiles

**What it shows:** Response time distribution

**Percentiles explained:**

* **P50 (Median)**: 50% of requests faster than this
* **P95**: 95% of requests faster than this (typical SLA metric)
* **P99**: 99% of requests faster than this (slowest 1%)

**Example:**

```text theme={"dark"}
Time: 10:30 AM
P50: 120ms (typical user experience)
P95: 450ms (slow but acceptable)
P99: 2100ms (outliers, investigate)
```

**Use cases:**

* Monitor performance degradation
* Set SLA targets (e.g., P95 \< 500ms)
* Identify slow queries or bottlenecks

### API Call Volume

**What it shows:** Total requests over time

**Chart type:** Line chart

**Example:**

```text theme={"dark"}
Peak: 250 requests/min at 2:00 PM
Low: 20 requests/min at 4:00 AM
Average: 120 requests/min
```

**Use cases:**

* Capacity planning
* Identify peak traffic times
* Detect unusual traffic patterns

### Summary Statistics

**Displayed at top:**

* **Total Calls**: Total requests in time range
* **Avg Latency**: Average response time
* **Error Rate**: Percentage of failed requests
* **Alerts Triggered**: Number of alerts fired

## Using the Dashboard

### Step 1: Navigate to Analytics

1. Click **Monitoring** in sidebar
2. Select **Analytics**

### Step 2: Select Time Range

**Quick ranges:**

* Last 1 hour
* Last 6 hours
* Last 24 hours (default)
* Last 7 days
* Last 30 days

**Custom range:**

1. Click **Custom Range**
2. Select start date/time
3. Select end date/time
4. Click **Apply**

### Step 3: Filter by Route (Optional)

**All routes (default):**
Shows aggregated metrics across all routes

**Single route:**

1. Click **Filter** dropdown
2. Select specific route
3. Charts update to show only that route

### Step 4: Enable Auto-Refresh

**Toggle:** Switch at top-right corner

**When enabled:**

* Dashboard refreshes every 5 seconds
* "To" date automatically updates to current time
* See live traffic in real-time

**When disabled:**

* Static snapshot of selected time range
* Useful for analyzing specific incidents

## Advanced Features

### Comparison Mode

**What it does:** Compare current period vs previous period

**Example:**

```text theme={"dark"}
Current: Jan 15-16 (last 24 hours)
Previous: Jan 14-15 (previous 24 hours)

Comparison:
- Total Calls: +15% increase
- Avg Latency: -5ms improvement
- Error Rate: +0.5% increase (investigate!)
```

**Enable:**

1. Toggle **Comparison Mode** switch
2. Charts show both periods overlaid
3. Summary shows percentage changes

**Use cases:**

* Week-over-week performance
* Before/after deployment comparison
* Traffic growth analysis

### Hourly Distribution

**What it shows:** Traffic patterns by hour (0-23)

**Chart type:** Bar chart

**Example:**

```text theme={"dark"}
00:00-01:00: 50 requests (low traffic)
09:00-10:00: 500 requests (morning peak)
14:00-15:00: 800 requests (afternoon peak)
20:00-21:00: 300 requests (evening)
```

**Enable:**

1. Toggle **Show Hourly Distribution**
2. View traffic by hour of day

**Use cases:**

* Identify peak hours for capacity planning
* Schedule maintenance during low traffic
* Detect unusual traffic patterns

### Show Empty Periods

**What it does:** Include time periods with zero requests

**Default:** Empty periods hidden (cleaner charts)

**When enabled:** Shows gaps in traffic

**Use cases:**

* Identify service outages (unexpected gaps)
* Visualize maintenance windows
* Understand traffic continuity

### Geographic Heatmap

**What it shows:** Request origins on world map

**Features:**

* Color intensity = request volume
* Hover to see country/region details
* Click to drill down

**Use cases:**

* Understand user distribution
* Identify geographic issues
* Plan CDN/edge deployments

## Drill-Down Analysis

### Clicking Charts

Click any chart to drill down:

**Status Code Chart:**

* Click bar → See detailed errors for that time period
* View specific error messages
* Jump to logs for investigation

**Latency Chart:**

* Click point → See slow requests
* Identify slow endpoints
* View request details

**API Calls Chart:**

* Click point → See all requests in that period
* Filter by status, route, client
* Export to CSV

### Viewing Raw Data

From drill-down view:

1. See tabular data for selected period
2. Sort by any column
3. Click request to view full details
4. Export filtered data

## Export Options

### Export Analytics Data

**CSV Export:**

1. Select time range
2. Click **Export** button
3. Choose format: CSV
4. Download file

**Included data:**

* Timestamp
* Total calls
* Success count
* Error count
* Average latency
* P50, P95, P99 latency

**Use cases:**

* Import to Excel/Google Sheets
* Create custom reports
* Archive historical data

## Real-Time Monitoring

### Live Dashboard Use Cases

**Deployment monitoring:**

```text theme={"dark"}
1. Deploy new version
2. Open Analytics with auto-refresh enabled
3. Watch error rate and latency in real-time
4. Rollback if metrics degrade
```

**Incident response:**

```text theme={"dark"}
1. Alert fires for high error rate
2. Open Analytics dashboard
3. See error spike on Status Code chart
4. Drill down to view specific errors
5. Jump to logs for details
```

**Load testing:**

```text theme={"dark"}
1. Start load test
2. Monitor API Call Volume chart
3. Watch latency percentiles
4. Identify breaking point
```

## Understanding Latency Percentiles

### Why Percentiles Matter

**Average is misleading:**

```text theme={"dark"}
10 requests:
- 9 requests: 100ms each
- 1 request: 5000ms (timeout)

Average: 590ms (looks bad)
P95: 100ms (actually good for 95% of users)
```

**Use percentiles for accurate picture.**

### Setting SLA Targets

**Recommended targets:**

```text theme={"dark"}
P50 < 200ms   (good user experience)
P95 < 500ms   (acceptable for most users)
P99 < 2000ms  (outliers tolerated)
```

**Monitor P95 for SLAs** - represents typical user experience excluding rare outliers.

### Investigating High Latency

**P99 high but P95 normal:**

* Rare slow queries (database, external API)
* Specific edge cases
* Low priority

**P95 high:**

* Systemic performance issue
* Affects 5% of users
* Investigate immediately

**P50 high:**

* Major performance problem
* Affects majority of users
* Critical issue

## Timezone Support

**User timezone:**
All timestamps displayed in your configured timezone (Settings → Profile).

**Default:** UTC

**Change timezone:**

1. Navigate to Settings → Profile
2. Select timezone dropdown
3. Save
4. Analytics charts update automatically

## Best Practices

### 1. Monitor During Peak Hours

Know your traffic patterns:

```text theme={"dark"}
Peak: 2-4 PM weekdays
Monitor closely: 1:45 PM - 4:15 PM
```

### 2. Set Up Comparison Dashboards

Weekly comparison:

```text theme={"dark"}
Every Monday, compare last 7 days vs previous 7 days
Look for:
- Traffic growth/decline
- Latency trends
- Error rate changes
```

### 3. Use Auto-Refresh for Live Events

**During deployments, load tests, or incidents:**

* Enable auto-refresh
* Keep dashboard visible on second monitor
* Watch for anomalies in real-time

### 4. Combine with Alerts

**Workflow:**

1. Alert fires (e.g., high latency)
2. Open Analytics dashboard
3. Identify trend and scope
4. Drill down to specific requests
5. Jump to logs for investigation

### 5. Export Historical Data

**Monthly:**

1. Export last 30 days analytics
2. Archive CSV files
3. Track long-term trends
4. Compare year-over-year growth

## Troubleshooting

### Issue: "No data displayed"

**Causes:**

* No requests in selected time range
* Route filter excluding all traffic
* Time range in future

**Fix:**

1. Check time range (ensure in past)
2. Clear route filter
3. Expand time range (e.g., last 7 days)

### Issue: "Charts not updating with auto-refresh"

**Causes:**

* Auto-refresh disabled
* Browser tab not active (some browsers pause)
* Network connectivity issue

**Fix:**

1. Verify auto-refresh toggle is ON
2. Keep tab active/visible
3. Refresh page manually

### Issue: "Latency percentiles showing zero"

**Cause:** Not enough requests to calculate percentiles (\< 10 requests)

**Fix:** Wait for more traffic or expand time range

## Related Features

* **API Logs**: Drill down from charts to view raw requests
* **Alerts**: Set up alerts based on metrics thresholds
* **Real-Time Geo**: See live traffic on world map

## Next Steps

<CardGroup cols={2}>
  <Card title="API Logs" icon="list" href="/monitoring/api-logs">
    Detailed request history
  </Card>

  <Card title="Alerts" icon="bell" href="/monitoring/alerts">
    Configure metric alerts
  </Card>

  <Card title="Real-Time Geo" icon="globe" href="/monitoring/realtime-geo">
    Live geographic tracking
  </Card>

  <Card title="Routes" icon="route" href="/getting-started/first-route">
    Manage monitored routes
  </Card>
</CardGroup>

***

<CardGroup cols={2}>
  <Card title="📊 Statistics" icon="chart-line">
    * **Level**: beginner
    * **Time**: 10 minutes
  </Card>

  <Card title="🏷️ Tags" icon="tags">
    `analytics`, `metrics`, `monitoring`, `performance`, `dashboards`
  </Card>
</CardGroup>
