Commit 860ccb2
[nutanix] Warn and skip entities missing extId or name (DataDog#23612)
* fix(nutanix): normalize all ntnx_* tags to lowercase with $unknown fallback
Route every enum-backed ntnx_* tag (host_type, hypervisor_type,
node_status, plus the previously-handled state tags) through a single
_norm_state helper so they all follow one rule: lowercase the API
value, fall back to "\$unknown" when the source is missing.
Picks "\$unknown" (the API spec's own sentinel) as the fallback so
there's no mismatch between "value present but says \$UNKNOWN" and
"value missing" — both surface as ntnx_X:\$unknown.
ntnx_disk_status's "unknown" fallback is updated to "\$unknown" for
the same reason.
* docs(nutanix): add changelog for tag normalization
* docs(nutanix): shorten changelog to one customer-facing line
* refactor(nutanix): extract tag values into named variables
Hoist _norm_state and get_nested calls out of f-strings in the
tag-extraction helpers. Each tag computation now binds to a named
local first, making the read top-down and easier to step through.
* refactor(nutanix): rename _norm_state to _normalize_tag_value
The helper is used for type, state, mode, and status tags — not just
state — so the broader name better describes what it does.
* refactor(nutanix): collapse node_status to one variable, restore tags = []
Lowercase the node-status comparison sets so the normalized tag value
serves both the status_value lookup and the tag emission, removing the
need for a separate node_status_tag local.
Restore the tags = [] preamble in the tag-extraction helpers since it
makes the building intent obvious.
* fix(nutanix): normalize powerState in vm.status gauge
Match what _report_host_status_metrics does: route the powerState
lookup through _normalize_tag_value and lowercase the comparison
literals. Removes the asymmetry where vm.status was the only metric
still relying on raw uppercase API values.
Addresses review feedback on PR DataDog#23609.
* fix(nutanix): warn and skip entities missing the main id or name
Hosts now warn-and-skip when hostName is missing (previously they
emitted metrics with hostname=None, useless for correlation), VMs
upgrade their existing missing-id/name skip from debug to warning,
and clusters now warn-and-skip when name is missing (previously they
were processed with no ntnx_cluster_name tag and weren't cached for
VM/host cluster-name tagging).
* docs(nutanix): add changelog for entity-validation skip
* docs(nutanix): shorten changelog to one customer-facing line
* refactor(nutanix): rename VM hostname locals/params to vm_name
The variable was named after how it's consumed downstream (the
hostname= kwarg to gauge calls), not what it actually is — the VM's
"name" field from the API. Rename to vm_name for symmetry with
host_name on the host side; the gauge call still passes it as
hostname=vm_name.
* refactor(nutanix): hoist cluster log label to a variable
* Delete nutanix/changelog.d/23609.fixed
* Keep collecting VMs for unnamed hosts
* test(nutanix): add tests for skip behavior on missing entity fields
Cover the three new skip paths added in this PR:
- VM missing extId: verify vm_count decrements and metric absent
- VM missing name: same invariant
- Cluster missing name: verify cluster_count unchanged and warning logged
Each VM test is parametrized for both batch and non-batch collection modes.
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>1 parent e8805df commit 860ccb2
4 files changed
Lines changed: 184 additions & 48 deletions
File tree
- nutanix
- changelog.d
- datadog_checks/nutanix
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
Lines changed: 69 additions & 48 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
152 | 152 | | |
153 | 153 | | |
154 | 154 | | |
155 | | - | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
156 | 158 | | |
157 | 159 | | |
158 | | - | |
| 160 | + | |
159 | 161 | | |
160 | 162 | | |
161 | 163 | | |
| |||
164 | 166 | | |
165 | 167 | | |
166 | 168 | | |
167 | | - | |
168 | 169 | | |
169 | | - | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
170 | 176 | | |
171 | 177 | | |
172 | 178 | | |
| |||
220 | 226 | | |
221 | 227 | | |
222 | 228 | | |
223 | | - | |
224 | | - | |
225 | | - | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
226 | 235 | | |
227 | 236 | | |
228 | 237 | | |
229 | 238 | | |
230 | 239 | | |
231 | 240 | | |
232 | | - | |
233 | | - | |
234 | | - | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
235 | 244 | | |
236 | 245 | | |
237 | | - | |
| 246 | + | |
238 | 247 | | |
239 | | - | |
| 248 | + | |
240 | 249 | | |
241 | 250 | | |
242 | 251 | | |
243 | | - | |
| 252 | + | |
244 | 253 | | |
245 | | - | |
| 254 | + | |
246 | 255 | | |
247 | 256 | | |
248 | 257 | | |
| |||
258 | 267 | | |
259 | 268 | | |
260 | 269 | | |
261 | | - | |
| 270 | + | |
262 | 271 | | |
263 | 272 | | |
264 | 273 | | |
265 | 274 | | |
266 | 275 | | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | | - | |
271 | | - | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
272 | 281 | | |
273 | | - | |
| 282 | + | |
274 | 283 | | |
275 | 284 | | |
276 | 285 | | |
| |||
357 | 366 | | |
358 | 367 | | |
359 | 368 | | |
360 | | - | |
| 369 | + | |
361 | 370 | | |
362 | 371 | | |
363 | 372 | | |
364 | 373 | | |
365 | 374 | | |
366 | | - | |
| 375 | + | |
367 | 376 | | |
368 | 377 | | |
369 | 378 | | |
370 | | - | |
| 379 | + | |
371 | 380 | | |
372 | 381 | | |
373 | 382 | | |
| |||
409 | 418 | | |
410 | 419 | | |
411 | 420 | | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
412 | 431 | | |
413 | 432 | | |
414 | 433 | | |
415 | | - | |
416 | | - | |
417 | | - | |
| 434 | + | |
| 435 | + | |
418 | 436 | | |
419 | 437 | | |
420 | | - | |
421 | | - | |
422 | | - | |
423 | | - | |
424 | | - | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
425 | 443 | | |
426 | | - | |
427 | | - | |
428 | | - | |
429 | | - | |
430 | | - | |
431 | | - | |
432 | | - | |
433 | | - | |
434 | | - | |
435 | | - | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
436 | 458 | | |
437 | | - | |
438 | | - | |
439 | | - | |
440 | | - | |
441 | 459 | | |
| 460 | + | |
442 | 461 | | |
443 | 462 | | |
444 | 463 | | |
445 | | - | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
446 | 467 | | |
447 | 468 | | |
448 | | - | |
| 469 | + | |
449 | 470 | | |
450 | 471 | | |
451 | 472 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| 12 | + | |
11 | 13 | | |
12 | 14 | | |
13 | 15 | | |
| |||
92 | 94 | | |
93 | 95 | | |
94 | 96 | | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
95 | 115 | | |
96 | 116 | | |
97 | 117 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| 10 | + | |
9 | 11 | | |
10 | 12 | | |
11 | 13 | | |
| |||
68 | 70 | | |
69 | 71 | | |
70 | 72 | | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
71 | 165 | | |
72 | 166 | | |
73 | 167 | | |
| |||
0 commit comments