...

Source file src/github.com/letsencrypt/boulder/wfe2/stats.go

Documentation: github.com/letsencrypt/boulder/wfe2

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

View as plain text