Download OpenAPI specification:
CacheFly exposes CDN metrics through a Prometheus-compatible API. This allows you to query your CDN performance data using PromQL — the same query language used by Prometheus — and visualize it in tools like Grafana.
With this integration you can monitor edge and origin traffic, track cache hit ratios, detect origin errors, and set up alerts — all using standard Prometheus tooling you may already have in place.
All API queries require a CacheFly API token passed via the Authorization header.
# Basic auth (username is ignored)
curl -u prometheus:YOUR_TOKEN 'https://api.cachefly.com/api/2.6/prometheus/api/v1/query?query=...'
# Bearer auth
curl -H "Authorization: Bearer YOUR_TOKEN" 'https://api.cachefly.com/api/2.6/prometheus/api/v1/query?query=...'
| Metric | Type | Unit | Description |
|---|---|---|---|
cachefly_edge_requests |
Gauge | count | Requests served by the CDN at the edge |
cachefly_edge_bytes |
Gauge | bytes | Data volume served by the CDN at the edge |
cachefly_origin_requests |
Gauge | count | Requests made from CDN to origin |
cachefly_origin_bytes |
Gauge | bytes | Data retrieved from origins |
cachefly_origin_ttfb_avg_seconds |
Gauge | seconds | Average time to first byte |
cachefly_origin_ttfb_max_seconds |
Gauge | seconds | Highest time to first byte |
cachefly_origin_ttfb_min_seconds |
Gauge | seconds | Lowest time to first byte |
These metrics represent traffic served by CacheFly's CDN at the edge (closest to end users).
| Label | Type | Description | Example Values |
|---|---|---|---|
suid |
UInt32 | Service ID | 42648, 43085 |
hit |
String | Whether the response was served from cache | true, false |
pop |
String | Point of presence (datacenter location) | AMS, LAX, FRA, SIN |
cachefly_edge_requestsType: Gauge Description: Number of requests served by the CDN at the edge.
This is the primary metric for understanding request volume hitting your CDN distribution. Each data point represents the number of requests in a given time bucket, broken down by service, cache status, and POP.
# Total edge requests
cachefly_edge_requests
# Requests for a specific service
cachefly_edge_requests{suid="43085"}
# Cache hits only
cachefly_edge_requests{hit="true"}
# Cache misses only
cachefly_edge_requests{hit="false"}
# Requests by POP
sum by (pop) (cachefly_edge_requests)
# Total requests across all labels
sum(cachefly_edge_requests)
hit="true" vs hit="false" to measure cache effectiveness.# Overall cache hit ratio (0 to 1)
sum(cachefly_edge_requests{hit="true"}) / sum(cachefly_edge_requests)
# Cache hit ratio per service
sum by (suid) (cachefly_edge_requests{hit="true"}) / sum by (suid) (cachefly_edge_requests)
# Cache hit ratio per POP
sum by (pop) (cachefly_edge_requests{hit="true"}) / sum by (pop) (cachefly_edge_requests)
cachefly_edge_bytesType: Gauge Unit: bytes Description: Volume of data served by the CDN at the edge.
Tracks bandwidth consumption at the edge. Each data point represents the number of bytes transferred in a given time bucket.
# Total edge bandwidth
cachefly_edge_bytes
# Bandwidth for a specific service
cachefly_edge_bytes{suid="43085"}
# Bandwidth served from cache vs origin
sum by (hit) (cachefly_edge_bytes)
# Bandwidth by POP
sum by (pop) (cachefly_edge_bytes)
# Total bandwidth in GB (divide by 1e9)
sum(cachefly_edge_bytes) / 1e9
# Bytes saved by cache (served from cache instead of origin)
sum(cachefly_edge_bytes{hit="true"})
# Cache bandwidth ratio
sum(cachefly_edge_bytes{hit="true"}) / sum(cachefly_edge_bytes)
# Bandwidth per POP in MB
sum by (pop) (cachefly_edge_bytes) / 1e6
These metrics represent traffic between CacheFly's CDN and your origin server(s). High origin traffic generally means more cache misses.
| Label | Type | Description | Example Values |
|---|---|---|---|
suid |
UInt32 | Service ID | 42648, 43085 |
status |
UInt32 | HTTP response status code | 200, 301, 404, 502, 503 |
Supported status codes: 101, 200, 201, 301, 302, 304, 400, 401, 403, 404, 405, 421, 500, 501, 502, 503, 504
cachefly_origin_requestsType: Gauge Description: Number of requests made from CDN to origin.
Tracks how many requests the CDN forwards to your origin server. A high number of origin requests relative to edge requests indicates poor cache hit rates.
# All origin requests
cachefly_origin_requests
# Origin requests by HTTP status
sum by (status) (cachefly_origin_requests)
# Only successful origin requests
cachefly_origin_requests{status="200"}
# Origin errors (5xx)
sum(cachefly_origin_requests{status=~"5.."})
# Origin client errors (4xx)
sum(cachefly_origin_requests{status=~"4.."})
# Origin 502 Bad Gateway errors
cachefly_origin_requests{status="502"}
# Origin requests for a specific service
cachefly_origin_requests{suid="42978"}
# Origin error rate (5xx / total)
sum(cachefly_origin_requests{status=~"5.."}) / sum(cachefly_origin_requests)
# Origin error rate per service
sum by (suid) (cachefly_origin_requests{status=~"5.."}) / sum by (suid) (cachefly_origin_requests)
# Breakdown of error types
sum by (status) (cachefly_origin_requests{status=~"[45].."})
cachefly_origin_bytesType: Gauge Unit: bytes Description: Volume of data retrieved into the CDN from all origins.
Tracks how much data the CDN pulls from your origin servers.
# Total origin bandwidth
cachefly_origin_bytes
# Origin bandwidth by service
sum by (suid) (cachefly_origin_bytes)
# Origin bandwidth by HTTP status
sum by (status) (cachefly_origin_bytes)
# Origin bandwidth for successful requests in GB
sum(cachefly_origin_bytes{status="200"}) / 1e9
# Cache byte ratio (proportion of edge bytes served from cache)
sum(cachefly_edge_bytes{hit="true"}) / sum(cachefly_edge_bytes)
cachefly_origin_ttfb_avg_secondsType: Gauge Unit: seconds Description: Average time to first byte (TTFB) for requests made to the origin.
Measures the average time between the CDN sending a request to origin and receiving the first byte of the response. This is a key indicator of origin performance.
# Average TTFB across all origins
cachefly_origin_ttfb_avg_seconds
# Average TTFB by service
cachefly_origin_ttfb_avg_seconds{suid="42978"}
# Average TTFB by HTTP status
avg by (status) (cachefly_origin_ttfb_avg_seconds)
# Average TTFB for successful requests only
cachefly_origin_ttfb_avg_seconds{status="200"}
cachefly_origin_ttfb_max_secondsType: Gauge Unit: seconds Description: Highest time to first byte (TTFB) for requests made to the origin.
Captures the worst-case TTFB within each time bucket. Useful for identifying tail latency and outlier slow responses.
# Worst-case TTFB
cachefly_origin_ttfb_max_seconds
# Max TTFB by service
max by (suid) (cachefly_origin_ttfb_max_seconds)
# Max TTFB for 200 responses
cachefly_origin_ttfb_max_seconds{status="200"}
# Services with max TTFB over 1 second
cachefly_origin_ttfb_max_seconds > 1
cachefly_origin_ttfb_min_secondsType: Gauge Unit: seconds Description: Smallest time to first byte (TTFB) for requests made to the origin.
Captures the best-case TTFB within each time bucket. Useful as a baseline for what your origin is capable of.
# Best-case TTFB
cachefly_origin_ttfb_min_seconds
# Min TTFB by service
min by (suid) (cachefly_origin_ttfb_min_seconds)
# Compare min vs max TTFB to see variance
cachefly_origin_ttfb_max_seconds - cachefly_origin_ttfb_min_seconds
# Cache hit ratio
sum(cachefly_edge_requests{hit="true"}) / sum(cachefly_edge_requests)
# Origin error rate
sum(cachefly_origin_requests{status=~"5.."}) / sum(cachefly_origin_requests)
# Average origin TTFB
avg(cachefly_origin_ttfb_avg_seconds{status="200"})
# Total edge throughput in Gbps (assuming 5-minute intervals)
sum(cachefly_edge_bytes) * 8 / 1e9
# Edge requests per service
sum by (suid) (cachefly_edge_requests)
# Origin requests per service
sum by (suid) (cachefly_origin_requests)
# Cache hit ratio per service
sum by (suid) (cachefly_edge_requests{hit="true"}) / sum by (suid) (cachefly_edge_requests)
# Origin TTFB per service
avg by (suid) (cachefly_origin_ttfb_avg_seconds)
# Alert: cache hit ratio drops below 80%
sum(cachefly_edge_requests{hit="true"}) / sum(cachefly_edge_requests) < 0.8
# Alert: origin 5xx error rate exceeds 5%
sum(cachefly_origin_requests{status=~"5.."}) / sum(cachefly_origin_requests) > 0.05
# Alert: origin TTFB exceeds 2 seconds
cachefly_origin_ttfb_avg_seconds > 2
# Alert: max TTFB spike above 10 seconds
cachefly_origin_ttfb_max_seconds > 10
To add CacheFly as a Prometheus data source in Grafana:
Open Grafana and navigate to Data Sources.
Click Add data source and select Prometheus.
In the Connection section, set the URL:
https://api.cachefly.com/api/2.6/prometheus/
In the Authentication section:
Authentication Mode: Basic authentication
Username: prometheus
Password: <your-cachefly-api-token>
You can generate a new API token in the CacheFly Portal.
Optionally, under Advanced settings:
Manage alerts via Alerting UI: false
Scrape interval: 15s
Query timeout: 180s
Prometheus type: Prometheus
HTTP method: POST
Notes:
Basic and Bearer auth formats are supported. Basic is recommended for Grafana.| Endpoint | Method | Description |
|---|---|---|
/api/v1/query |
GET/POST | Instant query at a single point in time |
/api/v1/query_range |
GET/POST | Range query over a time window |
/api/v1/labels |
GET/POST | List all available label names |
/api/v1/label/<name>/values |
GET | List values for a specific label |
/api/v1/metadata |
GET | List all metric metadata |
/-/healthy |
GET | Health check |
/-/ready |
GET | Readiness probe |
| Parameter | Description | Example |
|---|---|---|
query |
PromQL expression | cachefly_edge_requests{hit="true"} |
start |
Start timestamp (RFC3339 or unix) | 2026-03-18T00:00:00Z |
end |
End timestamp (RFC3339 or unix) | 2026-03-18T01:00:00Z |
step |
Query resolution step | 5m, 1h, 30s |