Skip to content

feat(sentry): convert breadcrumbs to Hawk format - #593

Open
MrFallen wants to merge 1 commit into
codex-team:masterfrom
MrFallen:feat/sentry-breadcrumbs
Open

MrFallen wants to merge 1 commit into
codex-team:masterfrom
MrFallen:feat/sentry-breadcrumbs

Conversation

@MrFallen

Copy link
Copy Markdown

What

Sentry events now carry their breadcrumbs into Hawk's native payload.breadcrumbs field, so they are rendered by the Breadcrumbs block in Garage like the ones from @hawk.so/javascript.

Breadcrumbs were removed from the Sentry worker in #406 because they landed in addons as raw JSON, with the note that Hawk should support them first. Hawk now does: EventData.breadcrumbs exists in @hawk.so/types, Garage renders it, and the grouper already sanitizes message and data of every breadcrumb. This PR does not bring back the raw addon: breadcrumbs are still excluded from addons.sentry.

How

composeBreadcrumbs() in workers/sentry/src/utils/converter.ts:

  • reads both shapes SDKs send: a plain array (JavaScript) and { values: [...] } (Python, PHP);
  • converts the timestamp to Unix milliseconds: Sentry sends Unix seconds with a fraction or an RFC 3339 string. A breadcrumb without its own timestamp gets the event timestamp; if there is none either, the breadcrumb is skipped, because Breadcrumb.timestamp is required;
  • maps Sentry breadcrumb types to the ones Garage knows: http/query → request, ui/user → ui, transaction → logic, debug/info → default; navigation, error and default stay as they are, unknown types pass through unchanged (Garage shows them as default);
  • keeps category, message, level and object data as they are.

The number of breadcrumbs is left to the SDK (max_breadcrumbs, 100 by default in Sentry SDKs); the worker does not truncate them.

Tests

  • converter.test.ts: array and { values } shapes, seconds and RFC 3339 timestamps, fallback to the event timestamp, skipping without a timestamp, type mapping, unknown types, missing breadcrumbs.
  • index.test.ts: an envelope with a PHP/Python-style { values } payload ends up in payload.breadcrumbs and not in addons.sentry.

yarn test:sentry: 50 passed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant