Skip to content

Commit deabc8d

Browse files
committed
docs: apply reviewer round 11 — correlation families, metadata names
Apply 2 / modify 0 / skip 0, corpus-swept: - correlation_id two-family wording (protocol hash clusters vs governance operation IDs) propagated to webhook-delivery-protocol, the correlation page's audit table, and the glossary entry; two envelope examples no longer show operator-looking values (batch_nightly_*/req_* -> server-shape hash), and the event-payloads field row no longer reads as caller-provided - five remaining metadata examples renamed off the server-managed request_id key (SpEL reference, Spring quickstart x2, Python quickstart, programmatic how-to x2) -> app_request_id - verified the remaining "request_id" hits are legitimate server wire fields (error bodies, bulk envelopes, event envelope); error-codes Correlation identifiers section already correct
1 parent bb3a0a6 commit deabc8d

8 files changed

Lines changed: 12 additions & 12 deletions

configuration/spel-expression-reference-for-cycles.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Subject fields are evaluated before the guarded method runs, so `#result` is del
3434
The `metadata` attribute is evaluated after the method returns and must yield a `Map<String, Object>`:
3535

3636
```java
37-
@Cycles(value = "1000", metadata = "{'request_id': #requestId, 'model': #result.model}")
37+
@Cycles(value = "1000", metadata = "{'app_request_id': #requestId, 'model': #result.model}")
3838
public LlmResponse call(String requestId, String prompt) { ... }
3939
```
4040

glossary.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ The W3C Trace Context HTTP header (`00-<trace_id>-<span_id>-<flags>`). Cycles ac
271271

272272
### correlation_id
273273

274-
A server-set identifier that groups a family of related events in the event stream. Cycles computes it as a deterministic hash over `(tenant_id, scope, action_kind_or_risk_class, window, window_key)` so that threshold-alert → trip → reset chains and `observed_denied``reservation.denied` pairs can be joined without an operator supplying anything. Scoped to the event stream only. Distinct from `trace_id` (logical-operation grain, W3C-compatible) and `request_id` (one HTTP request) — both of which are also server-managed but answer different questions.
274+
A server-set identifier that groups a family of related events in the event stream, in one of two shapes: for protocol event-stream clusters, a deterministic hash over `(tenant_id, scope, action_kind_or_risk_class, window, window_key)` so threshold-alert → trip → reset chains and `observed_denied``reservation.denied` pairs join without an operator supplying anything; for governance/admin operations, an explicit server-composed operation ID (e.g. `webhook_create:<id>`, `webhook_bulk_action:<action>:<request_id>`, tenant-cascade IDs). Scoped to the event stream only. Distinct from `trace_id` (logical-operation grain, W3C-compatible) and `request_id` (one HTTP request) — both of which are also server-managed but answer different questions.
275275

276276
## Admin Plane
277277

how-to/using-the-cycles-client-programmatically.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ client.commit_reservation(reservation_id, CommitRequest(
163163
latency_ms=320,
164164
model_version="gpt-4o-2024-08-06",
165165
),
166-
metadata={"request_id": "req-abc-123"},
166+
metadata={"app_request_id": "req-abc-123"},
167167
))
168168
```
169169
```java [Java]
@@ -177,7 +177,7 @@ CommitRequest commitRequest = CommitRequest.builder()
177177
.idempotencyKey("commit-" + UUID.randomUUID())
178178
.actual(new Amount(Unit.USD_MICROCENTS, 3200L))
179179
.metrics(metrics)
180-
.metadata(Map.of("request_id", "req-abc-123"))
180+
.metadata(Map.of("app_request_id", "req-abc-123"))
181181
.build();
182182

183183
CyclesResponse<Map<String, Object>> commitResponse =

protocol/correlation-and-tracing-in-cycles.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ Standard event payloads carry:
8484
|---|---|
8585
| `request_id` | Populated on every event causally downstream of an HTTP request — including async and queued work that spans thread / process boundaries. Pre-v0.1.25 events may lack it. |
8686
| `trace_id` | OPTIONAL on the schema; populated by conformant v0.1.25.14+ runtime servers. |
87-
| `correlation_id` | Server-set: a deterministic hash over `(tenant_id, scope, action_kind_or_risk_class, window, window_key)`. Groups related events in the stream. |
87+
| `correlation_id` | Server-set, two shapes: a deterministic hash over `(tenant_id, scope, action_kind_or_risk_class, window, window_key)` for protocol event-stream clusters, or an explicit operation ID (`webhook_create:<id>`, `webhook_bulk_action:<action>:<request_id>`, cascade IDs) for governance/admin operations. Groups related events in the stream. |
8888

8989
### Inside audit-log entries
9090

protocol/event-payloads-reference.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Every event shares this envelope structure. The `data` field varies by event typ
4646
"source_ip": "10.0.1.50"
4747
},
4848
"data": { },
49-
"correlation_id": "req_789",
49+
"correlation_id": "3f2a9c14e0b7d5a1",
5050
"request_id": "req_789",
5151
"trace_id": "4bf92f3577b34da6a3ce929d0e0e4736",
5252
"metadata": {}
@@ -66,7 +66,7 @@ Every event shares this envelope structure. The `data` field varies by event typ
6666
| `source` | string | Yes | Emitting service: `cycles-server` (runtime events), `cycles-admin` (admin-plane events including bulk-action emits and webhook lifecycle events since v0.1.25.38/.39), or `cycles-events` (dispatcher-emitted `webhook.disabled` on auto-disable, v0.1.25.11). |
6767
| `actor` | object | When applicable | Who triggered: `type` (`api_key`, `admin`, `system`, `scheduler`), `key_id`, `source_ip` |
6868
| `data` | object | Varies | Event-specific payload (see below). Some events emit `null`. |
69-
| `correlation_id` | string | When provided | Links related events across a workflow |
69+
| `correlation_id` | string | When applicable | Server-set family key — deterministic hash for event-stream clusters, explicit operation IDs (`webhook_create:<id>` etc.) for admin operations |
7070
| `request_id` | string | When provided | From `X-Request-Id` header on originating request |
7171
| `trace_id` | string | When provided | W3C Trace Context-compatible correlation identifier (32 lowercase hex characters). Links the event to the originating request, its audit entry, and sibling events within the same logical operation. |
7272
| `metadata` | object | When provided | Operator-defined key-value pairs |

protocol/webhook-event-delivery-protocol.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ The body is a JSON-serialized Event object:
5151
"remaining": 0,
5252
"spent": 10000
5353
},
54-
"correlation_id": "batch_nightly_2026_04_18",
54+
"correlation_id": "3f2a9c14e0b7d5a1",
5555
"request_id": "req_789",
5656
"trace_id": "0af7651916cd43dd8448eb211c80319c",
5757
"metadata": {}
@@ -60,7 +60,7 @@ The body is a JSON-serialized Event object:
6060

6161
Fields `scope`, `actor`, `data`, `correlation_id`, `request_id`, `trace_id`, and `metadata` are optional (omitted when null).
6262

63-
**Correlation fields.** `request_id` narrows to one HTTP request; `trace_id` (32-hex W3C) narrows to one logical operation (may span many requests); `correlation_id` is operator-populated and groups a family of related events. See [Correlation and Tracing](/protocol/correlation-and-tracing-in-cycles).
63+
**Correlation fields.** `request_id` narrows to one HTTP request; `trace_id` (32-hex W3C) narrows to one logical operation (may span many requests); `correlation_id` groups a family of related events — it is server-set in one of two shapes: a deterministic hash over `(tenant_id, scope, action_kind_or_risk_class, window, window_key)` for protocol event-stream clusters, or an explicit operation ID (e.g. `webhook_create:<id>`, `webhook_bulk_action:<action>:<request_id>`) for governance/admin operations. See [Correlation and Tracing](/protocol/correlation-and-tracing-in-cycles).
6464

6565
## Event types (47)
6666

quickstart/getting-started-with-the-cycles-spring-boot-starter.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ Evaluates the reservation without actually holding budget. The guarded method do
394394
### Commit metadata
395395

396396
```java
397-
@Cycles(value = "1000", metadata = "{'request_id': #requestId, 'model': #result.model}")
397+
@Cycles(value = "1000", metadata = "{'app_request_id': #requestId, 'model': #result.model}")
398398
```
399399

400400
Since 0.2.5. The `metadata` SpEL expression is evaluated after the method returns — `#result` is available — and must yield a `Map<String, Object>`. The result is merged with metadata set programmatically via `CyclesContextHolder`; programmatic metadata wins on key conflicts.
@@ -435,7 +435,7 @@ public String process(String input) {
435435
ctx.setMetrics(metrics);
436436
437437
// Attach metadata for audit
438-
ctx.setCommitMetadata(Map.of("request_id", "req-abc-123"));
438+
ctx.setCommitMetadata(Map.of("app_request_id", "req-abc-123"));
439439
440440
return chatModel.call(input);
441441
}

quickstart/getting-started-with-the-python-client.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ def process(text: str) -> str:
209209
)
210210

211211
# Attach metadata for audit
212-
ctx.commit_metadata = {"request_id": "req-abc-123"}
212+
ctx.commit_metadata = {"app_request_id": "req-abc-123"}
213213

214214
return call_llm(text)
215215
```

0 commit comments

Comments
 (0)