github.com/letsencrypt/boulder@v0.20251208.0/wfe2/stats.go (about) 1 package wfe2 2 3 import ( 4 "github.com/prometheus/client_golang/prometheus" 5 "github.com/prometheus/client_golang/prometheus/promauto" 6 ) 7 8 type wfe2Stats struct { 9 // httpErrorCount counts client errors at the HTTP level 10 // e.g. failure to provide a Content-Length header, no POST body, etc 11 httpErrorCount *prometheus.CounterVec 12 // joseErrorCount counts client errors at the JOSE level 13 // e.g. bad JWS, broken JWS signature, invalid JWK, etc 14 joseErrorCount *prometheus.CounterVec 15 // csrSignatureAlgs counts the signature algorithms in use for order 16 // finalization CSRs 17 csrSignatureAlgs *prometheus.CounterVec 18 // improperECFieldLengths counts the number of ACME account EC JWKs we see 19 // with improper X and Y lengths for their curve 20 improperECFieldLengths prometheus.Counter 21 // nonceNoMatchingBackendCount counts the number of times we've received a nonce 22 // with a prefix that doesn't match a known backend. 23 nonceNoMatchingBackendCount prometheus.Counter 24 // ariReplacementOrders counts the number of new order requests that replace 25 // an existing order, labeled by: 26 // - isReplacement=[true|false] 27 // - limitsExempt=[true|false] 28 ariReplacementOrders *prometheus.CounterVec 29 } 30 31 func initStats(stats prometheus.Registerer) wfe2Stats { 32 httpErrorCount := promauto.With(stats).NewCounterVec(prometheus.CounterOpts{ 33 Name: "http_errors", 34 Help: "client request errors at the HTTP level", 35 }, []string{"type"}) 36 37 joseErrorCount := promauto.With(stats).NewCounterVec(prometheus.CounterOpts{ 38 Name: "jose_errors", 39 Help: "client request errors at the JOSE level", 40 }, []string{"type"}) 41 42 csrSignatureAlgs := promauto.With(stats).NewCounterVec(prometheus.CounterOpts{ 43 Name: "csr_signature_algs", 44 Help: "Number of CSR signatures by algorithm", 45 }, []string{"type"}) 46 47 improperECFieldLengths := promauto.With(stats).NewCounter(prometheus.CounterOpts{ 48 Name: "improper_ec_field_lengths", 49 Help: "Number of account EC keys with improper X and Y lengths", 50 }) 51 52 nonceNoBackendCount := promauto.With(stats).NewCounter(prometheus.CounterOpts{ 53 Name: "nonce_no_backend_found", 54 Help: "Number of times we've received a nonce with a prefix that doesn't match a known backend", 55 }) 56 57 ariReplacementOrders := promauto.With(stats).NewCounterVec(prometheus.CounterOpts{ 58 Name: "ari_replacements", 59 Help: "Number of new order requests that replace an existing order, labeled isReplacement=[true|false], limitsExempt=[true|false]", 60 }, []string{"isReplacement", "limitsExempt"}) 61 62 return wfe2Stats{ 63 httpErrorCount: httpErrorCount, 64 joseErrorCount: joseErrorCount, 65 csrSignatureAlgs: csrSignatureAlgs, 66 improperECFieldLengths: improperECFieldLengths, 67 nonceNoMatchingBackendCount: nonceNoBackendCount, 68 ariReplacementOrders: ariReplacementOrders, 69 } 70 }