Stats — 错误
文档Stats — 错误

Stats — 错误

套餐通过的近期错误事件(4xx、5xx、超时)— 按主机与代码分类。

GET /packages/{id}/stats/errors

返回上游提供商为该套餐记录的近期错误事件。便于发现被屏蔽的目的地、失效会话或上游网络问题。

GET/api/v1/packages/{id}/stats/errors?period=7d&limit=50&offset=0

查询参数

ParameterDefaultOptions
period7d7d · 30d · 90d · 1y · day · week · month · 3months · 6months · year
limit501–500
offset0≥0 — for pagination

Each entry carries the upstream provider’s reason string in the error field (a label such as NO_HOST_CONNECTION, not an HTTP status code), the destinationhost and port, the datetime bucket, and how many times it occurred (count).

response.json
{
  "data": {
    "package_id": 12,
    "period":     "7d",
    "limit":      50,
    "offset":     0,
    "errors": [
      { "datetime": "2026-05-29 11:41:00 UTC", "error": "NO_HOST_CONNECTION", "host": "ipinfo.io",   "port": 443, "count": 2 },
      { "datetime": "2026-05-29 11:40:00 UTC", "error": "NO_HOST_CONNECTION", "host": "example.com", "port": 443, "count": 1 }
    ]
  },
  "meta": { "version": "v1" }
}

Field names are passed through verbatim from the upstream provider, so additional keys may appear. Always key on error and host rather than assuming a fixed set.

代码示例

errors.sh
curl "https://raxyproxy.com/api/v1/packages/12/stats/errors?period=24h&limit=100" \
     -H "Authorization: Bearer raxy_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
errors.py
import requests
from collections import Counter

r = requests.get(
    'https://raxyproxy.com/api/v1/packages/12/stats/errors',
    headers={'Authorization': 'Bearer raxy_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'},
    params={'period': '7d', 'limit': 500},
).json()

# Aggregate counts by host to find the most problematic destinations
by_host = Counter()
for e in r['data']['errors']:
    by_host[e['host']] += e.get('count', 0)

for host, n in by_host.most_common(10):
    print(f"{host:30}  {n} failures")