Skip to content

Observability

Error capture, event tracking, metrics and feature flags.

Overview

Base path: https://api.infrai.cc/v1/observability
Auth header: Authorization: Bearer $INFRAI_API_KEY
bash
# 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

POST /v1/observability/error/capture

Capture an application error with optional tags.

Parameters

NameTypeRequiredDescription
messagestring
Required
Human-readable error message.
codestringOptionalOptional application error code.
stackstringOptionalOptional stack trace.
tagsRecord<string, string>OptionalKey/value tags for grouping.

Returns

{ ok, error_id }

Example

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

bash
# 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_..."
bash
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

POST /v1/observability/metric/report

Report one or more metric points.

Parameters

NameTypeRequiredDescription
namestring
Required
Metric name.
valuenumber
Required
Numeric metric value.
tagsRecord<string, string>OptionalKey/value tags for grouping.

Returns

{ ok: boolean }

Example

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

bash
# 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_..."
bash
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

GET /v1/observability/flag/is_enabled/{key}

Evaluate a feature flag for the current context.

Parameters

NameTypeRequiredDescription
keystring
Required
Feature flag key.

Returns

{ enabled: boolean }

Example

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

bash
# 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_..."
bash
curl -X GET https://api.infrai.cc/v1/observability/flag/is_enabled/KEY \
  -H "Authorization: Bearer $INFRAI_API_KEY"

observability.error.message

POST /v1/observability/error/message

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

Parameters

NameTypeRequiredDescription
textstring
Required
消息正文
level'debug' | 'info' | 'warning' | 'error' | 'fatal'Optional级别:debug/info/warning/error/fatal
tagsRecord<string, string>Optional键值标签,便于过滤与分组
user_idstringOptional关联的用户 ID
releasestringOptional发布版本标识
environment'production' | 'staging' | 'development'Optional环境:production/staging/development
idempotency_keystringOptional幂等键,用于避免重复写入

Returns

CaptureResult

Example

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

bash
# 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_..."
bash
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

GET /v1/observability/error/list

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

Parameters

NameTypeRequiredDescription
filterRecord<string, unknown>Optional过滤条件(观测过滤 DSL)
cursorstringOptional分页游标
limitnumberOptional每页返回数量

Returns

ErrorEventList

Example

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

bash
# 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_..."
bash
curl -X GET https://api.infrai.cc/v1/observability/error/list \
  -H "Authorization: Bearer $INFRAI_API_KEY"

observability.error.search

GET /v1/observability/error/search

按关键词搜索错误事件

Parameters

NameTypeRequiredDescription
qstring
Required
搜索关键词
filterRecord<string, unknown>Optional过滤条件(观测过滤 DSL)
cursorstringOptional分页游标
limitnumberOptional每页返回数量

Returns

ErrorEventList

Example

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

bash
# 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_..."
bash
curl -X GET https://api.infrai.cc/v1/observability/error/search \
  -H "Authorization: Bearer $INFRAI_API_KEY"

observability.error.get

GET /v1/observability/error/get/{event_id}

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

Parameters

NameTypeRequiredDescription
event_idstring
Required
错误事件 ID

Returns

ErrorEvent

Example

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

bash
# 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_..."
bash
curl -X GET https://api.infrai.cc/v1/observability/error/get/EVENT_ID \
  -H "Authorization: Bearer $INFRAI_API_KEY"

observability.error.groups

GET /v1/observability/error/groups

分页列出错误分组

Parameters

NameTypeRequiredDescription
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
cursorstringOptional分页游标
limitnumberOptional每页返回数量

Returns

ErrorGroupList

Example

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

bash
# 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_..."
bash
curl -X GET https://api.infrai.cc/v1/observability/error/groups \
  -H "Authorization: Bearer $INFRAI_API_KEY"

observability.error.group_detail

GET /v1/observability/error/group_detail/{error_group_id}

获取错误分组的聚合详情

Parameters

NameTypeRequiredDescription
error_group_idstring
Required
错误分组 ID

Returns

ErrorGroupDetail

Example

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

bash
# 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_..."
bash
curl -X GET https://api.infrai.cc/v1/observability/error/group_detail/ERROR_GROUP_ID \
  -H "Authorization: Bearer $INFRAI_API_KEY"

observability.error.events

GET /v1/observability/error/events/{error_group_id}

列出某错误分组下的事件

Parameters

NameTypeRequiredDescription
error_group_idstring
Required
错误分组 ID
cursorstringOptional分页游标
limitnumberOptional每页返回数量

Returns

ErrorEventList

Example

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

bash
# 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_..."
bash
curl -X GET https://api.infrai.cc/v1/observability/error/events/ERROR_GROUP_ID \
  -H "Authorization: Bearer $INFRAI_API_KEY"

observability.error.resolve

POST /v1/observability/error/resolve/{error_group_id}

将错误分组标记为已解决

Parameters

NameTypeRequiredDescription
error_group_idstring
Required
错误分组 ID

Returns

ErrorGroup

Example

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

bash
# 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_..."
bash
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

POST /v1/observability/error/unresolve/{error_group_id}

撤销错误分组的已解决状态

Parameters

NameTypeRequiredDescription
error_group_idstring
Required
错误分组 ID

Returns

ErrorGroup

Example

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

bash
# 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_..."
bash
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

POST /v1/observability/error/ignore/{error_group_id}

将错误分组标记为忽略

Parameters

NameTypeRequiredDescription
error_group_idstring
Required
错误分组 ID

Returns

ErrorGroup

Example

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

bash
# 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_..."
bash
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

DELETE /v1/observability/error/delete/{error_group_id}

删除错误分组

Parameters

NameTypeRequiredDescription
error_group_idstring
Required
错误分组 ID

Returns

DeleteResult

Example

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

bash
# 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_..."
bash
curl -X DELETE https://api.infrai.cc/v1/observability/error/delete/ERROR_GROUP_ID \
  -H "Authorization: Bearer $INFRAI_API_KEY"

observability.error.bulk

POST /v1/observability/error/bulk

对多个错误分组批量执行操作

Parameters

NameTypeRequiredDescription
error_group_idsstring[]
Required
目标错误分组 ID 列表
action'resolve' | 'unresolve' | 'ignore' | 'delete'
Required
批量动作:resolve/unresolve/ignore/delete

Returns

ErrorBulkResult

Example

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

bash
# 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_..."
bash
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

POST /v1/observability/error/export

导出错误数据

Parameters

NameTypeRequiredDescription
filterRecord<string, unknown>Optional过滤条件(观测过滤 DSL)
format'json' | 'csv'Optional导出格式:json 或 csv

Returns

ErrorExportResult

Example

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

bash
# 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_..."
bash
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

GET /v1/observability/error/retention/get

查询错误数据保留期配置

Returns

{ days, auto_export_before_cleanup, export_destination }

Example

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

bash
# 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_..."
bash
curl -X GET https://api.infrai.cc/v1/observability/error/retention/get \
  -H "Authorization: Bearer $INFRAI_API_KEY"

observability.error.retention.set

PUT /v1/observability/error/retention/set

设置错误数据保留期

Parameters

NameTypeRequiredDescription
daysnumber
Required
保留天数
auto_export_before_cleanupbooleanOptional清理前是否自动导出
export_destinationstringOptional导出目标地址

Returns

{ days, auto_export_before_cleanup, export_destination }

Example

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

bash
# 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_..."
bash
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

POST /v1/observability/metric/batch

批量上报指标数据点

Parameters

NameTypeRequiredDescription
pointsMetricPoint[]
Required
指标数据点数组
idempotency_keystringOptional幂等键,用于避免重复写入

Returns

MetricBatchResult

Example

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

bash
# 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_..."
bash
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

GET /v1/observability/metric/query

查询指标时间序列

Parameters

NameTypeRequiredDescription
namestring
Required
指标名称
agg'p50' | 'p99' | 'sum' | 'avg' | 'count'
Required
聚合方式:p50/p99/sum/avg/count
tagsRecord<string, string>Optional按标签过滤
windowstringOptional聚合时间窗,如 5m、1h
sincestringOptional起始时间
untilstringOptional结束时间

Returns

MetricSeries

Example

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

bash
# 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_..."
bash
curl -X GET https://api.infrai.cc/v1/observability/metric/query \
  -H "Authorization: Bearer $INFRAI_API_KEY"

observability.log.ingest

POST /v1/observability/log/ingest

批量摄取日志条目

Parameters

NameTypeRequiredDescription
entriesLogEntry[]
Required
日志条目数组
idempotency_keystringOptional幂等键,用于避免重复写入

Returns

AcceptedResult

Example

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

bash
# 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_..."
bash
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

GET /v1/observability/log/search

搜索日志

Parameters

NameTypeRequiredDescription
qstringOptional搜索关键词
filterRecord<string, unknown>Optional过滤条件(观测过滤 DSL)
sincestringOptional起始时间
untilstringOptional结束时间
cursorstringOptional分页游标
limitnumberOptional每页返回数量

Returns

LogQueryResult

Example

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

bash
# 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_..."
bash
curl -X GET https://api.infrai.cc/v1/observability/log/search \
  -H "Authorization: Bearer $INFRAI_API_KEY"

observability.flag.set

POST /v1/observability/flag/set

创建或更新功能开关定义

Parameters

NameTypeRequiredDescription
keystring
Required
功能开关键
descriptionstringOptional功能开关描述
type'bool' | 'string' | 'number' | 'json'Optional取值类型:bool/string/number/json
default_valueunknownOptional默认取值
rulesFlagRule[]Optional定向规则列表
rolloutRolloutConfigOptional灰度发布配置
tagsRecord<string, string>Optional键值标签
enabledbooleanOptional是否启用
versionnumberOptional版本号,用于乐观并发控制

Returns

Flag

Example

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

bash
# 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_..."
bash
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

GET /v1/observability/flag/list

分页列出功能开关

Parameters

NameTypeRequiredDescription
cursorstringOptional分页游标
limitnumberOptional每页返回数量
include_archivedbooleanOptional是否包含已归档开关

Returns

FlagList

Example

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

bash
# 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_..."
bash
curl -X GET https://api.infrai.cc/v1/observability/flag/list \
  -H "Authorization: Bearer $INFRAI_API_KEY"

observability.flag.get

GET /v1/observability/flag/get/{key}

获取功能开关定义

Parameters

NameTypeRequiredDescription
keystring
Required
功能开关键

Returns

Flag

Example

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

bash
# 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_..."
bash
curl -X GET https://api.infrai.cc/v1/observability/flag/get/KEY \
  -H "Authorization: Bearer $INFRAI_API_KEY"

observability.flag.get_value

GET /v1/observability/flag/get_value/{key}

在上下文下求值单个功能开关

Parameters

NameTypeRequiredDescription
keystring
Required
功能开关键
user_idstringOptional求值上下文中的用户 ID
contextRecord<string, unknown>Optional求值上下文属性
defaultunknownOptional求值失败时的兜底默认值

Returns

FlagValue

Example

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

bash
# 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_..."
bash
curl -X GET https://api.infrai.cc/v1/observability/flag/get_value/KEY \
  -H "Authorization: Bearer $INFRAI_API_KEY"

observability.flag.get_all

GET /v1/observability/flag/get_all

在上下文下批量求值所有开关

Parameters

NameTypeRequiredDescription
user_idstringOptional求值上下文中的用户 ID
contextRecord<string, unknown>Optional求值上下文属性

Returns

FlagEvaluationMap

Example

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

bash
# 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_..."
bash
curl -X GET https://api.infrai.cc/v1/observability/flag/get_all \
  -H "Authorization: Bearer $INFRAI_API_KEY"

observability.flag.toggle

POST /v1/observability/flag/toggle/{key}

启用或禁用功能开关

Parameters

NameTypeRequiredDescription
keystring
Required
功能开关键
enabledboolean
Required
目标启用状态
versionnumber
Required
版本号,用于乐观并发控制

Returns

Flag

Example

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

bash
# 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_..."
bash
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

POST /v1/observability/flag/rollout/{key}

配置功能开关的灰度发布

Parameters

NameTypeRequiredDescription
keystring
Required
功能开关键
percentagenumber
Required
灰度百分比(0-100)
saltstring
Required
哈希分桶用的盐值
sticky_unit'user_id' | 'session_id' | 'device_id'
Required
黏滞维度:user_id/session_id/device_id
versionnumber
Required
版本号,用于乐观并发控制
variantsVariant[]Optional多变体配置列表

Returns

Flag

Example

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

bash
# 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_..."
bash
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

DELETE /v1/observability/flag/delete/{key}

删除功能开关

Parameters

NameTypeRequiredDescription
keystring
Required
功能开关键

Returns

DeleteResult

Example

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

bash
# 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_..."
bash
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.

CapabilityEndpointDescription
observability.error.bulkPOST /v1/observability/error/bulkBulk-apply resolve/ignore/delete and other actions across multiple error groups.
observability.error.capturePOST /v1/observability/error/captureCapture an error event, aggregated into a group by fingerprint.
observability.error.deleteDELETE /v1/observability/error/delete/{error_group_id}Delete a specified error group.
observability.error.eventsGET /v1/observability/error/events/{error_group_id}Page through all events within an error group.
observability.error.exportPOST /v1/observability/error/exportExport error data matching the filters (JSON or CSV).
observability.error.getGET /v1/observability/error/get/{event_id}Get the details of one error event by event ID.
observability.error.group_detailGET /v1/observability/error/group_detail/{error_group_id}Get the aggregated details of a specified error group.
observability.error.groupsGET /v1/observability/error/groupsPage through error groups, with status filtering and sorting.
observability.error.ignorePOST /v1/observability/error/ignore/{error_group_id}Mark an error group as ignored.
observability.error.listGET /v1/observability/error/listPage through captured error events, with filtering.
observability.error.messagePOST /v1/observability/error/messageCapture a structured error/log message (level, tags, user, release, environment).
observability.error.resolvePOST /v1/observability/error/resolve/{error_group_id}Mark an error group as resolved.
observability.error.retention.getGET /v1/observability/error/retention/getGet the retention-period configuration for error data.
observability.error.retention.setPUT /v1/observability/error/retention/setSet the retention period for error data, with auto-export before purge.
observability.error.searchGET /v1/observability/error/searchFull-text search error events by keyword.
observability.error.unresolvePOST /v1/observability/error/unresolve/{error_group_id}Revert an error group's resolved status.
observability.flag.deleteDELETE /v1/observability/flag/delete/{key}Delete a feature flag permanently.
observability.flag.getGET /v1/observability/flag/get/{key}Retrieve the full definition of a feature flag.
observability.flag.get_allGET /v1/observability/flag/get_allEvaluate all feature flags at once for a given evaluation context.
observability.flag.get_valueGET /v1/observability/flag/get_value/{key}Evaluate a single feature flag's value for a given evaluation context.
observability.flag.is_enabledGET /v1/observability/flag/is_enabled/{key}Check whether a feature flag is enabled for the current evaluation context.
observability.flag.listGET /v1/observability/flag/listList feature flags with pagination, optionally including archived ones.
observability.flag.rolloutPOST /v1/observability/flag/rollout/{key}Configure a percentage-based gradual rollout for a feature flag.
observability.flag.setPOST /v1/observability/flag/setCreate or update a feature-flag definition.
observability.flag.togglePOST /v1/observability/flag/toggle/{key}Enable or disable a feature flag with optimistic version checking.
observability.log.ingestPOST /v1/observability/log/ingestIngest a batch of log entries.
observability.log.searchGET /v1/observability/log/searchSearch logs by keyword and time range.
observability.metric.batchPOST /v1/observability/metric/batchReport a batch of metric data points.
observability.metric.queryGET /v1/observability/metric/queryQuery a metric time series with aggregation.
observability.metric.reportPOST /v1/observability/metric/reportReport 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.

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

bash
# 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_..."
bash
# 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"