Commit 08fbd6d
authored
[kernel-1116] rename capture session -> browser telemetry (#242)
## High Level Changes
- as per design `DELETE` endpoint is gone, stop telemetry is controlled
via setting all values to false ->
https://onkernel.slack.com/archives/C0B10F24TG9/p1778620560896099?thread_ts=1778586830.702399&cid=C0B10F24TG9
```
Endpoints:
- GET /telemetry — get current state (TelemetryState), 404 if not active
- PUT /telemetry — create/replace config (BrowserTelemetryConfig), returns 201 on start or 200 on replace
- PATCH /telemetry — update active config, 404 if not active
- POST /telemetry/events — publish an event into the bus
- GET /telemetry/stream — SSE stream of events, supports Last-Event-ID for resumption
Key schemas:
- BrowserTelemetryConfig — top-level config with a browser key → BrowserTelemetryCategoriesConfig
- BrowserTelemetryCategoriesConfig — four categories: console, network, page, interaction, each with { enabled: bool }
- Event — { ts, type, category, source, data, truncated }, category enum: console | network | page | interaction | system
- TelemetryState — { id, status (running|stopped), config, seq, created_at }
- PublishedEnvelope — { seq, event } — what the SSE stream and publish response return
```
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Moderate risk because it changes public API endpoints and refactors
the event pipeline to rely on new OpenAPI-generated types and a new
telemetry session lifecycle, which could impact event
delivery/compatibility.
>
> **Overview**
> Replaces the `capture_session` API and internal `capturesession`
package with a new **browser telemetry** model (`GET/PUT/PATCH
/telemetry`) where telemetry is stopped by setting all categories to
`enabled:false` (no DELETE endpoint).
>
> Renames/relocates event ingress and streaming to `POST
/telemetry/events` and `GET /telemetry/stream`, updates tests and e2e S2
storage coverage accordingly, and wires `cdpmonitor` to publish through
`TelemetrySession` (stamping `telemetry_session_id`).
>
> Refactors the event schema to use OpenAPI-generated types
(`TelemetryEventCategory`, `BrowserEventSource`, typed `data` payloads),
adds `page_lcp` as a distinct event, and updates
screenshot/lifecycle/computed events to emit typed payloads and
process-monotonic sequencing.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
381ffa4. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent 151a0d1 commit 08fbd6d
32 files changed
Lines changed: 7172 additions & 3968 deletions
File tree
- server
- cmd/api
- api
- e2e
- lib
- capturesession
- cdpmonitor
- events
- oapi
- telemetry
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
14 | 13 | | |
15 | 14 | | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
101 | | - | |
102 | | - | |
| 101 | + | |
| 102 | + | |
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
| |||
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
114 | | - | |
115 | | - | |
| 114 | + | |
| 115 | + | |
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
120 | | - | |
| 120 | + | |
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
124 | | - | |
125 | | - | |
| 124 | + | |
| 125 | + | |
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
| |||
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
134 | | - | |
| 134 | + | |
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
| |||
357 | 357 | | |
358 | 358 | | |
359 | 359 | | |
360 | | - | |
| 360 | + | |
361 | 361 | | |
362 | 362 | | |
363 | 363 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | 14 | | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
305 | 305 | | |
306 | 306 | | |
307 | 307 | | |
308 | | - | |
| 308 | + | |
309 | 309 | | |
310 | 310 | | |
311 | 311 | | |
312 | 312 | | |
313 | 313 | | |
314 | | - | |
| 314 | + | |
315 | 315 | | |
316 | 316 | | |
317 | | - | |
| 317 | + | |
318 | 318 | | |
319 | 319 | | |
320 | | - | |
321 | | - | |
| 320 | + | |
| 321 | + | |
322 | 322 | | |
323 | 323 | | |
324 | 324 | | |
| |||
This file was deleted.
0 commit comments