feat(browser): OTel logs pipeline, MapleBrowser.logger and per-session trace sampling - #1145
Merged
Merged
Maple Review Bot / Maple / review
completed
Sep 29, 2026 in 10m 36s
Confidence 3/5 · No issues found
Confidence 3/5 · needs attention
quality 100/100 · no findings · tests covered · risk medium · 2/2 new units observable
Warning
This review ended early; what follows is what it established.
Adds an OTel logs pipeline behind MapleBrowser.logger, per-session trace sampling (tracing.sampleRate) with ot=th;rv on sampled roots, and reports a failure inside an unsampled traced() as its own kept error span. No defect found; safe to merge.
MapleBrowser.loggerqueues records and exports them to OTLP/v1/logsSessionSamplerdecides per session and stampsot=th;rvon sampled rootstraced()reports an unsampled failure throughcaptureException- New
tracing.sampleRate, clamped by the sharedresolveSampleRate
What was checked
- Weight math: ingest
SAMPLE_RATE_EXPRright-padsthto 16 digits, so stripping trailing zeros keeps the weight exact (datasources.ts:150,sampling.ts:46) keepContextonly drops an unsampled parent, so a kept error is a weight-1 root (sampling.ts:20,deferred/logs.ts:17)- Consent: records dropped at emit and filtered again at export by
consentAllowedSince(logs.ts:40,deferred/logs.ts:23)
Observability coverage: 2 of 2 changes observable
| Change | Kind | Observable | Evidence |
|---|---|---|---|
browser logs export (emitLog → OTLP /v1/logs) |
outbound OTLP HTTP export | yes | OTLPLogExporter + resourceAttributes(); records carry session.id/user.id and the emitting span's context (deferred/logs.ts:44-68) |
per-session trace sampling (SessionSampler) |
head sampling | yes | sampled roots set ot=th:…;rv:… and inherit to children, which is what the ingest SampleRate column reads (sampling.ts:85) |
43a9cc9 · Updated on every push. Reply "won't fix" to dismiss a finding, or mention @maple to ask about one.
Loading