add audit metric
This commit is contained in:
parent
7eec31f837
commit
cb1ecf8886
|
|
@ -123,11 +123,13 @@ func (c *Client) createAuditEntry(ss *sessions.SessionState, appURL string, tena
|
|||
auditMessage, err := json.Marshal(auditObject)
|
||||
if err != nil {
|
||||
logger.Errorf("%s: could not marshal the audit object: %v", ErrPersitAuditEvent.Error(), err)
|
||||
AuditErrorMetricCounter.Inc()
|
||||
return
|
||||
}
|
||||
err = c.send(string(auditMessage))
|
||||
if err != nil {
|
||||
logger.Errorf("%s: could not send the audit message to the url '%s': %v", ErrPersitAuditEvent.Error(), c.opts.URL, err)
|
||||
AuditErrorMetricCounter.Inc()
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,11 @@
|
|||
package audit
|
||||
|
||||
import (
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/prometheus/client_golang/prometheus/promauto"
|
||||
)
|
||||
|
||||
var AuditErrorMetricCounter = promauto.NewCounter(prometheus.CounterOpts{
|
||||
Name: "oauth2_proxy_audit_errors_requests_total",
|
||||
Help: "Total number of failed audit requests.",
|
||||
})
|
||||
Loading…
Reference in New Issue