事件

Endpoint POST /api/v1/events

事件 endpoint 接收一个符合 Blipit schema v1 的 JSON 事件并将其入队。所有 Blipit SDK 和 Odoo 模块都调用它。Sentry SDK 则发送到 envelope endpoint,并被转换为相同的结构。

1请求

密钥放在 X-Blipit-Key(公钥或私密密钥)或 ?key= 中。Odoo 还会发送 X-Blipit-Instance。请求体最大 256 KB,嵌套最多 32 层。必填:event_id(32 位小写十六进制)、timestamp(ISO 8601)、platform、sdk {name, version},以及 message 或 exception。可选:level、release、environment、user {id, email, username}、tags、breadcrumbs、request {method, url, headers}、contexts、fingerprint(替代计算分组的字符串数组)、security(仅限私密密钥)。

sh
curl https://in.blipit.io/api/v1/events \
  -H "Content-Type: application/json" -H "X-Blipit-Key: <public key>" \
  -d '{
    "event_id": "0123456789abcdef0123456789abcdef",
    "timestamp": "2026-09-28T09:15:00Z",
    "platform": "python",
    "level": "error",
    "release": "shop@1.4.2",
    "environment": "production",
    "exception": {
      "type": "KeyError",
      "value": "customer_id",
      "stacktrace": { "frames": [{ "filename": "shop/cart.py", "function": "checkout", "lineno": 42, "in_app": true }] }
    },
    "tags": { "company_id": "1" },
    "sdk": { "name": "my-sdk", "version": "1.0.0" }
  }'

2响应

202 {id} 已接收。202 {accepted: false, sampled: true, plan} 超过每月上限:事件已计数但未存储。400 schema 错误(附详情)或嵌套过深。401 未知密钥。403 密钥绑定到其他实例、用公钥发送安全事件(security_needs_secret_key),或套餐不含安全监控。429 限流。

3Sentry SDK

POST /api/<project id>/envelope/ 以及较旧的 /api/<project id>/store/,密钥放在 X-Sentry-Auth 或 ?sentry_key= 中,请求体支持 gzip、deflate 或 brotli,最大 1 MB(解压后 4 MB)。密钥必须属于 URL 中的项目。每个 envelope 最多 10 个 event 项;transaction 和 span 项变为 span;session、sessions、user_report 和 feedback 项用于 release 健康度和反馈;replay 和 profile 会被丢弃。

须知

  • 每个密钥每分钟 300 个请求,与 span 和日志共享。
  • 同一个 event_id 发送两次只存储一次。
  • 公钥不能设置 tags.db;它会被丢弃,以防 Odoo 副本检测基线被污染。

遇到问题?发邮件至 support@blipit.io。每个项目的密钥和确切的 DSN 在 app.blipit.io 的“API 密钥”下。