mirror of
https://github.com/kubernetes-sigs/node-feature-discovery.git
synced 2025-03-28 02:37:11 +00:00
metrics: improve the node updates gauge
Rename the metric, better describe what we're measuring and better comply with prometheus naming conventions. Also change it to represent actual updates of the node object on the Kubernetes apiserver.
This commit is contained in:
parent
945e7fcb3f
commit
47f621d970
2 changed files with 5 additions and 5 deletions
|
@ -29,7 +29,7 @@ import (
|
|||
// When adding metric names, see https://prometheus.io/docs/practices/naming/#metric-names
|
||||
const (
|
||||
buildInfoQuery = "nfd_master_build_info"
|
||||
updatedNodesQuery = "nfd_updated_nodes"
|
||||
nodeUpdatesQuery = "nfd_node_updates_total"
|
||||
nfrProcessingTimeQuery = "nfd_nodefeaturerule_processing_duration_seconds"
|
||||
)
|
||||
|
||||
|
@ -43,8 +43,8 @@ var (
|
|||
"version": version.Get(),
|
||||
},
|
||||
})
|
||||
updatedNodes = prometheus.NewCounter(prometheus.CounterOpts{
|
||||
Name: updatedNodesQuery,
|
||||
nodeUpdates = prometheus.NewCounter(prometheus.CounterOpts{
|
||||
Name: nodeUpdatesQuery,
|
||||
Help: "Number of nodes updated by the master.",
|
||||
})
|
||||
nfrProcessingTime = prometheus.NewHistogramVec(
|
||||
|
@ -69,7 +69,7 @@ func registerVersion(version string) {
|
|||
func runMetricsServer(port int) {
|
||||
r := prometheus.NewRegistry()
|
||||
r.MustRegister(buildInfo,
|
||||
updatedNodes,
|
||||
nodeUpdates,
|
||||
nfrProcessingTime)
|
||||
|
||||
mux := http.NewServeMux()
|
||||
|
|
|
@ -854,7 +854,6 @@ func (m *nfdMaster) refreshNodeFeatures(cli *kubernetes.Clientset, nodeName stri
|
|||
return err
|
||||
}
|
||||
|
||||
updatedNodes.Inc()
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -1073,6 +1072,7 @@ func (m *nfdMaster) updateNodeObject(cli *kubernetes.Clientset, nodeName string,
|
|||
}
|
||||
|
||||
if len(patches) > 0 || len(statusPatches) > 0 {
|
||||
nodeUpdates.Inc()
|
||||
klog.InfoS("node updated", "nodeName", nodeName)
|
||||
} else {
|
||||
klog.V(1).InfoS("no updates to node", "nodeName", nodeName)
|
||||
|
|
Loading…
Add table
Reference in a new issue