Observability
Error capture, event tracking, metrics and feature flags.
Overview
https://api.infrai.cc/v1/observabilityAuthorization: Bearer $INFRAI_API_KEY# Call any /v1/observability capability over raw HTTP — no SDK to install.
# curl:
curl https://api.infrai.cc/v1/observability/... \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json"Methods
observability.error.capture
Capture an application error with optional tags.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
message | string | Required | Human-readable error message. |
code | string | Optional | Optional application error code. |
stack | string | Optional | Optional stack trace. |
tags | Record<string, string> | Optional | Key/value tags for grouping. |
Returns
{ ok, error_id }Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X POST https://api.infrai.cc/v1/observability/error/capture \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"exception": {"type": "ValueError", "message": "bad input", "stacktrace": "..."}, "level": "error"}'observability.metric.report
Report one or more metric points.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
name | string | Required | Metric name. |
value | number | Required | Numeric metric value. |
tags | Record<string, string> | Optional | Key/value tags for grouping. |
Returns
{ ok: boolean }Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X POST https://api.infrai.cc/v1/observability/metric/report \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name": "...", "value": 0, "type": "counter"}'observability.flag.is_enabled
Evaluate a feature flag for the current context.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
key | string | Required | Feature flag key. |
Returns
{ enabled: boolean }Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X GET https://api.infrai.cc/v1/observability/flag/is_enabled/KEY \
-H "Authorization: Bearer $INFRAI_API_KEY"observability.error.message
上报一条结构化错误或日志消息
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
text | string | Required | 消息正文 |
level | 'debug' | 'info' | 'warning' | 'error' | 'fatal' | Optional | 级别:debug/info/warning/error/fatal |
tags | Record<string, string> | Optional | 键值标签,便于过滤与分组 |
user_id | string | Optional | 关联的用户 ID |
release | string | Optional | 发布版本标识 |
environment | 'production' | 'staging' | 'development' | Optional | 环境:production/staging/development |
idempotency_key | string | Optional | 幂等键,用于避免重复写入 |
Returns
CaptureResultExample
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X POST https://api.infrai.cc/v1/observability/error/message \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"text": "..."}'observability.error.list
分页列出捕获到的错误事件
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
filter | Record<string, unknown> | Optional | 过滤条件(观测过滤 DSL) |
cursor | string | Optional | 分页游标 |
limit | number | Optional | 每页返回数量 |
Returns
ErrorEventListExample
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X GET https://api.infrai.cc/v1/observability/error/list \
-H "Authorization: Bearer $INFRAI_API_KEY"observability.error.search
按关键词搜索错误事件
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
q | string | Required | 搜索关键词 |
filter | Record<string, unknown> | Optional | 过滤条件(观测过滤 DSL) |
cursor | string | Optional | 分页游标 |
limit | number | Optional | 每页返回数量 |
Returns
ErrorEventListExample
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X GET https://api.infrai.cc/v1/observability/error/search \
-H "Authorization: Bearer $INFRAI_API_KEY"observability.error.get
按事件 ID 获取错误事件详情
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
event_id | string | Required | 错误事件 ID |
Returns
ErrorEventExample
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X GET https://api.infrai.cc/v1/observability/error/get/EVENT_ID \
-H "Authorization: Bearer $INFRAI_API_KEY"observability.error.groups
分页列出错误分组
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
status | 'unresolved' | 'resolved' | 'ignored' | Optional | 按状态过滤:unresolved/resolved/ignored |
sort | 'count_desc' | 'last_seen_desc' | 'first_seen_desc' | Optional | 排序方式:count_desc/last_seen_desc/first_seen_desc |
cursor | string | Optional | 分页游标 |
limit | number | Optional | 每页返回数量 |
Returns
ErrorGroupListExample
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X GET https://api.infrai.cc/v1/observability/error/groups \
-H "Authorization: Bearer $INFRAI_API_KEY"observability.error.group_detail
获取错误分组的聚合详情
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
error_group_id | string | Required | 错误分组 ID |
Returns
ErrorGroupDetailExample
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X GET https://api.infrai.cc/v1/observability/error/group_detail/ERROR_GROUP_ID \
-H "Authorization: Bearer $INFRAI_API_KEY"observability.error.events
列出某错误分组下的事件
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
error_group_id | string | Required | 错误分组 ID |
cursor | string | Optional | 分页游标 |
limit | number | Optional | 每页返回数量 |
Returns
ErrorEventListExample
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X GET https://api.infrai.cc/v1/observability/error/events/ERROR_GROUP_ID \
-H "Authorization: Bearer $INFRAI_API_KEY"observability.error.resolve
将错误分组标记为已解决
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
error_group_id | string | Required | 错误分组 ID |
Returns
ErrorGroupExample
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X POST https://api.infrai.cc/v1/observability/error/resolve/ERROR_GROUP_ID \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"error_group_id": "..."}'observability.error.unresolve
撤销错误分组的已解决状态
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
error_group_id | string | Required | 错误分组 ID |
Returns
ErrorGroupExample
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X POST https://api.infrai.cc/v1/observability/error/unresolve/ERROR_GROUP_ID \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"error_group_id": "..."}'observability.error.ignore
将错误分组标记为忽略
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
error_group_id | string | Required | 错误分组 ID |
Returns
ErrorGroupExample
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X POST https://api.infrai.cc/v1/observability/error/ignore/ERROR_GROUP_ID \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"error_group_id": "..."}'observability.error.delete
删除错误分组
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
error_group_id | string | Required | 错误分组 ID |
Returns
DeleteResultExample
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X DELETE https://api.infrai.cc/v1/observability/error/delete/ERROR_GROUP_ID \
-H "Authorization: Bearer $INFRAI_API_KEY"observability.error.bulk
对多个错误分组批量执行操作
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
error_group_ids | string[] | Required | 目标错误分组 ID 列表 |
action | 'resolve' | 'unresolve' | 'ignore' | 'delete' | Required | 批量动作:resolve/unresolve/ignore/delete |
Returns
ErrorBulkResultExample
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X POST https://api.infrai.cc/v1/observability/error/bulk \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"error_group_ids": [], "action": "resolve"}'observability.error.export
导出错误数据
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
filter | Record<string, unknown> | Optional | 过滤条件(观测过滤 DSL) |
format | 'json' | 'csv' | Optional | 导出格式:json 或 csv |
Returns
ErrorExportResultExample
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X POST https://api.infrai.cc/v1/observability/error/export \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{}'observability.error.retention.get
查询错误数据保留期配置
Returns
{ days, auto_export_before_cleanup, export_destination }Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X GET https://api.infrai.cc/v1/observability/error/retention/get \
-H "Authorization: Bearer $INFRAI_API_KEY"observability.error.retention.set
设置错误数据保留期
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
days | number | Required | 保留天数 |
auto_export_before_cleanup | boolean | Optional | 清理前是否自动导出 |
export_destination | string | Optional | 导出目标地址 |
Returns
{ days, auto_export_before_cleanup, export_destination }Example
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X PUT https://api.infrai.cc/v1/observability/error/retention/set \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"days": 0}'observability.metric.batch
批量上报指标数据点
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
points | MetricPoint[] | Required | 指标数据点数组 |
idempotency_key | string | Optional | 幂等键,用于避免重复写入 |
Returns
MetricBatchResultExample
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X POST https://api.infrai.cc/v1/observability/metric/batch \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"points": []}'observability.metric.query
查询指标时间序列
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
name | string | Required | 指标名称 |
agg | 'p50' | 'p99' | 'sum' | 'avg' | 'count' | Required | 聚合方式:p50/p99/sum/avg/count |
tags | Record<string, string> | Optional | 按标签过滤 |
window | string | Optional | 聚合时间窗,如 5m、1h |
since | string | Optional | 起始时间 |
until | string | Optional | 结束时间 |
Returns
MetricSeriesExample
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X GET https://api.infrai.cc/v1/observability/metric/query \
-H "Authorization: Bearer $INFRAI_API_KEY"observability.log.ingest
批量摄取日志条目
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
entries | LogEntry[] | Required | 日志条目数组 |
idempotency_key | string | Optional | 幂等键,用于避免重复写入 |
Returns
AcceptedResultExample
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X POST https://api.infrai.cc/v1/observability/log/ingest \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"entries": []}'observability.log.search
搜索日志
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
q | string | Optional | 搜索关键词 |
filter | Record<string, unknown> | Optional | 过滤条件(观测过滤 DSL) |
since | string | Optional | 起始时间 |
until | string | Optional | 结束时间 |
cursor | string | Optional | 分页游标 |
limit | number | Optional | 每页返回数量 |
Returns
LogQueryResultExample
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X GET https://api.infrai.cc/v1/observability/log/search \
-H "Authorization: Bearer $INFRAI_API_KEY"observability.flag.set
创建或更新功能开关定义
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
key | string | Required | 功能开关键 |
description | string | Optional | 功能开关描述 |
type | 'bool' | 'string' | 'number' | 'json' | Optional | 取值类型:bool/string/number/json |
default_value | unknown | Optional | 默认取值 |
rules | FlagRule[] | Optional | 定向规则列表 |
rollout | RolloutConfig | Optional | 灰度发布配置 |
tags | Record<string, string> | Optional | 键值标签 |
enabled | boolean | Optional | 是否启用 |
version | number | Optional | 版本号,用于乐观并发控制 |
Returns
FlagExample
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X POST https://api.infrai.cc/v1/observability/flag/set \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"key": "new_checkout", "type": "bool", "default_value": false, "description": "new checkout UX"}'observability.flag.list
分页列出功能开关
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
cursor | string | Optional | 分页游标 |
limit | number | Optional | 每页返回数量 |
include_archived | boolean | Optional | 是否包含已归档开关 |
Returns
FlagListExample
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X GET https://api.infrai.cc/v1/observability/flag/list \
-H "Authorization: Bearer $INFRAI_API_KEY"observability.flag.get
获取功能开关定义
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
key | string | Required | 功能开关键 |
Returns
FlagExample
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X GET https://api.infrai.cc/v1/observability/flag/get/KEY \
-H "Authorization: Bearer $INFRAI_API_KEY"observability.flag.get_value
在上下文下求值单个功能开关
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
key | string | Required | 功能开关键 |
user_id | string | Optional | 求值上下文中的用户 ID |
context | Record<string, unknown> | Optional | 求值上下文属性 |
default | unknown | Optional | 求值失败时的兜底默认值 |
Returns
FlagValueExample
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X GET https://api.infrai.cc/v1/observability/flag/get_value/KEY \
-H "Authorization: Bearer $INFRAI_API_KEY"observability.flag.get_all
在上下文下批量求值所有开关
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
user_id | string | Optional | 求值上下文中的用户 ID |
context | Record<string, unknown> | Optional | 求值上下文属性 |
Returns
FlagEvaluationMapExample
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X GET https://api.infrai.cc/v1/observability/flag/get_all \
-H "Authorization: Bearer $INFRAI_API_KEY"observability.flag.toggle
启用或禁用功能开关
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
key | string | Required | 功能开关键 |
enabled | boolean | Required | 目标启用状态 |
version | number | Required | 版本号,用于乐观并发控制 |
Returns
FlagExample
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X POST https://api.infrai.cc/v1/observability/flag/toggle/KEY \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"key": "...", "enabled": true, "version": 0}'observability.flag.rollout
配置功能开关的灰度发布
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
key | string | Required | 功能开关键 |
percentage | number | Required | 灰度百分比(0-100) |
salt | string | Required | 哈希分桶用的盐值 |
sticky_unit | 'user_id' | 'session_id' | 'device_id' | Required | 黏滞维度:user_id/session_id/device_id |
version | number | Required | 版本号,用于乐观并发控制 |
variants | Variant[] | Optional | 多变体配置列表 |
Returns
FlagExample
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X POST https://api.infrai.cc/v1/observability/flag/rollout/KEY \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"key": "new_checkout", "rollout": {"percentage": 25, "salt": "v1", "sticky_unit": "user_id"}}'observability.flag.delete
删除功能开关
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
key | string | Required | 功能开关键 |
Returns
DeleteResultExample
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X DELETE https://api.infrai.cc/v1/observability/flag/delete/KEY \
-H "Authorization: Bearer $INFRAI_API_KEY"All capabilities
Every routed capability in this module — the complete public REST contract. The methods above are the guided walkthrough; this index is the full reference.
| Capability | Endpoint | Description |
|---|---|---|
observability.error.bulk | POST /v1/observability/error/bulk | Bulk-apply resolve/ignore/delete and other actions across multiple error groups. |
observability.error.capture | POST /v1/observability/error/capture | Capture an error event, aggregated into a group by fingerprint. |
observability.error.delete | DELETE /v1/observability/error/delete/{error_group_id} | Delete a specified error group. |
observability.error.events | GET /v1/observability/error/events/{error_group_id} | Page through all events within an error group. |
observability.error.export | POST /v1/observability/error/export | Export error data matching the filters (JSON or CSV). |
observability.error.get | GET /v1/observability/error/get/{event_id} | Get the details of one error event by event ID. |
observability.error.group_detail | GET /v1/observability/error/group_detail/{error_group_id} | Get the aggregated details of a specified error group. |
observability.error.groups | GET /v1/observability/error/groups | Page through error groups, with status filtering and sorting. |
observability.error.ignore | POST /v1/observability/error/ignore/{error_group_id} | Mark an error group as ignored. |
observability.error.list | GET /v1/observability/error/list | Page through captured error events, with filtering. |
observability.error.message | POST /v1/observability/error/message | Capture a structured error/log message (level, tags, user, release, environment). |
observability.error.resolve | POST /v1/observability/error/resolve/{error_group_id} | Mark an error group as resolved. |
observability.error.retention.get | GET /v1/observability/error/retention/get | Get the retention-period configuration for error data. |
observability.error.retention.set | PUT /v1/observability/error/retention/set | Set the retention period for error data, with auto-export before purge. |
observability.error.search | GET /v1/observability/error/search | Full-text search error events by keyword. |
observability.error.unresolve | POST /v1/observability/error/unresolve/{error_group_id} | Revert an error group's resolved status. |
observability.flag.delete | DELETE /v1/observability/flag/delete/{key} | Delete a feature flag permanently. |
observability.flag.get | GET /v1/observability/flag/get/{key} | Retrieve the full definition of a feature flag. |
observability.flag.get_all | GET /v1/observability/flag/get_all | Evaluate all feature flags at once for a given evaluation context. |
observability.flag.get_value | GET /v1/observability/flag/get_value/{key} | Evaluate a single feature flag's value for a given evaluation context. |
observability.flag.is_enabled | GET /v1/observability/flag/is_enabled/{key} | Check whether a feature flag is enabled for the current evaluation context. |
observability.flag.list | GET /v1/observability/flag/list | List feature flags with pagination, optionally including archived ones. |
observability.flag.rollout | POST /v1/observability/flag/rollout/{key} | Configure a percentage-based gradual rollout for a feature flag. |
observability.flag.set | POST /v1/observability/flag/set | Create or update a feature-flag definition. |
observability.flag.toggle | POST /v1/observability/flag/toggle/{key} | Enable or disable a feature flag with optimistic version checking. |
observability.log.ingest | POST /v1/observability/log/ingest | Ingest a batch of log entries. |
observability.log.search | GET /v1/observability/log/search | Search logs by keyword and time range. |
observability.metric.batch | POST /v1/observability/metric/batch | Report a batch of metric data points. |
observability.metric.query | GET /v1/observability/metric/query | Query a metric time series with aggregation. |
observability.metric.report | POST /v1/observability/metric/report | Report a single metric point (counter, gauge, timing, or distribution) with tags and idempotency. |
End-to-end example
A production-style walkthrough of this module: configure once, then run the flow. It exercises most of the module's APIs.
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."# 1) Auth: every call is a raw HTTPS request to the Infrai gateway carrying
# only your project key. No SDK, no install.
# Get your key: sign in with Google/GitHub at the console for a project key
# + $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..." # from the console
# 2) observability.error.capture
curl -X POST https://api.infrai.cc/v1/observability/error/capture \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"exception": {"type": "ValueError", "message": "bad input", "stacktrace": "..."}, "level": "error"}'
# 3) observability.metric.report
curl -X POST https://api.infrai.cc/v1/observability/metric/report \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name": "...", "value": 0, "type": "counter"}'
# 4) observability.flag.is_enabled
curl -X GET https://api.infrai.cc/v1/observability/flag/is_enabled/KEY \
-H "Authorization: Bearer $INFRAI_API_KEY"
# 5) observability.error.message
curl -X POST https://api.infrai.cc/v1/observability/error/message \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"text": "..."}'
# 6) observability.error.list
curl -X GET https://api.infrai.cc/v1/observability/error/list \
-H "Authorization: Bearer $INFRAI_API_KEY"
# 7) observability.error.search
curl -X GET https://api.infrai.cc/v1/observability/error/search \
-H "Authorization: Bearer $INFRAI_API_KEY"
# 8) observability.error.get
curl -X GET https://api.infrai.cc/v1/observability/error/get/EVENT_ID \
-H "Authorization: Bearer $INFRAI_API_KEY"
# 9) observability.error.groups
curl -X GET https://api.infrai.cc/v1/observability/error/groups \
-H "Authorization: Bearer $INFRAI_API_KEY"