跳到正文

错误追踪

捕获错误与异常并按问题分组、检索与解决——Sentry 风格的错误监控。

1. 概览

基础路径: https://api.infrai.cc/v1/errors
鉴权头: Authorization: Bearer $INFRAI_API_KEY
bash
# Call any /v1/errors capability over raw HTTP — no SDK to install.
# curl:
curl https://api.infrai.cc/v1/errors/... \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json"

2. 方法 (9)

2.1errors.capture

POST /v1/errors/capture

捕获应用错误,可选标签。

参数

名称类型必填说明
messagestring
必填
可读的错误消息。
codestring可选可选的应用错误码。
stackstring可选可选的堆栈跟踪。
tagsRecord<string, string>可选用于分组的键/值标签。

返回

{ ok, error_id }
名称类型说明
event_idstringevent的唯一标识符
pattern: ^evt_err_[A-Za-z0-9]{20,}$
fingerprintstring用于分组的 sha256 十六进制哈希。
error_group_idstring此事件所属的错误分组标识符
pattern: ^errgrp_[A-Za-z0-9]{20,}$
is_new_groupboolean本次捕获是否创建了新的错误分组
dashboard_urlstring在控制台中查看此资源的 URL
format: uri

示例

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at https://infrai.cc/login (Google/GitHub gives
# you $2 free credit; email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT, add
# funds at https://infrai.cc/billing (or POST /v1/account/topup and open the
# returned checkout_url).
export INFRAI_API_KEY="ifr_..."
bash
curl -X POST https://api.infrai.cc/v1/errors/capture \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'

2.2errors.message

POST /v1/errors/message

上报一条结构化错误或日志消息

参数

名称类型必填说明
textstring
必填
消息正文
≥ 1 chars
level"debug" | "info" | "warning" | "error" | "fatal"可选级别:debug/info/warning/error/fatal
default: "info"
tagsRecord<string, string>可选键值标签,便于过滤与分组
user_idstring可选关联的用户 ID
releasestring可选发布版本标识
environment"production" | "staging" | "development" | null可选环境:production/staging/development
idempotency_keystring可选幂等键,用于避免重复写入

返回

CaptureResult
名称类型说明
event_idstringevent的唯一标识符
pattern: ^evt_err_[A-Za-z0-9]{20,}$
fingerprintstring用于分组的 sha256 十六进制哈希。
error_group_idstring此事件所属的错误分组标识符
pattern: ^errgrp_[A-Za-z0-9]{20,}$
is_new_groupboolean本次捕获是否创建了新的错误分组
dashboard_urlstring在控制台中查看此资源的 URL
format: uri

示例

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at https://infrai.cc/login (Google/GitHub gives
# you $2 free credit; email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT, add
# funds at https://infrai.cc/billing (or POST /v1/account/topup and open the
# returned checkout_url).
export INFRAI_API_KEY="ifr_..."
bash
curl -X POST https://api.infrai.cc/v1/errors/message \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text": "hello"}'

2.3errors.list

GET /v1/errors/list

分页列出捕获到的错误事件

参数

名称类型必填说明
filterRecord<string, unknown>可选过滤条件(观测过滤 DSL)
cursorstring可选分页游标
limitnumber可选每页返回数量

返回

ErrorEventList
名称类型说明
itemsobject[]本页结果条目数组
items[].event_idstringevent的唯一标识符
pattern: ^evt_err_[A-Za-z0-9]{20,}$
items[].fingerprintstring用于分组的 sha256 十六进制指纹。
items[].error_group_idstring此事件所属的错误分组标识符
pattern: ^errgrp_[A-Za-z0-9]{20,}$
items[].timestampstring数据点的 Unix 时间戳
format: date-time
items[].level"debug" | "info" | "warning" | "error" | "fatal"严重级别或日志等级(如 info、warn、error)
items[].titlestring简短标题或摘要
items[].messagestring | null详细消息内容
items[].environmentstring | null部署环境(如 production、staging)
items[].releasestring | null软件发布版本
items[].user_idstring | null与此资源关联的用户标识符
items[].tagsobject | null分类与筛选标签
items[].is_resolvedboolean此错误或分组是否被标记为已解决
items[].is_ignoredboolean此错误或分组是否被标记为已忽略
items[].dashboard_urlstring在仪表盘中查看此资源的 URL
format: uri
next_cursorstring | null获取下一页的不透明游标;null 或不存在表示最后一页
totalinteger跨所有页的总条目数
≥ 0

示例

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at https://infrai.cc/login (Google/GitHub gives
# you $2 free credit; email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT, add
# funds at https://infrai.cc/billing (or POST /v1/account/topup and open the
# returned checkout_url).
export INFRAI_API_KEY="ifr_..."
bash
curl -X GET https://api.infrai.cc/v1/errors/list \
  -H "Authorization: Bearer $INFRAI_API_KEY"

2.4errors.search

GET /v1/errors/search

按关键词搜索错误事件

参数

名称类型必填说明
qstring
必填
搜索关键词
filterRecord<string, unknown>可选过滤条件(观测过滤 DSL)
cursorstring可选分页游标
limitnumber可选每页返回数量

返回

ErrorEventList
名称类型说明
itemsobject[]本页结果条目数组
items[].event_idstringevent的唯一标识符
pattern: ^evt_err_[A-Za-z0-9]{20,}$
items[].fingerprintstring用于分组的 sha256 十六进制指纹。
items[].error_group_idstring此事件所属的错误分组标识符
pattern: ^errgrp_[A-Za-z0-9]{20,}$
items[].timestampstring数据点的 Unix 时间戳
format: date-time
items[].level"debug" | "info" | "warning" | "error" | "fatal"严重级别或日志等级(如 info、warn、error)
items[].titlestring简短标题或摘要
items[].messagestring | null详细消息内容
items[].environmentstring | null部署环境(如 production、staging)
items[].releasestring | null软件发布版本
items[].user_idstring | null与此资源关联的用户标识符
items[].tagsobject | null分类与筛选标签
items[].is_resolvedboolean此错误或分组是否被标记为已解决
items[].is_ignoredboolean此错误或分组是否被标记为已忽略
items[].dashboard_urlstring在仪表盘中查看此资源的 URL
format: uri
next_cursorstring | null获取下一页的不透明游标;null 或不存在表示最后一页
totalinteger跨所有页的总条目数
≥ 0

示例

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at https://infrai.cc/login (Google/GitHub gives
# you $2 free credit; email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT, add
# funds at https://infrai.cc/billing (or POST /v1/account/topup and open the
# returned checkout_url).
export INFRAI_API_KEY="ifr_..."
bash
curl -X GET https://api.infrai.cc/v1/errors/search \
  -H "Authorization: Bearer $INFRAI_API_KEY"

2.5errors.get

GET /v1/errors/get/{event_id}

按事件 ID 获取错误事件详情

参数

名称类型必填说明
event_idstring
必填
错误事件 ID

返回

ErrorEvent
名称类型说明
event_idstringevent的唯一标识符
pattern: ^evt_err_[A-Za-z0-9]{20,}$
fingerprintstring用于错误分组的指纹哈希
pattern: ^[a-f0-9]{64}$
error_group_idstring此事件所属的错误分组标识符
timestampstring数据点的 Unix 时间戳
format: date-time
level"debug" | "info" | "warning" | "error" | "fatal"严重级别或日志等级(如 info、warn、error)
titlestring简短标题或摘要
messagestring | null详细消息内容
environment"production" | "staging" | "development" | null部署环境(如 production、staging)
releasestring | null软件发布版本
user_idstring | null关联此资源的用户标识
tagsobject分类与筛选标签
is_resolvedboolean该错误或分组是否已标记为已解决
default: false
is_ignoredboolean该错误或分组是否已标记为已忽略
default: false
exceptionobject | null异常详情,包括类型和堆栈跟踪
breadcrumbsobject[]breadcrumb events leading up to the error列表
contextobject错误的附加上下文数据
extraobject附加在错误事件上的额外元数据
idempotency_keystring | nullerrors.capture 的去重键(路由幂等:true)。

示例

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at https://infrai.cc/login (Google/GitHub gives
# you $2 free credit; email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT, add
# funds at https://infrai.cc/billing (or POST /v1/account/topup and open the
# returned checkout_url).
export INFRAI_API_KEY="ifr_..."
bash
curl -X GET https://api.infrai.cc/v1/errors/get/EVENT_ID \
  -H "Authorization: Bearer $INFRAI_API_KEY"

2.6errors.groups

GET /v1/errors/groups

分页列出错误分组

参数

名称类型必填说明
status'unresolved' | 'resolved' | 'ignored'可选按状态过滤:unresolved/resolved/ignored
sort'count_desc' | 'last_seen_desc' | 'first_seen_desc'可选排序方式:count_desc/last_seen_desc/first_seen_desc
cursorstring可选分页游标
limitnumber可选每页返回数量

返回

ErrorGroupList
名称类型说明
groupsobject[]error group objects列表
groups[].error_group_idstring此事件所属的错误分组标识符
pattern: ^errgrp_[A-Za-z0-9]{20,}$
groups[].fingerprintstring用于错误分组的指纹哈希
groups[].titlestring简短标题或摘要
groups[].first_seen_atstring首次观测到的 ISO 8601 时间戳
format: date-time
groups[].last_seen_atstring最近观测到的 ISO 8601 时间戳
format: date-time
groups[].countinteger所有页的条目总数
≥ 1
groups[].user_countintegerunique users affected数量
≥ 0
groups[].level"debug" | "info" | "warning" | "error" | "fatal"严重级别或日志等级(如 info、warn、error)
groups[].is_resolvedboolean此错误或分组是否被标记为已解决
groups[].is_ignoredboolean此错误或分组是否被标记为已忽略
groups[].assigned_tostring | null分配调查此错误分组的用户
groups[].sample_event_idstring此错误分组中的样本事件 ID
pattern: ^evt_err_[A-Za-z0-9]{20,}$
groups[].environmentsstring[] | nullenvironments where this error has been seen列表
groups[].releasesstring[] | nullsoftware releases where this error has been seen列表
groups[].trend_24hobject | null包含 current、previous 和 change_pct 的对象。
groups[].sparklineinteger[] | null用于迷你图的 24 个小时桶事件计数。
groups[].dashboard_urlstring在仪表盘中查看此资源的 URL
format: uri
next_cursorstring | null下一页不透明游标;null 表示结束。
totalinteger跨所有页的总条目数
≥ 0

示例

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at https://infrai.cc/login (Google/GitHub gives
# you $2 free credit; email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT, add
# funds at https://infrai.cc/billing (or POST /v1/account/topup and open the
# returned checkout_url).
export INFRAI_API_KEY="ifr_..."
bash
curl -X GET https://api.infrai.cc/v1/errors/groups \
  -H "Authorization: Bearer $INFRAI_API_KEY"

2.7errors.group_detail

GET /v1/errors/group_detail/{error_group_id}

获取错误分组的聚合详情

参数

名称类型必填说明
error_group_idstring
必填
错误分组 ID

返回

ErrorGroupDetail
名称类型说明
error_group_idstring此事件所属的错误分组标识符
pattern: ^errgrp_[A-Za-z0-9]{20,}$
fingerprintstring用于错误分组的指纹哈希
titlestring简短标题或摘要
first_seen_atstringISO 8601 时间戳:this was first observed(ISO 8601)
format: date-time
last_seen_atstringISO 8601 时间戳:this was last observed(ISO 8601)
format: date-time
countinteger跨所有页的总条目数
≥ 1
user_countintegerunique users affected数量
≥ 0
levelstring严重级别或日志等级(如 info、warn、error)
is_resolvedboolean该错误或分组是否已标记为已解决
is_ignoredboolean该错误或分组是否已标记为已忽略
assigned_tostring | null分配调查此错误分组的用户
sample_event_idstring此错误分组中的样本事件 ID
environmentsstring[] | nullenvironments where this error has been seen列表
releasesstring[] | nullsoftware releases where this error has been seen列表
trend_24hobject | null此错误分组的 24 小时趋势数据
sparklineinteger[] | null用于错误频率可视化的迷你图数据点
dashboard_urlstring在控制台中查看此资源的 URL
format: uri
representative_eventobject此分组的代表性错误事件
representative_event.event_idstringevent的唯一标识符
pattern: ^evt_err_[A-Za-z0-9]{20,}$
representative_event.fingerprintstring用于错误分组的指纹哈希
representative_event.error_group_idstring此事件所属的错误分组标识符
pattern: ^errgrp_[A-Za-z0-9]{20,}$
representative_event.timestampstring数据点的 Unix 时间戳
format: date-time
representative_event.level"debug" | "info" | "warning" | "error" | "fatal"严重级别或日志等级(如 info、warn、error)
representative_event.titlestring简短标题或摘要
representative_event.messagestring | null详细消息内容
representative_event.environmentstring | null部署环境(如 production、staging)
representative_event.releasestring | null软件发布版本
representative_event.user_idstring | null与此资源关联的用户标识符
representative_event.tagsobject | null分类与筛选标签
representative_event.is_resolvedboolean此错误或分组是否被标记为已解决
representative_event.is_ignoredboolean此错误或分组是否被标记为已忽略
representative_event.dashboard_urlstring在仪表盘中查看此资源的 URL
format: uri
representative_event.exceptionobject异常详情,包括类型和堆栈跟踪
representative_event.exception.typestring异常类名,如 "NullPointerException"。
representative_event.exception.valuestring异常消息。
representative_event.exception.stacktraceobject[]错误堆栈跟踪
representative_event.exception.stacktrace[].funcstring堆栈帧中的函数名
representative_event.exception.stacktrace[].filestring堆栈帧中的源文件名
representative_event.exception.stacktrace[].lineinteger源文件行号
≥ 0
representative_event.exception.stacktrace[].colinteger | null源文件列号
≥ 0
representative_event.exception.stacktrace[].in_appboolean为 true 表示该帧在用户代码中;false 表示来自 SDK/标准库。
representative_event.exception.stacktrace[].context_prestring[] | null错误行之前最多 5 行源代码。
representative_event.exception.stacktrace[].context_linestring | null发生错误的源代码行。
representative_event.exception.stacktrace[].context_poststring[] | null错误行之后的源代码行
representative_event.exception.stacktrace[].varsobject | null局部变量快照(已清理 PII)。
representative_event.breadcrumbsobject[]breadcrumb events leading up to the error列表
representative_event.breadcrumbs[].atstring事件的 ISO 8601 时间戳
format: date-time
representative_event.breadcrumbs[].categorystring同意类别(如 marketing、analytics)
e.g. http
representative_event.breadcrumbs[].messagestring详细消息内容
representative_event.breadcrumbs[].level"debug" | "info" | "warning" | "error" | "critical" | null严重级别或日志等级(如 info、warn、error)
representative_event.breadcrumbs[].dataobject | null附加到此面包屑的自由结构化数据。
representative_event.contextobject | null错误的附加上下文数据
representative_event.extraobject | null附加在错误事件上的额外元数据
representative_event.sdkobject | null包含 name 和 version 的对象。
representative_event.runtimeobject | null包含 name、version 和 os 的对象。
representative_event.requestobject | nullHTTP 请求信息(已清理)。
representative_event.userobject | null用户信息(已清理)。
representative_event.fingerprint_source"default" | "user" | "rule"错误指纹来源
representative_event.received_atstring服务端接收错误的 ISO 8601 时间戳
format: date-time
representative_event.group_first_seen_atstring此分组首次出现的 ISO 8601 时间戳
format: date-time
representative_event.group_last_seen_atstring此分组最后出现的 ISO 8601 时间戳
format: date-time
representative_event.group_countintegerevents in this error group数量
≥ 1
representative_event.group_user_countintegerunique users affected in this group数量
≥ 0
tag_distributionobject | nulltag 名称到计数的映射对象。
user_distributionobject | null受影响最多的用户:user_id 到计数的映射对象。
release_distributionobject | null事件在各软件版本中的分布
environment_distributionobject | null事件在各环境中的分布
timelineobject[] | null24 小时时间序列数据点。
commentsobject[] | nullcomments on this error group列表
activity_logobject[] | nullactivity log entries for the error group列表

示例

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at https://infrai.cc/login (Google/GitHub gives
# you $2 free credit; email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT, add
# funds at https://infrai.cc/billing (or POST /v1/account/topup and open the
# returned checkout_url).
export INFRAI_API_KEY="ifr_..."
bash
curl -X GET https://api.infrai.cc/v1/errors/group_detail/ERROR_GROUP_ID \
  -H "Authorization: Bearer $INFRAI_API_KEY"

2.8errors.events

GET /v1/errors/events/{error_group_id}

列出某错误分组下的事件

参数

名称类型必填说明
error_group_idstring
必填
错误分组 ID
cursorstring可选分页游标
limitnumber可选每页返回数量

返回

ErrorEventList
名称类型说明
itemsobject[]本页结果条目数组
items[].event_idstringevent的唯一标识符
pattern: ^evt_err_[A-Za-z0-9]{20,}$
items[].fingerprintstring用于分组的 sha256 十六进制指纹。
items[].error_group_idstring此事件所属的错误分组标识符
pattern: ^errgrp_[A-Za-z0-9]{20,}$
items[].timestampstring数据点的 Unix 时间戳
format: date-time
items[].level"debug" | "info" | "warning" | "error" | "fatal"严重级别或日志等级(如 info、warn、error)
items[].titlestring简短标题或摘要
items[].messagestring | null详细消息内容
items[].environmentstring | null部署环境(如 production、staging)
items[].releasestring | null软件发布版本
items[].user_idstring | null与此资源关联的用户标识符
items[].tagsobject | null分类与筛选标签
items[].is_resolvedboolean此错误或分组是否被标记为已解决
items[].is_ignoredboolean此错误或分组是否被标记为已忽略
items[].dashboard_urlstring在仪表盘中查看此资源的 URL
format: uri
next_cursorstring | null获取下一页的不透明游标;null 或不存在表示最后一页
totalinteger跨所有页的总条目数
≥ 0

示例

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at https://infrai.cc/login (Google/GitHub gives
# you $2 free credit; email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT, add
# funds at https://infrai.cc/billing (or POST /v1/account/topup and open the
# returned checkout_url).
export INFRAI_API_KEY="ifr_..."
bash
curl -X GET https://api.infrai.cc/v1/errors/events/ERROR_GROUP_ID \
  -H "Authorization: Bearer $INFRAI_API_KEY"

2.9errors.resolve

POST /v1/errors/resolve/{error_group_id}

将错误分组标记为已解决

参数

名称类型必填说明
error_group_idstring
必填
错误分组 ID
pattern: ^errgrp_[A-Za-z0-9]{20,}$

返回

ErrorGroup
名称类型说明
error_group_idstring此事件所属的错误分组标识符
pattern: ^errgrp_[A-Za-z0-9]{20,}$
fingerprintstring用于错误分组的指纹哈希
titlestring简短标题或摘要
first_seen_atstring首次观测到的 ISO 8601 时间戳
format: date-time
last_seen_atstring最近观测到的 ISO 8601 时间戳
format: date-time
countinteger所有页的条目总数
≥ 1
user_countintegerunique users affected数量
≥ 0
levelstring严重级别或日志等级(如 info、warn、error)
is_resolvedboolean此错误或分组是否被标记为已解决
is_ignoredboolean此错误或分组是否被标记为已忽略
assigned_tostring | null分配调查此错误分组的用户
sample_event_idstring此错误分组中的样本事件 ID
environmentsstring[] | nullenvironments where this error has been seen列表
releasesstring[] | nullsoftware releases where this error has been seen列表
trend_24hobject | null此错误分组的 24 小时趋势数据
sparklineinteger[] | null用于错误频率可视化的迷你图数据点
dashboard_urlstring在仪表盘中查看此资源的 URL
format: uri
representative_eventobject此分组的代表性错误事件
representative_event.event_idstringevent的唯一标识符
pattern: ^evt_err_[A-Za-z0-9]{20,}$
representative_event.fingerprintstring用于错误分组的指纹哈希
representative_event.error_group_idstring此事件所属的错误分组标识符
pattern: ^errgrp_[A-Za-z0-9]{20,}$
representative_event.timestampstring数据点的 Unix 时间戳
format: date-time
representative_event.level"debug" | "info" | "warning" | "error" | "fatal"严重级别或日志等级(如 info、warn、error)
representative_event.titlestring简短标题或摘要
representative_event.messagestring | null详细消息内容
representative_event.environmentstring | null部署环境(如 production、staging)
representative_event.releasestring | null软件发布版本
representative_event.user_idstring | null与此资源关联的用户标识符
representative_event.tagsobject | null分类与筛选标签
representative_event.is_resolvedboolean此错误或分组是否被标记为已解决
representative_event.is_ignoredboolean此错误或分组是否被标记为已忽略
representative_event.dashboard_urlstring在仪表盘中查看此资源的 URL
format: uri
representative_event.exceptionobject异常详情,包括类型和堆栈跟踪
representative_event.exception.typestring异常类名,如 "NullPointerException"。
representative_event.exception.valuestring异常消息。
representative_event.exception.stacktraceobject[]错误堆栈跟踪
representative_event.exception.stacktrace[].funcstring堆栈帧中的函数名
representative_event.exception.stacktrace[].filestring堆栈帧中的源文件名
representative_event.exception.stacktrace[].lineinteger源文件行号
≥ 0
representative_event.exception.stacktrace[].colinteger | null源文件列号
≥ 0
representative_event.exception.stacktrace[].in_appboolean为 true 表示该帧在用户代码中;false 表示来自 SDK/标准库。
representative_event.exception.stacktrace[].context_prestring[] | null错误行之前最多 5 行源代码。
representative_event.exception.stacktrace[].context_linestring | null发生错误的源代码行。
representative_event.exception.stacktrace[].context_poststring[] | null错误行之后的源代码行
representative_event.exception.stacktrace[].varsobject | null局部变量快照(已清理 PII)。
representative_event.breadcrumbsobject[]breadcrumb events leading up to the error列表
representative_event.breadcrumbs[].atstring事件的 ISO 8601 时间戳
format: date-time
representative_event.breadcrumbs[].categorystring同意类别(如 marketing、analytics)
e.g. http
representative_event.breadcrumbs[].messagestring详细消息内容
representative_event.breadcrumbs[].level"debug" | "info" | "warning" | "error" | "critical" | null严重级别或日志等级(如 info、warn、error)
representative_event.breadcrumbs[].dataobject | null附加到此面包屑的自由结构化数据。
representative_event.contextobject | null错误的附加上下文数据
representative_event.extraobject | null附加在错误事件上的额外元数据
representative_event.sdkobject | null包含 name 和 version 的对象。
representative_event.runtimeobject | null包含 name、version 和 os 的对象。
representative_event.requestobject | nullHTTP 请求信息(已清理)。
representative_event.userobject | null用户信息(已清理)。
representative_event.fingerprint_source"default" | "user" | "rule"错误指纹来源
representative_event.received_atstring服务端接收错误的 ISO 8601 时间戳
format: date-time
representative_event.group_first_seen_atstring此分组首次出现的 ISO 8601 时间戳
format: date-time
representative_event.group_last_seen_atstring此分组最后出现的 ISO 8601 时间戳
format: date-time
representative_event.group_countintegerevents in this error group数量
≥ 1
representative_event.group_user_countintegerunique users affected in this group数量
≥ 0
tag_distributionobject | nulltag 名称到计数的映射对象。
user_distributionobject | null受影响最多的用户:user_id 到计数的映射对象。
release_distributionobject | null事件在各软件版本中的分布
environment_distributionobject | null事件在各环境中的分布
timelineobject[] | null24 小时时间序列数据点。
commentsobject[] | nullcomments on this error group列表
activity_logobject[] | nullactivity log entries for the error group列表

示例

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at https://infrai.cc/login (Google/GitHub gives
# you $2 free credit; email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT, add
# funds at https://infrai.cc/billing (or POST /v1/account/topup and open the
# returned checkout_url).
export INFRAI_API_KEY="ifr_..."
bash
curl -X POST https://api.infrai.cc/v1/errors/resolve/ERROR_GROUP_ID \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"error_group_id": "sample"}'

3. 全部能力

本模块全部已路由能力——完整的对外 REST 契约。上方方法是带讲解的入门示例,此表是完整参考。

errors.capturePOST /v1/errors/capture

Capture an error event, aggregated into a group by fingerprint.

参数 (13)
名称类型必填说明
titlestring | null可选Short error title; falls back to message or exception.value.
messagestring | null可选Detailed message content
exceptionobject | null可选Structured exception, e.g. {type, value, stacktrace}.
levelstring可选Severity level (e.g. error, warning, info).
default: "error"
tagsobject | null可选Tags for categorization and filtering
user_idstring | null可选User identifier associated with this resource
fingerprintstring | string[] | null可选Grouping fingerprint.
breadcrumbsobject[] | null可选List of breadcrumb events leading up to the error
contextobject | null可选Additional context data for the error
extraobject | null可选Extra metadata attached to the error event
environmentstring | null可选Deployment environment (e.g. production, staging)
releasestring | null可选Software release version
idempotency_keystring | null可选Client-provided idempotency key; prevents duplicate execution on retry
errors.eventsGET /v1/errors/events/{error_group_id}

Page through all events within an error group.

参数 (1)
名称类型必填说明
error_group_idstring必填Path parameter.
errors.getGET /v1/errors/get/{event_id}

Get the details of one error event by event ID.

参数 (1)
名称类型必填说明
event_idstring必填Path parameter.
errors.group_detailGET /v1/errors/group_detail/{error_group_id}

Get the aggregated details of a specified error group.

参数 (1)
名称类型必填说明
error_group_idstring必填Path parameter.
errors.groupsGET /v1/errors/groups

Page through error groups, with status filtering and sorting.

无请求参数。

errors.listGET /v1/errors/list

Page through captured error events, with filtering.

无请求参数。

errors.messagePOST /v1/errors/message

Capture a structured error/log message (level, tags, user, release, environment).

参数 (7)
名称类型必填说明
textstring必填Message body; becomes the event title.
≥ 1 chars
level"debug" | "info" | "warning" | "error" | "fatal"可选Severity or log level (e.g. info, warn, error)
default: "info"
tagsobject | null可选Tags for categorization and filtering
user_idstring | null可选User identifier associated with this resource
releasestring | null可选Software release version
environment"production" | "staging" | "development" | null可选Deployment environment (e.g. production, staging)
idempotency_keystring | null可选Client-provided idempotency key; prevents duplicate execution on retry
errors.resolvePOST /v1/errors/resolve/{error_group_id}

Mark an error group as resolved.

参数 (1)
名称类型必填说明
error_group_idstring必填Identifier of the error group this event belongs to
pattern: ^errgrp_[A-Za-z0-9]{20,}$
errors.searchGET /v1/errors/search

Full-text search error events by keyword.

无请求参数。

4. 完整示例

本模块的生产级端到端范例:先一次性配置,再运行业务流程,尽量覆盖本模块的多数 API。

单文件可运行 Python 程序(仅标准库、无 SDK):拷贝后填入 INFRAI_API_KEY 运行,即可按真实业务流逐步体验本模块核心 API——每一步都真实调用并计费,后续步骤复用前一步返回的真实字段。12 行 helper 就是全部集成代码。

python
#!/usr/bin/env python3
"""Infrai · errors — runnable real-app example (single file, zero deps).

Copy this file, set your key, run it: every step is a REAL call to
api.infrai.cc, billed at the real (tiny) per-call price, printing the
live JSON response. Get a key at https://infrai.cc/login (Google/
GitHub sign-in grants $2 free credit); add funds at
https://infrai.cc/billing. No SDK — the 12-line helper below is the
entire integration."""
import json
import os
from urllib import error, request

KEY = os.environ.get("INFRAI_API_KEY") or "ifr_..."  # <- your key
BASE = "https://api.infrai.cc"


# Same raw HTTPS POST/GET as every per-method example on this page —
# wrapped once for reuse. There is nothing else to it: no SDK.
def infrai(method, path, body=None):
    req = request.Request(
        BASE + path, method=method,
        data=json.dumps(body).encode() if body is not None else None,
        headers={"Authorization": f"Bearer {KEY}",
                 "Content-Type": "application/json"})
    try:
        with request.urlopen(req, timeout=60) as r:
            return json.loads(r.read())
    except error.HTTPError as e:
        return json.loads(e.read())


def show(label, resp):
    print(f"\n== {label} ==")
    print(json.dumps(resp, indent=2, ensure_ascii=False))
    return resp


# 1) errors.capture — POST /v1/errors/capture · Capture an error event, aggregated into a group by fingerprint.
r1 = show("errors.capture", infrai("POST", "/v1/errors/capture", {"exception":{"type":"ValueError","message":"bad input","stacktrace":"..."},"level":"error"}))

# 2) errors.message — POST /v1/errors/message · Capture a structured error/log message (level, tags, user, release, environment).
r2 = show("errors.message", infrai("POST", "/v1/errors/message", {"text":"hello"}))

# 3) errors.list — GET /v1/errors/list · Page through captured error events, with filtering.
r3 = show("errors.list", infrai("GET", "/v1/errors/list"))