Skip to content

Commit

Permalink
fix: use collectDefaultMetrics option (#7)
Browse files Browse the repository at this point in the history
For apps that make heavy use of prometheus metrics, it may be possible that the default metrics are already registered and managed and configured separately. This is the case in lodestar.

Feature to disable default metrics
  • Loading branch information
wemeetagain authored Nov 22, 2022
1 parent 4bb88c1 commit 3e4f00c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class PrometheusMetrics implements Metrics {
;(this.registry ?? register).clear()
}

if (init?.preserveExistingMetrics !== false) {
if (init?.collectDefaultMetrics !== false) {
log('Collecting default metrics')
collectDefaultMetrics({ ...init?.defaultMetrics, register: this.registry ?? init?.defaultMetrics?.register })
}
Expand Down

0 comments on commit 3e4f00c

Please sign in to comment.