Skip to main content

Domain Metrics

The Metric Exporter feature is designed to simplify collecting and analyzing domain data, and it helps you quickly and efficiently gain useful insight into your domain's performance, behavior, and errors. This tool automatically processes your logs and generates various metrics that you can use to build charts and reports in tools such as Grafana, Prometheus, and Splunk. The data is sent in Plain Text format.

Domain metrics work differently from log forwarding. Because of their large volume, logs need more storage space, while metrics are structured and lighter. In addition, logs are mostly used for troubleshooting and analyzing event details, while metrics are suitable for monitoring, alerting, and analyzing patterns and trends.

Exported Metrics​

With domain metrics, you can receive the Upstream Error Metrics, DNS Metrics, HTTP Access Metrics, and Event Metrics of your domains.

Access Metrics​

Access MetricsDescriptionTypeLabel
http_top_requests_ip_count10 IPs with the most requestsCounterhostname: host name

ip: user IP
http_top_requests_server_code_count10 Server Codes with the most requestsCounterhostname: host name

server_code: CDN server number
http_top_requests_asn_count10 ASNs with the most requestsCounterhostname: host name

asn: the ASN number from which the request was sent to the origin server
http_requests_totalTotal number of requestsCounterhostname: host name

method: HTTP method of the request

upstream_addr: origin server IP *

status: HTTP status code received from the CDN
http_bytes_sent_totalTotal number of bytes sent in HTTP responsesCounterhostname: host name

method: HTTP method of the request
http_bytes_received_totalTotal number of bytes received in HTTP requestsCounterhostname: host name

method: HTTP method of the request
http_cache_hit_totalTotal number of requests by cache statusGaugehostname: host name

cache: cache status, which can be Hit, Miss, Bypass, or Updating
http_server_port_usage_totalNumber of times server ports are usedGaugehostname: host name

server_port: the origin server port that requests reach
http_request_latest_upstream_time_totalProcessing time of the latest request from upstream (milliseconds)Gaugehostname: host name
http_top_requests_country_totalNumber of requests by countryCounterhostname: host name

country: name of the country from which the request reached the origin server
unique_visitors_totalNumber of unique visitorsGaugehostname: host name

visitor: number of unique visitors (this number counts unique combinations of IP and User Agent and may differ slightly from the actual number of unique visitors)
http_response_time_aggregated_millisecondsAggregated response time of origin serversHistogramhostname: host name

le: aggregated response time of upstream servers as a histogram based on different buckets (10, 100, 200, ...)

* The value of this metric is the last IP the request was sent to. Because of the try_next_upstream parameter in your domain settings, the request may also have been sent to other servers.

DNS Metrics​

DNS MetricsDescriptionTypeLabel
dns_record_popularity_countRequest rate by record typeCounterhostname: host name

type: DNS record type, such as A, AAAA, etc.
dns_response_code_countNumber of DNS status codesCounterhostname: host name

response_code: DNS status codes
dns_top_query_by_asn_count10 ASNs with the most queries (resets in each time interval)Counterhostname: host name

asn: the ASN number from which the request was sent
dns_query_count_by_country_countTotal DNS requests by countryCounterhostname: host name

country: name of the country from which the request was sent
dns_query_count_by_record_countTotal DNS requests by record typeCounterhostname: host name

record: DNS record type, such as A, AAAA, etc.

Upstream Error Metrics​

Upstream Error MetricsDescriptionTypeLabel
per_pop_site_error_countNumber of errors per CDN PoP siteCounterhostname: host name

pop: CDN PoP site name
per_upstream_top_address_error_countNumber of errors per upstreamCounterhostname: host name

upstream_ip: IP of the origin server the error was received from
per_origin_top_error_countNumber of errors per originCounterhostname: host name

origin: name of the origin the error was received from
per_uri_top_error_count10 URIs with the most errors (resets in each time interval)Counterhostname: host name

uri: path the error was received from

Event Metrics​

Event MetricsDescriptionTypeLabel
top_request_tlsfingerprint_count10 JA3 Fingerprints with the most HTTP requestsCounterhostname: host name

tls_figerprint: the fingerprint value sent from the user to the origin server
rate_limit_top_rule_matched_countNumber of requests matched with Rate Limit rulesCounterhostname: host name

rlimit_matched: ID of the matched Rate Limit rule
rate_limit_action_countNumber of Rate Limit actions applied to requestsCounterhostname: host name

rlimit_action: Rate Limit action type, such as Block, Allow, Challenge, Ignore
firewall_top_rule_matched_countNumber of requests matched with firewall rulesCounterhostname: host name

firewall_matched: ID of the matched firewall rule
firewall_action_countNumber of firewall actions applied to requestsCounterhostname: host name

firewall_action: firewall action type, such as Allow, Bypass, Deny, and Challenge
pagerule_top_matched_countNumber of requests matched with page rulesCounterhostname: host name

pagerule_matched: ID of the matched page rule
ddos_challenge_decision_countNumber of final decisions of DDoS challengesCounterhostname: host name

ddos_challenge_decision: decision type, such as Ignored, Passed, Issued, Preflight
end_to_end_response_time_milliseconds_bucketAggregated end-to-end response timeHistogramhostname: host name

le: aggregated end-to-end response time (upstream to user) as a histogram based on different buckets (10, 100, 200, ...)

Managing Domain Metrics in the Panel​

In the Arvancloud panel, go to CDN and select Domain Metrics.

Click New Monitoring.

On this page, select the domain whose metrics you want to receive, the log type, and the collection interval, then click Save.

From then on, you can enable or disable your monitorings, edit and manage them, or delete them.

Managing Domain Metrics via API​

To work with the domain metrics APIs, see the API documentation for this feature. Before using the API, you need to create an access key in the panel. To do this, create and get an access key, and then create an access policy with at least the CDN Viewer level.

Store the access key you receive in this step in a safe place.

Create a Domain Metric via API​

To create a domain metric via API, you can use the following sample request:

curl --location 'https://napi.arvancloud.ir/cdn/4.0/domains/[domain]/metric-exporters' \
--header 'Content-Type: application/json' \
--header 'Authorization:[apikey]' \
--data '{"name": "hello", "type": "access", "interval": "10s", "status": true }'

Note that you need to replace [domain] and [apikey] with your domain name and your API key in the format apikey xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.

Get the List of Domain Metric Monitorings​

To get the list of domain metric monitorings via API, you can use the following sample request:

curl --location 'https://napi.arvancloud.ir/cdn/4.0/metric-exporters' \
--header 'Authorization:[apikey]'

Note that you need to replace [apikey] with your API key in the format apikey xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.

The response to this request looks like this:

"data": [
{
"id": "[metricExporterId]",
"domain": "arvancloud.ir",
"type": "access|dns|error|event",
"name": "string",
"url": "https://napi.arvancloud.ir/cdn-metrics/v1/metrics/arvancloud.ir/id/[endPointId]",
"interval": "10s",
"status": true
}
]

Show a Domain Metric​

To get the details of a domain metric via API, you can use the following sample request:

curl \
--location 'https://napi.arvancloud.ir/cdn/4.0/domains/[domain]/metric-exporters/[metricExporterId]' \
--header 'Authorization:[apikey]'

Note that you need to replace [domain] and [apikey] with your domain name and API key. Use the API key in the format apikey xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx. You can take the [metricExporterId] parameter from the id field in the output of the domain metric monitorings list.

The response to this request looks like this:

"data": {
"id": "[metricExporterId]",
"domain": "arvancloud.ir",
"type": "event",
"name": "string1",
"url": "https://napi.arvancloud.ir/cdn-metrics/v1/metrics/arvancloud.ir/id/[endPointId]",
"interval": "10s",
"status": true
},
"message": ""

You can get the metric values from the endpoint returned in url (usable in Prometheus). For example:

curl \
--location 'https://napi.arvancloud.ir/cdn-metrics/v1/metrics/arvancloud.ir/id/[endPointId]' \
--header 'Authorization:[apikey]'

Note that you need to replace [apikey] with your API key in the format apikey xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.

The response to this request looks like this:

# HELP http_bytes_received_total Total number of bytes received in HTTP requests.
# TYPE http_bytes_received_total counter
http_bytes_received_total{hostname="voyd.ir",method="get"} 88587
# HELP http_bytes_sent_total Total number of bytes sent in HTTP responses.
# TYPE http_bytes_sent_total counter
http_bytes_sent_total{hostname="voyd.ir",method="get"} 476612
# HELP http_cache_hit_total Total number of requests per cache type.
# TYPE http_cache_hit_total gauge
http_cache_hit_total{cache="bypass",hostname="voyd.ir"} 26
http_cache_hit_total{cache="hit",hostname="voyd.ir"} 22
http_cache_hit_total{cache="miss",hostname="voyd.ir"} 1
# HELP http_request_latest_upstream_time_total Time to process the latest request from upstream in milliseconds
# TYPE http_request_latest_upstream_time_total gauge
http_request_latest_upstream_time_total{hostname="voyd.ir"} 28
# HELP http_requests_total Total number of HTTP requests processed
# TYPE http_requests_total counter
http_requests_total{hostname="voyd.ir",method="get",status="200",upstream_addr="188.121.111.32"} 4
http_requests_total{hostname="voyd.ir",method="get",status="304",upstream_addr="188.121.111.32"} 23
# HELP http_response_time_aggregated_count Count of http_response_time
# TYPE http_response_time_aggregated_count gauge
http_response_time_aggregated_count{hostname="voyd.ir"} 27
# HELP http_response_time_aggregated_milliseconds Aggregated metrics for http_response_time
# TYPE http_response_time_aggregated_milliseconds gauge
http_response_time_aggregated_milliseconds{hostname="voyd.ir",le="+Inf"} 27
http_response_time_aggregated_milliseconds{hostname="voyd.ir",le="10"} 0
http_response_time_aggregated_milliseconds{hostname="voyd.ir",le="100"} 27
http_response_time_aggregated_milliseconds{hostname="voyd.ir",le="1000"} 27
http_response_time_aggregated_milliseconds{hostname="voyd.ir",le="10000"} 27
http_response_time_aggregated_milliseconds{hostname="voyd.ir",le="200"} 27
http_response_time_aggregated_milliseconds{hostname="voyd.ir",le="2000"} 27
http_response_time_aggregated_milliseconds{hostname="voyd.ir",le="50"} 27
http_response_time_aggregated_milliseconds{hostname="voyd.ir",le="500"} 27
http_response_time_aggregated_milliseconds{hostname="voyd.ir",le="5000"} 27
http_response_time_aggregated_milliseconds{hostname="voyd.ir",le="700"} 27
http_response_time_aggregated_milliseconds{hostname="voyd.ir",le="7000"} 27
# HELP http_response_time_aggregated_sum Sum of http_response_time
# TYPE http_response_time_aggregated_sum gauge
http_response_time_aggregated_sum{hostname="voyd.ir"} 659
# HELP http_server_port_usage_total Usage of different server ports.
# TYPE http_server_port_usage_total gauge
http_server_port_usage_total{hostname="voyd.ir",server_port="443"} 98
http_server_port_usage_total{hostname="voyd.ir",server_port="80"} 2
# HELP http_top_requests_asn_count Top(10) ASNs with highest requests (resets on each fetch)
# TYPE http_top_requests_asn_count counter
http_top_requests_asn_count{asn="14061",hostname="voyd.ir"} 6
# HELP http_top_requests_country_total Top(10) number of requests per country (resets on each fetch)
# TYPE http_top_requests_country_total counter
http_top_requests_country_total{country="de",hostname="voyd.ir"} 6
# HELP http_top_requests_ip_count Top(10) HTTP request IPs (resets on each fetch)
# TYPE http_top_requests_ip_count counter
http_top_requests_ip_count{hostname="voyd.ir",ip="164.92.190.159"} 6
# HELP http_top_requests_server_code_count Top(10) PoP sites with highest requests (resets on each fetch)
# TYPE http_top_requests_server_code_count counter
http_top_requests_server_code_count{hostname="voyd.ir",server_code="6120"} 6
# HELP unique_visitors_total Number of unique visitors
# TYPE unique_visitors_total gauge
unique_visitors_total{hostname="voyd.ir"} 3

To get all metrics of a domain, simply remove the id part from the URL. For example:

curl \
--location 'https://napi.arvancloud.ir/cdn-metrics/v1/metrics/' \
--header 'Authorization:[apikey]'

Note that you need to replace [apikey] with your API key in the format apikey xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.

Edit a Domain Metric​

To edit a domain metric via API, you can use the following sample request:

curl --location --request PUT 'https://napi.arvancloud.ir/cdn/4.0/domains/[domain]/metric-exporters/[metricExporterId]' \
--header 'Authorization:[apikey]' \
--header 'Content-Type: application/json' \
--data '{"name": "hello", "type": "access", "interval": "10s", "status": true}'

Note that you need to replace [domain] and [apikey] with your domain name and API key. Use the API key in the format apikey xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx. You can take the [metricExporterId] parameter from the id field in the output of the domain metric monitorings list.

Delete a Domain Metric​

To delete a domain metric via API, you can use the following sample request:

curl --location --request DELETE 'https://napi.arvancloud.ir/cdn/4.0/domains/[domain]/metric-exporters/[metricExporterId]' \
--header 'Authorization:[apikey]'

Note that you need to replace [domain] and [apikey] with your domain name and API key. Use the API key in the format apikey xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx. You can take the [metricExporterId] parameter from the id field in the output of the domain metric monitorings list.

Ready-Made Domain Metrics Dashboard​

The ready-made domain metrics dashboard lets you review your system's performance and status at the domain level comprehensively and in real time. With this dashboard, you can view metric values graphically and identify and fix potential problems faster.

To use this ready-made dashboard, visit the following link:

https://git.arvancloud.ir/arvancloud/cdn/monitoring-template