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

# View CDN statistics in Grafana

> Grafana panels for CDN traffic, cache efficiency, and request statistics.

CDN delivery traffic, cache efficiency, and request counts can be shown as Grafana time-series panels. The [Grafana plugin](/developer-tools/grafana/install-the-grafana-plugin) adds the **Gcore Platform-EN** data source.

> [!WARNING]
>
> The previous CDN-only plugin ([cdn-stats](https://github.com/G-Core/cdn-stats-datasource-plugin)) is deprecated. Migrate existing dashboards to **Gcore Platform-EN**.

## Configure a dashboard

The panel uses the connected **Gcore Platform-EN** data source.

1. In the top bar, click **+**, then **New dashboard**.

![Plus menu open on New dashboard](https://mintcdn.com/gcore/3dKkAGq74iM-CXJF/images/docs/cdn/grafana/view-cdn-statistics-in-grafana/new-dashboard-menu.png?fit=max\&auto=format\&n=3dKkAGq74iM-CXJF\&q=85\&s=97dcf4d9fba060c61db0ff60d91aef30)

2. The **Add** drawer opens on the right. Click **Panel**.

![Add drawer with the Panel control](https://mintcdn.com/gcore/3dKkAGq74iM-CXJF/images/docs/cdn/grafana/view-cdn-statistics-in-grafana/add-panel.png?fit=max\&auto=format\&n=3dKkAGq74iM-CXJF\&q=85\&s=49a9f90c722218cb0f76474a9f64e1e7)

3. Click **Edit visualization**.

4. Under **Data source**, select **Gcore Platform-EN**.

5. Under **Edge Network**, set **Service** to **CDN**.

6. Under **Query Props**, set **Metric**, **Granularity**, and **Group By**. Filters under **Filters (comma separated)** are optional.

7. Click **Save**. In **Save dashboard**, enter a title and click **Save**.

The saved dashboard shows the title and the panel.

![Saved dashboard with the Total Requests panel](https://mintcdn.com/gcore/3dKkAGq74iM-CXJF/images/docs/cdn/grafana/view-cdn-statistics-in-grafana/saved-dashboard.png?fit=max\&auto=format\&n=3dKkAGq74iM-CXJF\&q=85\&s=f4c9ea4aef49827f34f0f587b321c689)

## Query fields

CDN queries cover delivery traffic, cache efficiency, and request or response trends. The metric values match the CDN statistics API. An [alert rule](/developer-tools/grafana/create-an-alert-rule) on one of these queries changes state when a value crosses a threshold.

**Metrics**

| Menu label | Metric | Description |
| - | - | - |
| **Bandwidth** | `bandwidth` | Maximum transfer rate during the selected time, in bytes per second |
| **Total Traffic** | `total_bytes` | Total traffic volume: origin to CDN or [Shielding](/cdn/cdn-resource-options/general/enable-and-configure-origin-shielding), Shielding to CDN, and CDN to users |
| **Origin Traffic** | `upstream_bytes` | Origin traffic: origin to CDN or origin to Shielding |
| **Edges Traffic** | `sent_bytes` | Edges traffic: Shielding to CDN plus CDN to users |
| **Shield Traffic** | `shield_bytes` | Traffic from Shielding to CDN |
| **Total Requests** | `requests` | Number of requests to the CDN |
| **2xx Responses** | `responses_2xx` | Response count for the 2xx status class |
| **3xx Responses** | `responses_3xx` | Response count for the 3xx status class |
| **4xx Responses** | `responses_4xx` | Response count for the 4xx status class |
| **5xx Responses** | `responses_5xx` | Response count for the 5xx status class |
| **Image optimization** | `image_processed` | Number of processed images |
| **Cache Hit Ratio** | `cache_hit_requests_ratio` | Share of responses served from cache |
| **Byte Cache Hit Ratio** | `cache_hit_traffic_ratio` | Share of cached traffic: `1 - (origin or Shielding traffic / CDN-to-user traffic)` |
| **Shield Traffic Ratio** | `shield_traffic_ratio` | Shielding efficiency: `(Shielding-to-CDN traffic - origin-to-Shielding traffic) / Shielding-to-CDN traffic` |

**Granularity:** `5m`, `15m`, `1h`, or `1d`.

**Group By:** **Resource**, **Client**, **Vhost** (custom domain), **Region**, **Country**, or **Datacenter**. More than one value can be selected. The query sends `resource`, `client`, `vhost`, `region`, `country`, or `dc`.

**Filters (comma separated):** optional **Vhosts**, **Resources**, **Clients**, **Regions**, and **Countries** fields narrow the series. Separate several values with commas.

**Legend Format:** the default legend includes the metric name and the group-by values. A custom template uses placeholders in double curly braces that match the grouping: `Traffic ({{resource}})`.

**Total Requests**, granularity **5m**, and **Group By** set to **Resource** produce one series per CDN resource:

![CDN requests grouped by resource](https://mintcdn.com/gcore/3dKkAGq74iM-CXJF/images/docs/cdn/grafana/view-cdn-statistics-in-grafana/cdn-requests-by-resource.png?fit=max\&auto=format\&n=3dKkAGq74iM-CXJF\&q=85\&s=5ee37f393b7a1c086f3403dd92ffa2d3)

## Dashboard variables

Dashboard variables can drive CDN filters so the same panel switches between resources, clients, or other dimensions without editing the query.

1. On the dashboard, click **Add variable**, then **Query**.

2. Set **Name** to the name used in the filter. `resource` matches the **Resources** filter.

3. Under **Query options**, click **Open variable editor**. Select **Gcore Platform-EN**, then set **Values for** to **resourceID**, **vhost**, **client**, **country**, or **region**.

4. **Sort**, **Multi-value**, and **Include All value** are optional.

5. Click **Apply**. In the matching CDN filter, enter the variable with a `$` prefix. `$resource` goes in **Resources**.

6. Save the dashboard.
