Skip to content

Commit

Permalink
Silence Prometheus when testing (#5486)
Browse files Browse the repository at this point in the history
**Story card:**
[sc-14065](https://app.shortcut.com/simpledotorg/story/14065/stop-incessant-prometheus-log-failures)

## Because

It's noisy, and clouds meaningful logs

## This addresses

Prometheus logging while testing

## Test instructions

Run a test and check you don't see logs like

```
2024-11-11T13:07:08.314425+00:00 app[web.1]: App 152 output: E, [2024-11-11T13:07:08.314216 #152] ERROR -- : Prometheus Exporter, failed to send message Connection refused - connect(2) for "localhost" port 9394
2024-11-11T13:07:08.814773+00:00 app[web.1]: App 152 output: E, [2024-11-11T13:07:08.814580 #152] ERROR -- : Prometheus Exporter, failed to send message Connection refused - connect(2) for "localhost" port 9394
```
  • Loading branch information
igbanam authored Nov 19, 2024
1 parent 7910e3a commit 8ddb9dc
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/metrics.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def benchmark_and_summary(event, labels = {}, description = nil, &block)
private

def record_metric(type, event, count, labels = {}, description = nil)
return if Rails.env.test?
Prometheus
.instance
.register(type, event, description)
Expand Down

0 comments on commit 8ddb9dc

Please sign in to comment.