Commit 1e49b37
authored
CAP-3858 fix missing AgentVersion on manifest payload (#53915)
<!--Please give us some feedback on your experience writing this PR ! https://app.datadoghq.com/forms/43db4c02-6837-400c-8083-692e141b1b88 !-->
### What does this PR do?
Fix missing `AgentVersion` on `CollectorManifest` payloads for all non-pod Kubernetes resources.
For buffered manifest payloads (Deployments, Services, Nodes, and every other non-pod resource collected by the Cluster Agent orchestrator check), we have `AgentVersion = nil`.
Root cause: `ManifestBuffer.flushManifest` built a synthetic processor context from a snapshot of a handful of config fields and that snapshot silently omitted `AgentVersion`. Pods weren't affected because they're collected by the process-agent on each node, not through this buffer.
### What changed
- **Fix the drop.** `ManifestBuffer` now holds a reference to the owning `OrchestratorCheck` and builds the flush context via a new `newFlushContext()` helper that reads shared per-check fields live from the check.
- **Prevent the class of bug.** Removed the identity fields from `ManifestBufferConfig` so it only holds buffer tuning knobs. Any future per-check field will flow through `newFlushContext` automatically instead of needing to be manually copied into a snapshot.
- **Also fixed on the way through:**
- Terminated-resource run config was dropping `AgentVersion` too — propagated it from the main run config.
- `newOrchestratorCheck` wasn't copying the `Meta` field from `version.Version` into `model.AgentVersion` — added it.
### Describe how you validated your changes
Added a regression assertion in `TestFlushManifest` that fails if `sentManifest.AgentVersion` is nil or doesn't match the check's version. All 647 package tests pass.
### Additional Notes
Co-authored-by: kangyi.li <kangyi.li@datadoghq.com>1 parent 7a98cab commit 1e49b37
4 files changed
Lines changed: 28 additions & 31 deletions
File tree
- pkg/collector/corechecks/cluster/orchestrator
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
| 120 | + | |
120 | 121 | | |
121 | 122 | | |
122 | 123 | | |
| |||
Lines changed: 21 additions & 25 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | 23 | | |
25 | 24 | | |
26 | 25 | | |
| |||
40 | 39 | | |
41 | 40 | | |
42 | 41 | | |
43 | | - | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
44 | 45 | | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | 46 | | |
50 | 47 | | |
51 | 48 | | |
52 | 49 | | |
53 | | - | |
54 | 50 | | |
55 | 51 | | |
56 | 52 | | |
| |||
59 | 55 | | |
60 | 56 | | |
61 | 57 | | |
| 58 | + | |
62 | 59 | | |
63 | 60 | | |
64 | 61 | | |
| |||
68 | 65 | | |
69 | 66 | | |
70 | 67 | | |
| 68 | + | |
71 | 69 | | |
72 | | - | |
73 | | - | |
74 | 70 | | |
75 | | - | |
76 | | - | |
77 | 71 | | |
78 | 72 | | |
79 | 73 | | |
80 | | - | |
81 | 74 | | |
82 | 75 | | |
83 | 76 | | |
| |||
87 | 80 | | |
88 | 81 | | |
89 | 82 | | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
94 | 87 | | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
103 | 92 | | |
| 93 | + | |
104 | 94 | | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
105 | 101 | | |
106 | | - | |
| 102 | + | |
107 | 103 | | |
108 | 104 | | |
109 | 105 | | |
| |||
Lines changed: 5 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
| 126 | + | |
| 127 | + | |
131 | 128 | | |
132 | 129 | | |
133 | 130 | | |
| |||
171 | 168 | | |
172 | 169 | | |
173 | 170 | | |
174 | | - | |
| 171 | + | |
175 | 172 | | |
176 | 173 | | |
177 | 174 | | |
| 175 | + | |
| 176 | + | |
178 | 177 | | |
179 | 178 | | |
180 | 179 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
| 116 | + | |
116 | 117 | | |
117 | 118 | | |
118 | 119 | | |
| |||
0 commit comments