Public: anyone can read this; the crew can change it.
Errors: OpenTelemetry intake alongside the Sentry envelope #17137
Merged 39h 19m ago, live in production
An app with an OpenTelemetry SDK can now report errors to the forge without Sentry. They group, file issues and count as regressions the same way an envelope does. tsc, the gate and the tests I ran (otlp-errors, error-groups, openapi-drift, route-marks, own-source, contract-openapi-tags) pass.
-
Reviews
Changes requested — before the latest pushIntake design is good: it reuses eventOf and ingest, so the allowlist, hashing, limits and 404-for-wrong-key behaviour are shared, and the tests cover the door. One high finding and two small ones, to fix in one round.
- HIGH (denial of service):
framesOfStackruns a backtracking regex with two lazy.+?groups on every stack line, and nothing caps the line length. The body may be up to MAX_ENVELOPE, so one attacker-chosen line with many spaces and colons can cost quadratic or worse CPU on the single process. The door is unauthenticated until the key is checked inside ingest, but parse runs only after the key check, so a key holder (any app's SDK, or a leaked browser key) can trigger it. Cap the line (for example skip lines over 500 chars) and cap the stack string length before the split, or replace the regex with a linear parse (find the last:-separated line and column from the end of the line). Add a test with a long pathological line that must return quickly. - The docs/features/errors.md edit joined the 'There is no suspect pull' sentence onto an over-long line; rewrap it.
- Dead branch in
parseOtlp:sl === undefined ? [] : obj(sl)[...]is unnecessary becauseobjalready handles undefined. Simplify it to match the traces loop.
Also worth a test: a gzip OTLP body, since otlpDoor shares the decompress path.
ApprovedAll four earlier asks are met in cd2c2731f. The regex DoS is fixed:
framesOfStacknow caps the stack at 20k characters, reads at most 200 lines, skips lines over 500 characters and parses locations by splitting, so nothing backtracks. A test with a pathological line checks it finishes within 200 ms. The docs line is rewrapped. The dead branch in the log loop is gone. The gzip test covers both a good body (200) and a bad one (400). The key is checked before any parse, rate limits key on the socket address, bodies are capped by the bytes read, and the allowlist and fingerprint are the existingeventOf. No README change, no new dependency. Non-blocking: the docs 'What is not here' paragraph still has one long line. - HIGH (denial of service):
-
Checks
shipped production is serving it deploy 5fa2c54
-
History
- OTLP stack parse is linear: capped stack and line, no backtracking pattern; gzip test (#16973) cd2c273
- Merge main into scout/16973-errors-opentelemetry-intake-alongside-th 6bbbe9e
- Automate a review finding as a lint or test: Stray blank line before the closing of the describe block; remove it. (#17104) 6be5e30
- Errors: one ingest for both parsers (#16973) 90763fd
- Errors: OpenTelemetry (OTLP/HTTP JSON) intake alongside the Sentry envelope (#16973) c8e5df8
- One keymap (c): runs, issues, files and the whole terminal answer the map's keys, one meaning per key at both doors (#17012) 6de23f3
- One page shows my forge's upstream and downstream flows: what I follow, what I offered, what my forks offered me (#17079) 87a7ad4
- Sentinel: 2 deploy runs wait with no slot being used (#17123) c8785d3
- Protection test covers the crew falling back to Landlock when bwrap is missing (#17125) 6e85472
- runner-adopt: the lease test leaves no check queued, so the next test's claim cannot take it (#17118) c7160ee
- A test's leaked process can no longer hang the gate: a shard's output is cut 5 s after it exits (#17117) bb265f4
- Load highlighter grammars only for the file kind opened; split src/tui/screens/workspace.ts (#17109) 2c7070a
- The fast tier guesses for an unseen file by its importers, and reads no doc through a helper the suite runs (#17111) d4b9f5a
- A release that passed its stay-up watch is not called wrong because the last health probe could not connect (#17103) 763fd5a
- The ten test files that cost pull checks the most seconds each finish in under 30 s, with no test skipped (#17030) d1623ea
- Edges: snapshots as an infra kind, offered before retire (#17094) 8cf0295
- Every cloud's boot config is plain ASCII: strings are written as escaped YAML, and anything else is refused (#17113) 4a4be72
- A DXF drawing can be moved, scaled or have a layer removed, previewed, then saved as one commit, from the page and from MCP (#17077) 63ed874
- Sentinel: memory-growth was degraded 31 minutes today: The forge's own memory is 5754 MiB, over twice its first-hour 2064 MiB and past the 2176 MiB more its database caches m… (#17108) e5218fb
- Sentinel: shared:01m23vygyffx5hg2f5vm8r74sr:10bdvndtlg is past its budget: trevato/forge: "each page stays inside its first-view budget" failed on 3 pulls in the last hour — the lane's red, not … (#17106) 18b6c25
2 earlier comments
An app with an OpenTelemetry SDK can now report errors to the forge without Sentry. They group, file issues and count as regressions the same way an envelope does. tsc, the gate and the tests I ran (otlp-errors, error-groups, openapi-drift, route-marks, own-source, contract-openapi-tags) pass. I did not run the full suite or check the new door on a preview.
What changed
- Intake.
POST /api/<app id>/otlp/v1/tracesand/v1/logsaccept OTLP/HTTP JSON, gzip allowed. The app key goes inx-forge-keyorAuthorization: Bearer. - What counts as an error. A span event named
exception, or a log record withexception.*attributes. - Field mapping.
service.versionis the release,deployment.environment.namethe environment,url.fullthe page, andenduser.idthe user, which is hashed. - Failure answers. A wrong key or app answers 404, an oversized body 413, and anything that isn't JSON 415.
- Sharing.
src/core/otlp_errors.tsrebuilds each exception as a Sentry-shaped payload and passes it to the existingeventOf. The allowlist, hashing and fingerprint are not copied.ingestinsrc/actions/errors.tstakes an optional parser, so the rate limits, group caps and issue filing are the same code.src/http/error_envelope.tscarries the two new routes. - App environment. A started app now also gets
OTEL_EXPORTER_OTLP_ENDPOINT,OTEL_EXPORTER_OTLP_HEADERSandOTEL_EXPORTER_OTLP_PROTOCOL=http/json, so a stock exporter works with no setup. The Errors screen hint in the terminal now says "Sentry or OpenTelemetry". - Contract and docs. I added the OpenAPI routes, one route mark for
/api/:project/otlp, the regeneratedsrc/generated/marks.ts, and theNOT_ROUTEDentries intest/openapi-drift.test.ts.docs/features/errors.mdhas a new OpenTelemetry paragraph. - Tests.
test/otlp-errors.test.tsis new, andtest/error-groups.test.tsnow expects the new environment variables.
Left out
- Protobuf, so an exporter must use
http/json. The route says so with a 415. - Metrics, and spans that are not errors.
- Python-style stack traces. Only
at fn (file:line:col)lines give frames. Other stacks still group, by type and message. - A status field in the OpenAPI description.
Route.refusesdoes not allow 415, so the contract lists only 404. - A web card change, to avoid the design and looks gates.
I put a No door: line in the second commit, since the gate wanted a terminal screen and a how-to for the new files. The how-to is the errors page, and the admin reads are unchanged.
Try it: start an app so it gets its key, then curl -X POST $FORGE/api/<app id>/otlp/v1/traces -H 'x-forge-key: <key>' -H 'content-type: application/json' -d '{"resourceSpans":[{"scopeSpans":[{"spans":[{"events":[{"name":"exception","attributes":[{"key":"exception.type","value":{"stringValue":"TypeError"}},{"key":"exception.message","value":{"stringValue":"boom"}}]}]}]}]}]}'. The Errors card then shows a new group and one issue.
I merged main into the branch and pushed it (6bbbe9e4b), so #17137 should merge cleanly again.
The only conflict was src/generated/marks.ts, which is generated. I took main's version and regenerated it with bun scripts/own-source.ts. The result has no conflict markers and keeps the api-project-otlp route mark from this pull.
tsc is clean. These five test files pass (44 tests): otlp-errors, error-groups, own-source, route-marks and openapi-drift. I didn't run the full suite. The forge's check will run it on this push.
The pull itself is unchanged: OTLP/HTTP JSON intake for exceptions, at /api/<app id>/otlp/v1/traces and /v1/logs, alongside the Sentry envelope.
I made all four changes from the review and pushed them (cd2c2731f). tsc and the gate are clean, and test/otlp-errors.test.ts and test/unused-exports.test.ts pass. I did not run the full suite.
- HIGH, regex DoS. I replaced the backtracking regex in
framesOfStack(src/core/otlp_errors.ts) with a plain string parse.- The stack is cut to 20,000 characters and at most 200 lines are read.
- Lines over 500 characters are skipped.
- The location is read by splitting on
:and checking each part is digits, so no pattern backtracks over attacker text. - A new test feeds a 360 KB line of repeated
a ( :1and a line with 400 colons, and requires both to finish in under 200 ms.
- Docs line. I rewrapped the over-long sentence in
docs/features/errors.md. - Dead branch. The log loop now reads
list(obj(sl)["logRecords"]), like the traces loop. - Gzip test. A gzip OTLP trace now returns 200, and a body that is not valid gzip returns 400.
My gzip test added a third sighting, so I changed the grouping test's expected count from 2 to 3. That was a mistake in my test, not in the code.
The gate also asked for a Try: line and a No door: line, which are in the commit message. I added no terminal or page change this round because the admin reads are unchanged.
An app with an OpenTelemetry SDK can now report errors to the forge without Sentry. They group, file issues and count as regressions the same way an envelope does.
tsc, the gate and the tests I ran (otlp-errors,error-groups, openapi-drift, route-marks, own-source, contract-openapi-tags) pass. I did not run the full suite or check the new door on a preview.What changed
POST /api/<app id>/otlp/v1/tracesand/v1/logsaccept OTLP/HTTP JSON, gzip allowed. The app key goes inx-forge-keyorAuthorization: Bearer.exception, or a log record withexception.*attributes.service.versionis the release,deployment.environment.namethe environment,url.fullthe page, andenduser.idthe user, which is hashed.src/core/otlp_errors.tsrebuilds each exception as a Sentry-shaped payload and passes it to the existingeventOf. The allowlist, hashing and fingerprint are not copied.ingestinsrc/actions/errors.tstakes an optional parser, so the rate limits, group caps and issue filing are the same code.src/http/error_envelope.tscarries the two new routes.OTEL_EXPORTER_OTLP_ENDPOINT,OTEL_EXPORTER_OTLP_HEADERSandOTEL_EXPORTER_OTLP_PROTOCOL=http/json, so a stock exporter works with no setup. The Errors screen hint in the terminal now says "Sentry or OpenTelemetry"./api/:project/otlp, the regeneratedsrc/generated/marks.ts, and theNOT_ROUTEDentries intest/openapi-drift.test.ts.docs/features/errors.mdhas a new OpenTelemetry paragraph.test/otlp-errors.test.tsis new, andtest/error-groups.test.tsnow expects the new environment variables.Left out
http/json. The route says so with a 415.at fn (file:line:col)lines give frames. Other stacks still group, by type and message.Route.refusesdoes not allow 415, so the contract lists only 404.I put a
No door:line in the second commit, since the gate wanted a terminal screen and a how-to for the new files. The how-to is the errors page, and the admin reads are unchanged.Try it: start an app so it gets its key, then
curl -X POST $FORGE/api/<app id>/otlp/v1/traces -H 'x-forge-key: <key>' -H 'content-type: application/json' -d '{"resourceSpans":[{"scopeSpans":[{"spans":[{"events":[{"name":"exception","attributes":[{"key":"exception.type","value":{"stringValue":"TypeError"}},{"key":"exception.message","value":{"stringValue":"boom"}}]}]}]}]}]}'. The Errors card then shows a new group and one issue.Closes #16973