Skip to content
This repository has been archived by the owner on Sep 8, 2023. It is now read-only.

Integrate Sentry monitoring without Remix SDK #312

Merged
merged 11 commits into from
Jun 27, 2022
Merged

Conversation

codingone21
Copy link
Contributor

@codingone21 codingone21 commented Jun 24, 2022

Implemented basic sentry monitoring system by checking 500 responses from the server. While this isn't ideal for tracing (every error will be found at handleRequest(..)), we can still monitor errors through events and breadcrumbs like so:

Screen Shot 2022-06-26 at 10 05 48 PM

Screen Shot 2022-06-26 at 10 08 28 PM

.

This is a simple and temporarily implementation as Remix SDK for Sentry is under development: getsentry/sentry-javascript#4894

@codingone21 codingone21 changed the title integrate sentry Integrate sentry monitoring without SDK Jun 27, 2022
@codingone21 codingone21 changed the title Integrate sentry monitoring without SDK Integrate Sentry monitoring without Remix SDK Jun 27, 2022
@codingone21 codingone21 requested a review from schpet June 27, 2022 02:22
Copy link
Contributor

@schpet schpet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for figuring this out! left some small suggestions but i don't have a ton of knowledge on this so i'll trust your judgement. were you able to get an event to show up in your sentry dashboard?

app/entry.client.tsx Outdated Show resolved Hide resolved
Sentry.init({
dsn: getRequiredGlobalEnvVar("SENTRY_DSN"),
tracesSampleRate: 0.3,
environment: getRequiredGlobalEnvVar("NODE_ENV"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this be changed to SENTRY_ENV ? this will allow me to separate staging and production events, which both use NODE_ENV=production

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean adding a SENTRY_ENV env var like so?

Sentry.init({
  dsn: getRequiredGlobalEnvVar("SENTRY_DSN"),
  tracesSampleRate: 0.3,
  environment: getRequiredGlobalEnvVar("SENTRY_ENV")

Do we already have SENTRY_ENV setup that differentiates 'staging'/'production'? I'm wondering why can't we just specify 'staging'/'production' in NODE_ENV?

Copy link
Contributor Author

@codingone21 codingone21 Jun 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For instance, using SENTRY_ENV='sentry' as a env var will look like this. This should work, but I don't know how to set this up for staging/prod
Screen Shot 2022-06-27 at 3 57 26 PM

app/root.tsx Outdated Show resolved Hide resolved
@schpet schpet marked this pull request as ready for review June 27, 2022 20:16
@schpet schpet linked an issue Jun 27, 2022 that may be closed by this pull request
@schpet schpet merged commit dc11272 into main Jun 27, 2022
@schpet schpet deleted the hannah/sentry-integration branch June 27, 2022 20:34
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Integrate Sentry Crash Reporting for Developer Doc
2 participants