Update metric name
and handle the case where there is no active root CA.
This commit is contained in:
parent
548796ae13
commit
e36800cefa
|
@ -1,4 +1,4 @@
|
||||||
```release-note:improvement
|
```release-note:improvement
|
||||||
telemetry: add a new `mesh.root-ca.expiry` metric for tracking when the root certificate expires.
|
telemetry: add a new `mesh.active-root-ca.expiry` metric for tracking when the root certificate expires.
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ var CertExpirationGauges = []prometheus.GaugeDefinition{
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
var metricsKeyMeshRootCAExpiry = []string{"mesh", "root-ca", "expiry"}
|
var metricsKeyMeshRootCAExpiry = []string{"mesh", "active-root-ca", "expiry"}
|
||||||
|
|
||||||
func rootCAExpiryMonitor(s *Server) certExpirationMonitor {
|
func rootCAExpiryMonitor(s *Server) certExpirationMonitor {
|
||||||
return certExpirationMonitor{
|
return certExpirationMonitor{
|
||||||
|
@ -31,8 +31,11 @@ func rootCAExpiryMonitor(s *Server) certExpirationMonitor {
|
||||||
Query: func() (time.Duration, error) {
|
Query: func() (time.Duration, error) {
|
||||||
state := s.fsm.State()
|
state := s.fsm.State()
|
||||||
_, root, err := state.CARootActive(nil)
|
_, root, err := state.CARootActive(nil)
|
||||||
if err != nil {
|
switch {
|
||||||
|
case err != nil:
|
||||||
return 0, fmt.Errorf("failed to retrieve root CA: %w", err)
|
return 0, fmt.Errorf("failed to retrieve root CA: %w", err)
|
||||||
|
case root == nil:
|
||||||
|
return 0, fmt.Errorf("no active root CA")
|
||||||
}
|
}
|
||||||
|
|
||||||
return time.Until(root.NotAfter), nil
|
return time.Until(root.NotAfter), nil
|
||||||
|
|
|
@ -478,7 +478,7 @@ These metrics give insight into the health of the cluster as a whole.
|
||||||
| `consul.catalog.connect.query-tag..` | Increments for each connect-based catalog query for the given service with the given tag. | queries | counter |
|
| `consul.catalog.connect.query-tag..` | Increments for each connect-based catalog query for the given service with the given tag. | queries | counter |
|
||||||
| `consul.catalog.connect.query-tags..` | Increments for each connect-based catalog query for the given service with the given tags. | queries | counter |
|
| `consul.catalog.connect.query-tags..` | Increments for each connect-based catalog query for the given service with the given tags. | queries | counter |
|
||||||
| `consul.catalog.connect.not-found.` | Increments for each connect-based catalog query where the given service could not be found. | queries | counter |
|
| `consul.catalog.connect.not-found.` | Increments for each connect-based catalog query where the given service could not be found. | queries | counter |
|
||||||
| `consul.mesh.root-ca.expiry` | The number of seconds until the root CA expires, updated every hour. | seconds | gauge |
|
| `consul.mesh.active-root-ca.expiry` | The number of seconds until the root CA expires, updated every hour. | seconds | gauge |
|
||||||
|
|
||||||
## Connect Built-in Proxy Metrics
|
## Connect Built-in Proxy Metrics
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue