Commit b866592
fix: Propagate muted flag to :error telemetry events (#174)
Repo.insert!/2 with on_conflict: [set: [...]] only round-trips the
columns listed in the set clause (status, last_occurrence_at). As a
result, the returned %Error{} struct always carried muted: false — the
schema default — even when the DB row was muted.
upsert_error!/5 already fetches muted from the DB in a pre-query, but
never applied it to the in-memory struct before handing it to
Telemetry.new_error/1 and Telemetry.unresolved_error/1. This caused
subscribers of [:error_tracker, :error, :new] and
[:error_tracker, :error, :unresolved] to always see muted: false,
making it impossible to silence alerts for muted errors at the
telemetry level.
Fix: stamp the already-fetched muted value onto the struct right before
telemetry dispatch. No new queries, no public API change — the muted
field already exists on the Error schema, so existing subscribers start
receiving the correct value without any changes on their side.
Adds a regression test that mutes and resolves an error, re-triggers
it, and asserts the :unresolved payload carries muted: true.
Co-authored-by: Javier Segura <javier.segura@tamoe.es>1 parent 3fd3e10 commit b866592
2 files changed
Lines changed: 26 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
371 | 371 | | |
372 | 372 | | |
373 | 373 | | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
374 | 380 | | |
375 | 381 | | |
376 | 382 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
54 | 74 | | |
0 commit comments