feat: add OpenTelemetry error reporting#13
Open
matheus1lva wants to merge 1 commit into
Open
Conversation
matheus1lva
force-pushed
the
feat/add-sentry
branch
from
June 18, 2026 15:55
77d999b to
9092b14
Compare
matheus1lva
force-pushed
the
feat/add-sentry
branch
from
June 18, 2026 15:57
9092b14 to
d0e977b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Report Worker errors as OpenTelemetry log records over OTLP/HTTP. Cloudflare Workers can't run the OpenTelemetry Node SDK (its OTLP exporter is Node-coupled), so the OTLP/HTTP log payload is built and sent directly via
fetch— still standard OTLP. Vendor-neutral: pointOTEL_EXPORTER_OTLP_ENDPOINT(andOTEL_EXPORTER_OTLP_HEADERSfor auth) at any OTLP backend. No-op until configured.How to review
src/observability.ts:captureError(ctx, env, error)POSTs an OTLPLogsDatapayload (ERROR severity,exception.*attributes) to${OTEL_EXPORTER_OTLP_ENDPOINT}/v1/logs. Auth headers come fromOTEL_EXPORTER_OTLP_HEADERS. Usesctx.waitUntilso the export completes after the response is returned — no added request latency.src/index.ts: the unexpected-error branch (non-ApiError, 500) callscaptureError;ApiError(expected 4xx) paths are unchanged.OTEL_*fields added to theEnvtype.Test plan
OTEL_EXPORTER_OTLP_ENDPOINT(+OTEL_EXPORTER_OTLP_HEADERS), trigger the 500 branch, confirm the log record reaches the backend.bun run test(33 tests) andbun run typecheck.Risk / impact
Low. With the OTLP endpoint unset (the default), reporting is a no-op and behavior is unchanged. No funds, auth, or migration paths touched.