Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore (sync service): setup sentry #2099

Merged
merged 8 commits into from
Dec 5, 2024
Merged

chore (sync service): setup sentry #2099

merged 8 commits into from
Dec 5, 2024

Conversation

kevin-dp
Copy link
Contributor

@kevin-dp kevin-dp commented Dec 5, 2024

This PR configures Electric to track errors with sentry.
To enable sentry for the single tenant Electric app you need to pass a SENTRY_DSN env var.

I've tested this with the cloud deploy and errors are tracked successfully in sentry.

TODO:

  • add stack_id and request_id meta data to the recorded error events (*)

(*) The easy way is to configure sentry to add the stack_id and request_id meta data to the event context. That way it will show up in the error's details but it won't be searchable filterable on those fields! So a better way would be to add that meta data as tags. But not sure if that is configurable out of the box, might need to write a custom LoggerHandler.

Adding the meta data as tags is possible by extending all Logger.metadata calls (from @icehaunter's recent PR) with a sentry: [tags: %{stack_id: stack_id, shape_handle: shape_handle}] key. Cf. https://github.com/getsentry/sentry-elixir/blob/master/lib/sentry/logger_handler.ex#L205 for more info.

Copy link

netlify bot commented Dec 5, 2024

Deploy Preview for electric-next ready!

Name Link
🔨 Latest commit b3e3e93
🔍 Latest deploy log https://app.netlify.com/sites/electric-next/deploys/67515e9374d68a0008f92545
😎 Deploy Preview https://deploy-preview-2099--electric-next.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

packages/sync-service/config/runtime.exs Outdated Show resolved Hide resolved
packages/sync-service/config/runtime.exs Outdated Show resolved Hide resolved
packages/sync-service/lib/electric/telemetry/sentry.ex Outdated Show resolved Hide resolved
@kevin-dp kevin-dp requested a review from icehaunter December 5, 2024 14:23
@kevin-dp kevin-dp merged commit 95b61e7 into main Dec 5, 2024
8 checks passed
@kevin-dp kevin-dp deleted the kevin/setup-sentry branch December 5, 2024 14:52
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.

2 participants