mirror of
https://github.com/kubernetes-sigs/node-feature-discovery.git
synced 2025-03-30 19:54:46 +00:00
metrics: add nfd_node_update_requests_total counter
Add a counter for total number of node update/sync requests. In practice, this counts the number of gRPC requests received if the gRPC API is in use. If the NodeFeature API is enabled, this counts the requests initiated by the NFD API controller, i.e. updates triggered by changes in NodeFeature or NodeFeatureRule objects plus updates initiated by the controller resync period.
This commit is contained in:
parent
4b24cc1afa
commit
5ad2294c14
4 changed files with 9 additions and 0 deletions
|
@ -17,6 +17,7 @@ The exposed metrics are
|
|||
| ------------------------------------------------- | --------- | ---------------------------------------
|
||||
| `nfd_master_build_info` | Gauge | Version from which nfd-master was built
|
||||
| `nfd_worker_build_info` | Gauge | Version from which nfd-worker was built
|
||||
| `nfd_node_update_requests_total` | Counter | Number of node update requests processed by the master
|
||||
| `nfd_node_updates_total` | Counter | Number of nodes updated
|
||||
| `nfd_node_update_failures_total` | Counter | Number of nodes update failures
|
||||
| `nfd_node_labels_rejected_total` | Counter | Number of nodes labels rejected by nfd-master
|
||||
|
|
|
@ -29,6 +29,7 @@ import (
|
|||
// When adding metric names, see https://prometheus.io/docs/practices/naming/#metric-names
|
||||
const (
|
||||
buildInfoQuery = "nfd_master_build_info"
|
||||
nodeUpdateRequestsQuery = "nfd_node_update_requests_total"
|
||||
nodeUpdatesQuery = "nfd_node_updates_total"
|
||||
nodeUpdateFailuresQuery = "nfd_node_update_failures_total"
|
||||
nodeLabelsRejectedQuery = "nfd_node_labels_rejected_total"
|
||||
|
@ -48,6 +49,10 @@ var (
|
|||
"version": version.Get(),
|
||||
},
|
||||
})
|
||||
nodeUpdateRequests = prometheus.NewCounter(prometheus.CounterOpts{
|
||||
Name: nodeUpdateRequestsQuery,
|
||||
Help: "Number of node update requests processed by the master.",
|
||||
})
|
||||
nodeUpdates = prometheus.NewCounter(prometheus.CounterOpts{
|
||||
Name: nodeUpdatesQuery,
|
||||
Help: "Number of nodes updated by the master.",
|
||||
|
@ -95,6 +100,7 @@ func runMetricsServer(port int) {
|
|||
r := prometheus.NewRegistry()
|
||||
r.MustRegister(
|
||||
buildInfo,
|
||||
nodeUpdateRequests,
|
||||
nodeUpdates,
|
||||
nodeUpdateFailures,
|
||||
nodeLabelsRejected,
|
||||
|
|
|
@ -654,6 +654,7 @@ func isNamespaceDenied(labelNs string, wildcardDeniedNs map[string]struct{}, nor
|
|||
|
||||
// SetLabels implements LabelerServer
|
||||
func (m *nfdMaster) SetLabels(c context.Context, r *pb.SetLabelsRequest) (*pb.SetLabelsReply, error) {
|
||||
nodeUpdateRequests.Inc()
|
||||
err := authorizeClient(c, m.args.VerifyNodeName, r.NodeName)
|
||||
if err != nil {
|
||||
klog.ErrorS(err, "gRPC client authorization failed", "nodeName", r.NodeName)
|
||||
|
|
|
@ -46,6 +46,7 @@ func (u *nodeUpdaterPool) processNodeUpdateRequest(queue workqueue.RateLimitingI
|
|||
|
||||
defer queue.Done(nodeName)
|
||||
|
||||
nodeUpdateRequests.Inc()
|
||||
if err := u.nfdMaster.nfdAPIUpdateOneNode(nodeName.(string)); err != nil {
|
||||
if queue.NumRequeues(nodeName) < 5 {
|
||||
klog.InfoS("retrying node update", "nodeName", nodeName)
|
||||
|
|
Loading…
Add table
Reference in a new issue