Search code examples
elixirsentry

Sentry.io with Elixir applications--limit noise


I am looking for a way to limit the number of issues that are raised in our production environment. The problem we are seeing is that so many issues get raised that we regularly hit our upper limit on monthly event reporting. Then we have to either turn it off entirely or pay more money.

I'm using this client and have it configured to run in the :prod env with this configuration in config/config.exs:

config :sentry,
  dsn: "https://[email protected]/1240796",
  environment_name: Mix.env,
  enable_source_code_context: true,
  root_source_code_path: File.cwd!(),
  tags: %{
    env: "prod"
  },
  included_environments: [:prod]

One idea that comes to mind is simply pulling :prod out of the included_environments list in that last line the configuration. However, this effectively eliminates any usefulness of Sentry until we realize we're getting errors, then add :prod back to that list and restart the application. Not the best use of this tool.

I'm wondering if perhaps there is a Sentry side solution for this issue--I can't believe that no one else has wrestled with it.

I'm not losing any sleep over events that we have explicitly sent to Sentry with Sentry.capture_exception() or Sentry.capture_message().

So to wrap this question up, what I'm hoping someone will be able to provide the following things:

  1. Any suggestions on how to do this via the application.
  2. Any suggestions of how to do this via Sentry itself.

Thanks!


Solution

  • The Sentry Elixir client gives you the option to add a Filter module. This module can determine for each error whether it should be filtered or not.

    See: https://hexdocs.pm/sentry/Sentry.html#module-filtering-exceptions