feat: add node handling for cm2 - #4390
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the CM2 (cmperf) collector and its ONTAP 9.19.1 cmperf templates so node-scoped data can be labeled/identified correctly (by exposing node_name from the CM2 batch’s ObjectCollection.Node and by converting string identity fields into template keys/labels).
Changes:
- Add
node_nameinjection inpopulateMatrixusingObjectCollection.Node. - Update multiple
conf/cmperf/9.19.1/*.yamltemplates to mark string identity fields as keys/labels using^^/^(including node-related fields) and reorder/remove duplicates accordingly.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| conf/cmperf/9.19.1/volume_node.yaml | Marks node identity field as a key to support node-level volume metrics labeling. |
| conf/cmperf/9.19.1/token_manager.yaml | Promotes identity fields to labels/keys so node/token dimensions can be exported. |
| conf/cmperf/9.19.1/qtree.yaml | Converts qtree identity fields to ^^/^ key/label entries for proper labeling. |
| conf/cmperf/9.19.1/ontap_s3_svm.yaml | Adds key/label identity fields (incl. node) so ontaps3 SVM metrics can be attributed correctly. |
| conf/cmperf/9.19.1/object_store_client_op.yaml | Promotes identity fields (incl. node) to labels/keys for FabricPool client-op metrics. |
| conf/cmperf/9.19.1/nvmf_tcp_port.yaml | Adds key/label identity fields (incl. node/svm/port) for NVMf TCP port metrics. |
| conf/cmperf/9.19.1/nvmf_rdma_port.yaml | Adds key/label identity fields (incl. node/svm/port) for NVMf RDMA port metrics. |
| conf/cmperf/9.19.1/nfsv4_pool.yaml | Promotes instance/node identity fields to key/label entries for NFSv4 pool metrics. |
| conf/cmperf/9.19.1/netstat.yaml | Promotes connection identity fields (incl. node) to key/label entries for netstat metrics. |
| conf/cmperf/9.19.1/fcvi.yaml | Promotes instance/node identity fields to key/label entries for FCVI metrics. |
| conf/cmperf/9.19.1/fcp.yaml | Promotes port/node identity fields to key/label entries for FCP port metrics. |
| conf/cmperf/9.19.1/external_service_operation.yaml | Promotes operation/service identity fields (incl. node/svm) to key/label entries. |
| conf/cmperf/9.19.1/disk.yaml | Promotes disk identity fields (incl. node/disk UUID) to key/label entries. |
| conf/cmperf/9.19.1/cifs_vserver.yaml | Promotes SVM CIFS identity fields to key/label entries. |
| conf/cmperf/9.19.1/cifs_node.yaml | Marks node identity field as a key to support node-level CIFS metrics labeling. |
| cmd/collectors/cmperf/cm2.go | Adds node_name population from CM2 batch node to support templates that label by node. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 17 out of 17 changed files in this pull request and generated no new comments.
Suppressed comments (2)
cmd/collectors/cmperf/cm2.go:425
- The new CM2 node handling (propagating ObjectCollection.Node into the instance label set) is not covered by unit tests. Adding a small test that constructs an ObjectCollection with Node set and verifies populateMatrix sets the exported node label (and/or affects instance key when node_name is a key) would prevent regressions.
if oc.Node != "" {
stringVals["node_name"] = oc.Node
}
cmd/collectors/cmperf/cm2.go:425
- Setting stringVals["node_name"] before iterating inst.Counters can be overwritten by a node_name string counter later in the loop (including overwriting with an empty string). That can cause missing/empty node labels and even empty instance keys when node_name is part of InstanceKeys. Prefer filling node_name from oc.Node after processing counters, and only when node_name is still empty.
if oc.Node != "" {
stringVals["node_name"] = oc.Node
}
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 17 out of 17 changed files in this pull request and generated no new comments.
Suppressed comments (2)
cmd/collectors/cmperf/cm2.go:425
- The new
oc.Node→node_namelabel fallback isn’t covered by unit tests. Adding a small test that exercisespopulateMatrixwith (a) nonode_namecounter and (b) an emptynode_namecounter would help prevent regressions in label/key construction.
if oc.Node != "" {
stringVals["node_name"] = oc.Node
}
cmd/collectors/cmperf/cm2.go:427
node_nameis set fromoc.Nodebefore reading string counters, but the subsequent counter loop can overwrite it with an emptynode_namecounter value. That can drop the node label even though the collection header has a valid node name. Prefer usingoc.Nodeas a fallback only when the instance doesn’t already have a non-emptynode_name.
if oc.Node != "" {
stringVals["node_name"] = oc.Node
}
for _, ct := range inst.Counters {
No description provided.