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

Ignore errors that occur in temporary environments #168

Merged
merged 2 commits into from
Oct 27, 2020

Conversation

ChrisBAshton
Copy link
Contributor

We sometimes spin up temporary environments (e.g. 'test-pink-aws')
while developing applications. If there are errors in those apps,
we can accidentally send many thousands of errors to Sentry, which
can mean we hit rate limits on our other, production,
environments, as we have a single shared Sentry account.

This commit introduces a active_sentry_environments config
property, which is checked against the SENTRY_CURRENT_ENV ENV
variable. If an error occurs in an environment we care about,
it is reported to Sentry, otherwise it gets ignored.

There is prior art for this - in #160 we added a similar check,
such that if a particular error occurs during the nightly data
sync, it gets ignored. I've made sure this new functionality is
compatible with what's already been added.

Trello: https://trello.com/c/GfFwJG0K/2180-investigate-disabling-sentry-on-environments-we-dont-care-about-timebox-2-days

We sometimes spin up temporary environments (e.g. 'test-pink-aws')
while developing applications. If there are errors in those apps,
we can accidentally send many thousands of errors to Sentry, which
can mean we hit rate limits on our other, production,
environments, as we have a single shared Sentry account.

This commit introduces a `active_sentry_environments` config
property, which is checked against the SENTRY_CURRENT_ENV ENV
variable. If an error occurs in an environment we care about,
it is reported to Sentry, otherwise it gets ignored.

There is prior art for this - in #160 we added a similar check,
such that if a particular error occurs during the nightly data
sync, it gets ignored. I've made sure this new functionality is
compatible with what's already been added.

Trello: https://trello.com/c/GfFwJG0K/2180-investigate-disabling-sentry-on-environments-we-dont-care-about-timebox-2-days
@ChrisBAshton ChrisBAshton merged commit 10b006b into master Oct 27, 2020
@ChrisBAshton ChrisBAshton deleted the ignore-errors-in-temporary-environments branch October 27, 2020 10:36
ChrisBAshton added a commit that referenced this pull request Jun 8, 2021
The custom option `active_sentry_environments` was added in
#168.

However, it turns out there is already a native option for this:
`enabled_environments`. See
https://docs.sentry.io/platforms/ruby/configuration/options/

This allows us to simplify our code a fair bit.

I've also removed the stubbed `sending_allowed?` method as it was
interfering with some tests and giving a false sense of security.
We're now providing all of the necessary configuration for
the `Sentry::Configuration` instance to return `true` on its
`valid?` method, so no need for the hack.
Each config option is documented in an inline comment as otherwise
it can be quite obtuse.
ChrisBAshton added a commit that referenced this pull request Jun 8, 2021
The custom option `active_sentry_environments` was added in
#168.

However, it turns out there is already a native option for this:
`enabled_environments`. See
https://docs.sentry.io/platforms/ruby/configuration/options/

This allows us to simplify our code a fair bit.

I've also removed the stubbed `sending_allowed?` method as it was
interfering with some tests and giving a false sense of security.
We're now providing all of the necessary configuration for
the `Sentry::Configuration` instance to return `true` on its
`valid?` method, so no need for the hack.
Each config option is documented in an inline comment as otherwise
it can be quite obtuse.
ChrisBAshton added a commit that referenced this pull request Jun 8, 2021
The custom option `active_sentry_environments` was added in
#168.

However, it turns out there is already a native option for this:
`enabled_environments`. See
https://docs.sentry.io/platforms/ruby/configuration/options/

This allows us to simplify our code a fair bit.

I've also removed the stubbed `sending_allowed?` method as it was
interfering with some tests and giving a false sense of security.
We're now providing all of the necessary configuration for
the `Sentry::Configuration` instance to return `true` on its
`valid?` method, so no need for the hack.
Each config option is documented in an inline comment as otherwise
it can be quite obtuse.
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