---
title: "Metrics and analytics"
description: "Monitor DNS query volume, latency, response codes and geographic distribution across your Edge DNS zones, in the console or via the API."
url: "https://edge.network/docs/dns/metrics"
section: "DNS"
---

# Metrics and analytics

Edge DNS provides detailed metrics on query volume, response times and traffic patterns to help you understand how your domains are being used.

![DNS metrics with query volume and record type breakdown](/media/docs/control-dns-metrics.svg)

## Available metrics

- **Query count:** total number of DNS queries received for your zone, broken down by time period.
- **Latency:** average and maximum response times in microseconds. Typical resolution is under 10ms.
- **Query types:** breakdown by record type (A, AAAA, MX, TXT, etc.) to understand query patterns.
- **Response codes:** distribution of response types, such as `NOERROR`, `NXDOMAIN` and `REFUSED`.
- **Geographic distribution:** query volume by country, based on resolver location (GeoIP).
- **Node distribution:** which Edge nodes handled your queries, showing traffic distribution.

## Time ranges

View metrics at different granularities depending on your analysis needs:

| Range | Granularity | Data points |
|---|---|---|
| Last hour | 1 minute | ~60 points |
| Last 24 hours | 1 minute | ~1,440 points |
| Last 7 days | 1 hour | ~168 points |
| Last 30 days | 1 day | ~30 points |

## Data retention

Metrics are automatically aggregated and pruned to optimise storage while keeping useful historical data:

| Granularity | Data | Retention |
|---|---|---|
| `1m` | Minute-level data | 24 hours |
| `1h` | Hourly aggregates | 7 days |
| `1d` | Daily aggregates | 90 days |

## Viewing metrics

1. **Navigate to your zone.** Go to **DNS** and select your domain.
2. **Click the Metrics tab.** View charts and statistics for your zone.
3. **Select a time range.** Choose 1h, 24h, 7d or 30d to adjust the view.

## API access

Fetch metrics programmatically for custom dashboards or monitoring.

### Get zone metrics

```http
GET /api/dns/zones/:id/metrics?range=24h
```

Response:

```json
{
  "metrics": {
    "zone": "example.com",
    "from": "2024-01-14T00:00:00Z",
    "to": "2024-01-15T00:00:00Z",
    "granularity": "1m",
    "data": [
      {
        "timestamp": "2024-01-14T00:00:00Z",
        "queryCount": 1234,
        "byType": { "A": 800, "AAAA": 300, "MX": 134 },
        "byResponse": { "NoError": 1200, "NXDomain": 34 },
        "byCountry": { "US": 500, "GB": 300, "DE": 200 },
        "latencyAvgUs": 2500,
        "latencyMaxUs": 15000
      }
    ]
  }
}
```

### Get account-wide DNS stats

```http
GET /api/dns/stats
```

Response:

```json
{
  "stats": {
    "totalQueries": 1234567,
    "avgLatencyMs": 8,
    "zoneCount": 5,
    "recordCount": 47
  }
}
```

## Common use cases

- **Traffic monitoring:** track query volume over time to understand traffic patterns and identify unexpected spikes that might indicate issues or attacks.
- **Performance analysis:** monitor latency metrics to ensure DNS resolution stays fast. Investigate whether max latency spikes occur during high-traffic periods.
- **Error detection:** watch the response code distribution. High `NXDOMAIN` rates might indicate misconfigurations or broken links pointing to non-existent subdomains.
- **Geographic insights:** see where your users are located based on query origins. Useful for planning geo routing or understanding your audience.

## Next steps

- [Zone management](/docs/dns/zones) — Create and configure zones
- [Geographic routing](/docs/dns/geo-routing) — Route traffic by location
