Commit 11fb9ed
authored
feat(adxexporter): Switch MetricsExporter to OTLP push mode (#1029)
* feat(adxexporter): Switch MetricsExporter to OTLP push mode
Replace Prometheus scraping with direct OTLP push using PromToOtlpExporter.
Changes:
- Add ToWriteRequest() to transform MetricData to prompb.WriteRequest with pooling
- Update MetricsExporterReconciler to use PromToOtlpExporter instead of OTel Meter
- Update CLI: --otlp-endpoint now required, remove deprecated --metrics-* flags
- Update tests to use mock OTLP server instead of metrics scraping
- Update documentation for OTLP push mode
Benefits:
- Timestamp fidelity: preserves actual KQL query timestamps
- Memory efficiency: uses pkg/prompb object pooling for high cardinality
- Simpler deployment: no Collector scraping configuration needed
- Reuses battle-tested PromToOtlpExporter from Collector
* Add --add-resource-attributes flag to AdxExporter
- Add --add-resource-attributes CLI flag for specifying OTLP resource attributes
- Merge ClusterLabels (base) with AddResourceAttributes (can override or add new)
- Add parseKeyValuePairs() helper function
- Add tests for resource attribute merging behavior
* fix(adxexporter): Add --add-resource-attributes flag to AdxExporter
Switches MetricsExporter from Prometheus scraping to OTLP push mode.
The metricNamePrefix field in the CRD controls the full metric name prefix.
Users who previously had metrics with 'adxexporter_' prefix should update
their CRDs to include it explicitly in metricNamePrefix, e.g.:
metricNamePrefix: adxexporter_cluster_autoscaler
* feat(adxexporter): Add --default-metric-name-prefix CLI flag
Adds a new CLI flag that sets a default prefix for metric names when the
MetricsExporter CRD doesn't specify a metricNamePrefix. This provides:
1. Cluster-wide default naming convention without modifying every CRD
2. CRD-level override when specific prefixes are needed
3. Better user experience - operators configure once, users don't need to
remember to add prefixes
Metric name precedence:
1. CRD's metricNamePrefix (if specified)
2. CLI's --default-metric-name-prefix (if CRD prefix is empty)
3. No prefix (if both are empty)
Example deployment:
adxexporter --default-metric-name-prefix=adxexporter ...
This produces metrics like 'adxexporter_cluster_autoscaler_availability_*'
without requiring each MetricsExporter CRD to specify the prefix.
* feat(adxexporter): Change --metric-name-prefix to always prepend to CRD prefix
BREAKING CHANGE: Renamed --default-metric-name-prefix to --metric-name-prefix
The new behavior always prepends the CLI prefix to metric names, then appends
the CRD's metricNamePrefix. This allows operators to enforce a global prefix
(e.g., for allow-list compliance) while teams can still add sub-prefixes via CRD.
Old behavior (--default-metric-name-prefix):
- CLI: adxexporter, CRD: custom → Result: custom_* (CRD wins)
New behavior (--metric-name-prefix):
- CLI: adxexporter, CRD: custom → Result: adxexporter_custom_*
- CLI: adxexporter, CRD: empty → Result: adxexporter_*
- CLI: empty, CRD: custom → Result: custom_*
This ensures all MetricsExporter metrics can be prefixed uniformly without
requiring each CRD to manually include the global prefix.1 parent 9da11d1 commit 11fb9ed
File tree
11 files changed
+1325
-260
lines changed- adxexporter
- cmd/adxexporter
- docs
- designs
- transform
11 files changed
+1325
-260
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
6 | 9 | | |
7 | 10 | | |
8 | 11 | | |
| |||
158 | 161 | | |
159 | 162 | | |
160 | 163 | | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
161 | 174 | | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
168 | 181 | | |
169 | | - | |
| 182 | + | |
170 | 183 | | |
171 | 184 | | |
172 | 185 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| 10 | + | |
9 | 11 | | |
10 | 12 | | |
| 13 | + | |
11 | 14 | | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | 15 | | |
19 | 16 | | |
20 | 17 | | |
21 | 18 | | |
22 | 19 | | |
23 | 20 | | |
24 | | - | |
25 | 21 | | |
26 | 22 | | |
27 | 23 | | |
| |||
33 | 29 | | |
34 | 30 | | |
35 | 31 | | |
36 | | - | |
37 | | - | |
38 | | - | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
39 | 37 | | |
40 | 38 | | |
41 | 39 | | |
42 | 40 | | |
43 | 41 | | |
44 | | - | |
45 | | - | |
| 42 | + | |
| 43 | + | |
46 | 44 | | |
47 | 45 | | |
48 | 46 | | |
| |||
101 | 99 | | |
102 | 100 | | |
103 | 101 | | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
108 | 105 | | |
109 | 106 | | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
120 | 122 | | |
121 | | - | |
122 | | - | |
123 | 123 | | |
124 | | - | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
125 | 129 | | |
| 130 | + | |
126 | 131 | | |
127 | 132 | | |
128 | 133 | | |
129 | 134 | | |
130 | 135 | | |
131 | | - | |
| 136 | + | |
132 | 137 | | |
133 | 138 | | |
134 | 139 | | |
| |||
265 | 270 | | |
266 | 271 | | |
267 | 272 | | |
268 | | - | |
| 273 | + | |
269 | 274 | | |
270 | 275 | | |
271 | 276 | | |
| |||
274 | 279 | | |
275 | 280 | | |
276 | 281 | | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
277 | 296 | | |
| 297 | + | |
278 | 298 | | |
279 | 299 | | |
280 | 300 | | |
281 | | - | |
| 301 | + | |
282 | 302 | | |
283 | 303 | | |
284 | 304 | | |
285 | 305 | | |
286 | 306 | | |
287 | | - | |
| 307 | + | |
288 | 308 | | |
289 | 309 | | |
290 | 310 | | |
| |||
298 | 318 | | |
299 | 319 | | |
300 | 320 | | |
301 | | - | |
302 | | - | |
| 321 | + | |
| 322 | + | |
303 | 323 | | |
304 | 324 | | |
305 | | - | |
| 325 | + | |
306 | 326 | | |
307 | 327 | | |
308 | 328 | | |
309 | 329 | | |
310 | 330 | | |
311 | | - | |
312 | | - | |
313 | | - | |
314 | | - | |
315 | | - | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
316 | 335 | | |
317 | 336 | | |
318 | | - | |
319 | | - | |
320 | | - | |
321 | | - | |
322 | | - | |
323 | | - | |
324 | | - | |
325 | | - | |
326 | | - | |
327 | | - | |
328 | | - | |
329 | | - | |
330 | | - | |
331 | | - | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
332 | 344 | | |
333 | | - | |
334 | | - | |
335 | | - | |
336 | | - | |
337 | | - | |
338 | | - | |
| 345 | + | |
| 346 | + | |
339 | 347 | | |
340 | 348 | | |
341 | 349 | | |
| |||
0 commit comments