fix(lib): record challenges issused over embedded HTML (#543)
Closes #531 This changes `anubis_challenges_issued` to be a vector counter that records the challenge issuance method. Signed-off-by: Xe Iaso <me@xeiaso.net>
This commit is contained in:
parent
6f08bcb481
commit
555a188dc3
3 changed files with 5 additions and 3 deletions
|
|
@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
- Record if challenges were issued via the API or via embedded JSON in the challenge page HTML ([#531](https://github.com/TecharoHQ/anubis/issues/531))
|
||||||
- Ensure that clients that are shown a challenge support storing cookies
|
- Ensure that clients that are shown a challenge support storing cookies
|
||||||
- Encode challenge pages with gzip level 1
|
- Encode challenge pages with gzip level 1
|
||||||
- Add `check-spelling` for spell checking
|
- Add `check-spelling` for spell checking
|
||||||
|
|
|
||||||
|
|
@ -31,10 +31,10 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
challengesIssued = promauto.NewCounter(prometheus.CounterOpts{
|
challengesIssued = promauto.NewCounterVec(prometheus.CounterOpts{
|
||||||
Name: "anubis_challenges_issued",
|
Name: "anubis_challenges_issued",
|
||||||
Help: "The total number of challenges issued",
|
Help: "The total number of challenges issued",
|
||||||
})
|
}, []string{"method"})
|
||||||
|
|
||||||
challengesValidated = promauto.NewCounter(prometheus.CounterOpts{
|
challengesValidated = promauto.NewCounter(prometheus.CounterOpts{
|
||||||
Name: "anubis_challenges_validated",
|
Name: "anubis_challenges_validated",
|
||||||
|
|
@ -260,7 +260,7 @@ func (s *Server) MakeChallenge(w http.ResponseWriter, r *http.Request) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
lg.Debug("made challenge", "challenge", challenge, "rules", rule.Challenge, "cr", cr)
|
lg.Debug("made challenge", "challenge", challenge, "rules", rule.Challenge, "cr", cr)
|
||||||
challengesIssued.Inc()
|
challengesIssued.WithLabelValues("api").Inc()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) PassChallenge(w http.ResponseWriter, r *http.Request) {
|
func (s *Server) PassChallenge(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
|
||||||
|
|
@ -73,6 +73,7 @@ func (s *Server) RenderIndex(w http.ResponseWriter, r *http.Request, rule *polic
|
||||||
s.respondWithError(w, r, "Client Error: Please ensure your browser is up to date and try again later.")
|
s.respondWithError(w, r, "Client Error: Please ensure your browser is up to date and try again later.")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
challengesIssued.WithLabelValues("embedded").Add(1)
|
||||||
challenge := s.challengeFor(r, rule.Challenge.Difficulty)
|
challenge := s.challengeFor(r, rule.Challenge.Difficulty)
|
||||||
|
|
||||||
var ogTags map[string]string = nil
|
var ogTags map[string]string = nil
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue