|
11 | 11 | - `GET /health` |
12 | 12 | - `POST /api/v1/publish?room=<room>&sender=<sender>&topic=notify&id=<id>&sig=<sig?>` |
13 | 13 | - `GET /api/v1/poll?room=<room>&after=<cursor>&limit=<n>` |
| 14 | +- `POST /api/v1/review?room=<room>&sender=<sender>&pr_id=<id>&verdict=approve|deny` |
| 15 | +- `GET /api/v1/review?room=<room>&pr_id=<id>` |
14 | 16 | - `GET /api/v1/inbox/pending?room=<room>&consumer=<consumer>&limit=<n>` |
15 | 17 | - `POST /api/v1/inbox/ack?room=<room>&consumer=<consumer>` |
16 | 18 | - `GET /ws?room=<room>` |
17 | 19 | - `GET /api/v1/key/info?sender=<sender>` |
18 | 20 | - `POST /api/v1/key/rotate` |
| 21 | +- `POST /api/v1/key/verify-github` |
| 22 | + |
| 23 | +### Cache Exchange / Issue Cache |
| 24 | + |
| 25 | +- `GET /api/v1/cache/exchange/discovery` |
| 26 | +- `GET /api/v1/cache/exchange/pull?after=<cursor>&limit=<n>&peer=<node_id>&room=<room?>` |
| 27 | +- `POST /api/v1/cache/exchange/push` |
| 28 | +- `GET /api/v1/cache/issues/pull?room=<room>&after=<cursor>&limit=<n>` |
| 29 | +- `GET /api/v1/cache/issues/sync?room=<room>&after=<cursor>&limit=<n>` |
| 30 | + |
| 31 | +### Trigger / Callback / GitHub Webhook |
| 32 | + |
| 33 | +- `POST /api/v1/trigger/callback` |
| 34 | +- `GET /api/v1/trigger/results?room=<room>&after=<cursor>&limit=<n>` |
| 35 | +- `POST /api/v1/github/webhook` |
| 36 | +- `GET /api/v1/github/webhook/dlq?after=<cursor>&limit=<n>` |
| 37 | +- `POST /api/v1/github/webhook/dlq/retry?delivery_id=<id>` |
| 38 | + |
| 39 | +### Admin APIs (auth required) |
| 40 | + |
| 41 | +- `POST /api/v1/admin/github/repos/register` |
| 42 | +- `POST /api/v1/admin/github/repos/<id>/push` |
| 43 | +- `POST /api/v1/admin/github/repos/<id>/actions/dispatch` |
19 | 44 |
|
20 | 45 | ### Git Serve Session (relay-proxied clone) |
21 | 46 |
|
@@ -47,6 +72,19 @@ Clone side → (response resolved) |
47 | 72 | - room validation: `[A-Za-z0-9][A-Za-z0-9._-]{0,63}` |
48 | 73 | - dedupe: room 内の同一 `id` は `accepted=false` |
49 | 74 |
|
| 75 | +## Observability |
| 76 | + |
| 77 | +構造化ログ(JSON line)を標準出力へ出します。 |
| 78 | + |
| 79 | +- `relay_event`: incoming ref / issue sync / cache replication などのイベントログ |
| 80 | +- `relay_audit`: API の監査ログ |
| 81 | +- `relay_metric`: メトリクスログ |
| 82 | + |
| 83 | +代表的なメトリクス: |
| 84 | + |
| 85 | +- `relay.request.success_rate`: 操作単位の成功率・平均レイテンシ・再試行回数 |
| 86 | +- `relay.cache.persist.retry`: cache 永続化の再試行回数 |
| 87 | + |
50 | 88 | ## Auth |
51 | 89 |
|
52 | 90 | `BIT_RELAY_AUTH_TOKEN` を設定すると `/api/v1/*` と `/ws` で Bearer 認証を要求します。 |
@@ -134,6 +172,22 @@ optional env: |
134 | 172 | - `RELAY_MAX_CLOCK_SKEW_SEC` (default: `300`) |
135 | 173 | - `RELAY_NONCE_TTL_SEC` (default: `600`) |
136 | 174 | - `RELAY_MAX_NONCES_PER_SENDER` (default: `2048`) |
| 175 | +- `RELAY_NODE_ID` (cache exchange ノード ID) |
| 176 | +- `RELAY_PEERS` (CSV: peer relay URLs) |
| 177 | +- `RELAY_PEERS_JSON` (JSON: peer relay URLs, `RELAY_PEERS` より優先) |
| 178 | +- `RELAY_PEER_AUTH_TOKEN` (peer pull 時の Bearer token) |
| 179 | +- `RELAY_PEER_SYNC_INTERVAL_SEC` (default: `30`) |
| 180 | +- `RELAY_CACHE_PROVIDER` (`memory` or `r2`, default: `memory`) |
| 181 | +- `RELAY_CACHE_TTL_SEC` (default: `86400`) |
| 182 | +- `RELAY_CACHE_MAX_BYTES` (任意、上限 bytes) |
| 183 | +- `RELAY_CACHE_R2_BUCKET` (R2 利用時) |
| 184 | +- `RELAY_CACHE_R2_PREFIX` (default: `relay-cache/`) |
| 185 | +- `RELAY_GITHUB_WEBHOOK_SECRET` |
| 186 | +- `RELAY_TRIGGER_WEBHOOK_URL` |
| 187 | +- `RELAY_TRIGGER_WEBHOOK_TOKEN` |
| 188 | +- `RELAY_TRIGGER_EVENT_TYPE` (default: `relay.incoming_ref`) |
| 189 | +- `RELAY_TRIGGER_REF_PREFIXES` (CSV, default: `refs/relay/incoming/`) |
| 190 | +- `RELAY_CONFIG_JSON` (JSON override) |
137 | 191 |
|
138 | 192 | 互換モード(従来の unsigned publish 許可): |
139 | 193 |
|
@@ -242,3 +296,14 @@ just test-serve https://myapp.exe.dev |
242 | 296 | ```bash |
243 | 297 | just test |
244 | 298 | ``` |
| 299 | + |
| 300 | +## Benchmark |
| 301 | + |
| 302 | +```bash |
| 303 | +# 全シナリオ |
| 304 | +just bench https://bit-relay.mizchi.workers.dev |
| 305 | + |
| 306 | +# 新規: multi-relay + cache hit/miss + issue sync |
| 307 | +RELAY_URLS=https://relay-a.example,https://relay-b.example \ |
| 308 | + just bench-scenario multi-relay-cache-issue-sync https://relay-a.example |
| 309 | +``` |
0 commit comments