Skip to content

Commit bdb9cda

Browse files
authored
Use promauto to register stats in bdns (#8480)
This was accidentally deleted along with the idMismatchCounter in #8445. This is an alternative approach to #8474, and perhaps a reasonable default pattern for all stats registration in Boulder. For more on promauto, see its documentation: https://pkg.go.dev/github.com/prometheus/[email protected]/prometheus/promauto
1 parent 8a445fa commit bdb9cda

File tree

3 files changed

+381
-3
lines changed

3 files changed

+381
-3
lines changed

bdns/dns.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import (
1818
"github.com/jmhodges/clock"
1919
"github.com/miekg/dns"
2020
"github.com/prometheus/client_golang/prometheus"
21+
"github.com/prometheus/client_golang/prometheus/promauto"
2122

2223
"github.com/letsencrypt/boulder/iana"
2324
blog "github.com/letsencrypt/boulder/log"
@@ -92,23 +93,23 @@ func New(
9293
userAgent: userAgent,
9394
}
9495

95-
queryTime := prometheus.NewHistogramVec(
96+
queryTime := promauto.With(stats).NewHistogramVec(
9697
prometheus.HistogramOpts{
9798
Name: "dns_query_time",
9899
Help: "Time taken to perform a DNS query",
99100
Buckets: metrics.InternetFacingBuckets,
100101
},
101102
[]string{"qtype", "result", "resolver"},
102103
)
103-
totalLookupTime := prometheus.NewHistogramVec(
104+
totalLookupTime := promauto.With(stats).NewHistogramVec(
104105
prometheus.HistogramOpts{
105106
Name: "dns_total_lookup_time",
106107
Help: "Time taken to perform a DNS lookup, including all retried queries",
107108
Buckets: metrics.InternetFacingBuckets,
108109
},
109110
[]string{"qtype", "result", "retries", "resolver"},
110111
)
111-
timeoutCounter := prometheus.NewCounterVec(
112+
timeoutCounter := promauto.With(stats).NewCounterVec(
112113
prometheus.CounterOpts{
113114
Name: "dns_timeout",
114115
Help: "Counter of various types of DNS query timeouts",

0 commit comments

Comments
 (0)