renamed webhook-related instrumentation

pull/1690/head
Panagiotis Siatras 4 months ago
parent 49e1170fae
commit ecf2da63cf
No known key found for this signature in database

@ -11,11 +11,11 @@ type Meter interface {
// X509Rekeyed is called whenever an X509 certificate is rekeyed.
X509Rekeyed(provisioner string, success bool)
// X509Authorized is called whenever an X509 authoring webhook is called.
X509Authorized(provisioner string, success bool)
// X509WebhookAuthorized is called whenever an X509 authoring webhook is called.
X509WebhookAuthorized(provisioner string, success bool)
// X509Enriched is called whenever an X509 enriching webhook is called.
X509Enriched(provisioner string, success bool)
// X509WebhookEnriched is called whenever an X509 enriching webhook is called.
X509WebhookEnriched(provisioner string, success bool)
// SSHSigned is called whenever an SSH certificate is signed.
SSHSigned(provisioner string, success bool)
@ -26,11 +26,11 @@ type Meter interface {
// SSHRekeyed is called whenever an SSH certificate is rekeyed.
SSHRekeyed(provisioner string, success bool)
// SSHAuthorized is called whenever an SSH authoring webhook is called.
SSHAuthorized(provisioner string, success bool)
// SSHWebhookAuthorized is called whenever an SSH authoring webhook is called.
SSHWebhookAuthorized(provisioner string, success bool)
// SSHEnriched is called whenever an SSH enriching webhook is called.
SSHEnriched(provisioner string, success bool)
// SSHWebhookEnriched is called whenever an SSH enriching webhook is called.
SSHWebhookEnriched(provisioner string, success bool)
// KMSSigned is called per KMS signer signature.
KMSSigned()
@ -42,15 +42,15 @@ type Meter interface {
// noopMeter implements a noop [Meter].
type noopMeter struct{}
func (noopMeter) SSHRekeyed(string, bool) {}
func (noopMeter) SSHRenewed(string, bool) {}
func (noopMeter) SSHSigned(string, bool) {}
func (noopMeter) SSHAuthorized(string, bool) {}
func (noopMeter) SSHEnriched(string, bool) {}
func (noopMeter) X509Rekeyed(string, bool) {}
func (noopMeter) X509Renewed(string, bool) {}
func (noopMeter) X509Signed(string, bool) {}
func (noopMeter) X509Authorized(string, bool) {}
func (noopMeter) X509Enriched(string, bool) {}
func (noopMeter) KMSSigned() {}
func (noopMeter) KMSError() {}
func (noopMeter) SSHRekeyed(string, bool) {}
func (noopMeter) SSHRenewed(string, bool) {}
func (noopMeter) SSHSigned(string, bool) {}
func (noopMeter) SSHWebhookAuthorized(string, bool) {}
func (noopMeter) SSHWebhookEnriched(string, bool) {}
func (noopMeter) X509Rekeyed(string, bool) {}
func (noopMeter) X509Renewed(string, bool) {}
func (noopMeter) X509Signed(string, bool) {}
func (noopMeter) X509WebhookAuthorized(string, bool) {}
func (noopMeter) X509WebhookEnriched(string, bool) {}
func (noopMeter) KMSSigned() {}
func (noopMeter) KMSError() {}

@ -733,7 +733,7 @@ func (a *Authority) callEnrichingWebhooksSSH(prov provisioner.Interface, webhook
); err == nil {
err = webhookCtl.Enrich(whEnrichReq)
a.incrWebhookCounter(prov, err, Meter.SSHEnriched)
a.incrWebhookCounter(prov, err, Meter.SSHWebhookEnriched)
}
return
@ -750,7 +750,7 @@ func (a *Authority) callAuthorizingWebhooksSSH(prov provisioner.Interface, webho
); err == nil {
err = webhookCtl.Authorize(whAuthBody)
a.incrWebhookCounter(prov, err, Meter.SSHAuthorized)
a.incrWebhookCounter(prov, err, Meter.SSHWebhookAuthorized)
}
return

@ -1024,7 +1024,7 @@ func (a *Authority) callEnrichingWebhooksX509(prov provisioner.Interface, webhoo
); err == nil {
err = webhookCtl.Enrich(whEnrichReq)
a.incrWebhookCounter(prov, err, Meter.X509Enriched)
a.incrWebhookCounter(prov, err, Meter.X509WebhookEnriched)
}
return
@ -1049,7 +1049,7 @@ func (a *Authority) callAuthorizingWebhooksX509(prov provisioner.Interface, webh
); err == nil {
err = webhookCtl.Authorize(whAuthBody)
a.incrWebhookCounter(prov, err, Meter.X509Authorized)
a.incrWebhookCounter(prov, err, Meter.X509WebhookAuthorized)
}
return

@ -86,13 +86,13 @@ func (m *Meter) SSHSigned(provisioner string, success bool) {
}
// SSHAuthorized implements [authority.Meter] for [Meter].
func (m *Meter) SSHAuthorized(provisioner string, success bool) {
count(m.ssh.authorized, provisioner, success)
func (m *Meter) SSHWebhookAuthorized(provisioner string, success bool) {
count(m.ssh.webhookAuthorized, provisioner, success)
}
// SSHEnriched implements [authority.Meter] for [Meter].
func (m *Meter) SSHEnriched(provisioner string, success bool) {
count(m.ssh.enriched, provisioner, success)
func (m *Meter) SSHWebhookEnriched(provisioner string, success bool) {
count(m.ssh.webhookEnriched, provisioner, success)
}
// X509Rekeyed implements [authority.Meter] for [Meter].
@ -111,13 +111,13 @@ func (m *Meter) X509Signed(provisioner string, success bool) {
}
// X509Authorized implements [authority.Meter] for [Meter].
func (m *Meter) X509Authorized(provisioner string, success bool) {
count(m.x509.authorized, provisioner, success)
func (m *Meter) X509WebhookAuthorized(provisioner string, success bool) {
count(m.x509.webhookAuthorized, provisioner, success)
}
// X509Enriched implements [authority.Meter] for [Meter].
func (m *Meter) X509Enriched(provisioner string, success bool) {
count(m.x509.enriched, provisioner, success)
func (m *Meter) X509WebhookEnriched(provisioner string, success bool) {
count(m.x509.webhookEnriched, provisioner, success)
}
func count(cv *prometheus.CounterVec, provisioner string, success bool) {
@ -140,8 +140,8 @@ type provisioner struct {
renewed *prometheus.CounterVec
signed *prometheus.CounterVec
authorized *prometheus.CounterVec
enriched *prometheus.CounterVec
webhookAuthorized *prometheus.CounterVec
webhookEnriched *prometheus.CounterVec
}
func newProvisioner(subsystem string) *provisioner {
@ -158,11 +158,11 @@ func newProvisioner(subsystem string) *provisioner {
"provisioner",
"success",
),
authorized: newCounterVec(subsystem, "authorized_total", "Number of authorizing webhooks called",
webhookAuthorized: newCounterVec(subsystem, "webhook_authorized_total", "Number of authorizing webhooks called",
"provisioner",
"success",
),
enriched: newCounterVec(subsystem, "enriched_total", "Number of enriching webhooks called",
webhookEnriched: newCounterVec(subsystem, "webhook_enriched_total", "Number of enriching webhooks called",
"provisioner",
"success",
),

Loading…
Cancel
Save