Skip to content

Commit 4e210cd

Browse files
committed
Update docs
1 parent b9c7e66 commit 4e210cd

File tree

3 files changed

+41
-6
lines changed

3 files changed

+41
-6
lines changed

guides/Getting Started.md

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Open the generated migration and call the `up` and `down` functions on `ErrorTra
5656
defmodule MyApp.Repo.Migrations.AddErrorTracker do
5757
use Ecto.Migration
5858

59-
def up, do: ErrorTracker.Migration.up(version: 4)
59+
def up, do: ErrorTracker.Migration.up(version: 5)
6060

6161
# We specify `version: 1` in `down`, to ensure we remove all migrations.
6262
def down, do: ErrorTracker.Migration.down(version: 1)
@@ -152,9 +152,27 @@ environments where you may want to prune old errors that have been resolved.
152152
The `ErrorTracker.Plugins.Pruner` module provides automatic pruning functionality with a configurable
153153
interval and error age.
154154

155-
## Ignoring errors
155+
## Ignoring and Muting Errors
156+
157+
ErrorTracker provides two different ways to silence errors:
158+
159+
### Ignoring Errors
156160

157161
ErrorTracker tracks every error by default. In certain cases some errors may be expected or just not interesting to track.
158-
ErrorTracker provides functionality that allows you to ignore errors based on their attributes and context.
162+
The `ErrorTracker.Ignorer` behaviour allows you to ignore errors based on their attributes and context.
163+
164+
When an error is ignored, its occurrences are not tracked at all. This is useful for expected errors that you don't want to store in your database.
165+
166+
### Muting Errors
167+
168+
Sometimes you may want to keep tracking error occurrences but avoid receiving notifications about them. For these cases,
169+
ErrorTracker allows you to mute specific errors.
170+
171+
When an error is muted:
172+
- New occurrences are still tracked and stored in the database
173+
- No telemetry events are emitted for new occurrences
174+
- You can still see the error and its occurrences in the web UI
175+
176+
This is particularly useful for noisy errors that you want to keep tracking but don't want to receive notifications about.
159177

160-
Take a look at the `ErrorTracker.Ignorer` behaviour for more information about how to implement your own ignorer.
178+
You can mute and unmute errors manually through the web UI or programmatically using the `ErrorTracker.mute/1` and `ErrorTracker.unmute/1` functions.

lib/error_tracker.ex

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,15 @@ defmodule ErrorTracker do
177177
end
178178

179179
@doc """
180-
Mutes the error so next ocurrences won't send telemetry events.
180+
Mutes the error so new occurrences won't send telemetry events.
181+
182+
When an error is muted:
183+
- New occurrences are still tracked and stored in the database
184+
- No telemetry events are emitted for new occurrences
185+
- You can still see the error and its occurrences in the web UI
186+
187+
This is useful for noisy errors that you want to keep tracking but don't want to
188+
receive notifications about.
181189
"""
182190
@spec mute(Error.t()) :: {:ok, Error.t()} | {:error, Ecto.Changeset.t()}
183191
def mute(error = %Error{}) do
@@ -187,7 +195,10 @@ defmodule ErrorTracker do
187195
end
188196

189197
@doc """
190-
Unmutes the error so next ocurrences will send telemetry events.
198+
Unmutes the error so new occurrences will send telemetry events again.
199+
200+
This reverses the effect of `mute/1`, allowing telemetry events to be emitted
201+
for new occurrences of this error again.
191202
"""
192203
@spec unmute(Error.t()) :: {:ok, Error.t()} | {:error, Ecto.Changeset.t()}
193204
def unmute(error = %Error{}) do

lib/error_tracker/ignorer.ex

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@ defmodule ErrorTracker.Ignorer do
22
@moduledoc """
33
Behaviour for ignoring errors.
44
5+
> #### Ignoring vs muting errors {: .info}
6+
>
7+
> Ignoring an error keeps it from being tracked by the ErrorTracker. While this may be useful in
8+
> certain cases, in other cases you may prefer to track the error but don't send telemetry events.
9+
> Take a look at the `ErrorTracker.mute/1` function to see how to mute errors.
10+
511
The ErrorTracker tracks every error that happens in your application. In certain cases you may
612
want to ignore some errors and don't track them. To do so you can implement this behaviour.
713

0 commit comments

Comments
 (0)