Commit fbd5d3f
authored
[mdatagen] Enable configurable attributes for metrics (#14281)
Reopens
[13900](#13900)
#### Description
Modified `cmd/mdatagen` to allow for two new fields in the configuration
yaml of metrics. These new configuration options will allow for a user
to enable or disable attributes (i.e. reduce dimensionality of metrics
being generated) from their collector configuration. The modified
`MetricsBuilder` generated by `mdatagen` does not record disabled
attributes and automatically re-aggregates metrics based on the
resulting enabled set of attributes. There are four different
aggregation strategies supported (`sum, average, min, and max`) which
can be specified as a setting in `config.yaml`.
The changes to the config.yaml are:
```yaml
receiver:
someMetricReceiver:
...
metrics:
...
attributes: [<list of attributes to include for metric at runtime>] # new
aggregation_strategy: <sum|avg|min|max> # new
```
Attribute `requirement_level` takes president over this re-aggregation
and any metric attribute with a `requirement_level` of `required` cannot
be disabled in this way. For more information on `requirement_level`
please see
[13913](#13913)
The set of attributes provided by the user _must_ be contained in the
set of attributes defined in the metadata.yaml, including an attribute
which is not defined in the metrics `metadata` file will fail. Also,
attempting to omit an attribute defined as `requirement_level: required`
will cause the configuration to fail and the collector not to start.
Omitting the field entirely will default to the defined set of metric
attributes in the `metadata` file with a requirement level of
`recommended` or above.
Due to its large scope and foundational nature, a featuregate has been
added for this change. This gate is represented by a new field in the
`metadata.yaml`, `reaggregation_enabled: <bool>`. Setting this to `true`
will enable the new codegen with spatial reaggregation features.
<!-- Issue number if applicable -->
#### Link to tracking issue
Fixes
[10726](#10726)
<!--Describe what testing was performed and which tests were added.-->
#### Testing
Generated tests have been updated to test new aggregation behavior.
<!--Describe the documentation added.-->
#### Documentation
ran `make gogenerate`
ran `make generate`
<!--Please delete paragraphs that you did not use before submitting.-->1 parent 250a1ca commit fbd5d3f
File tree
34 files changed
+3414
-543
lines changed- .chloggen
- .github/workflows/utils
- cmd/mdatagen/internal
- sampleconnector
- internal/metadata
- testdata
- sampleprocessor
- internal/metadata/testdata
- samplereceiver
- internal/metadata
- testdata
- samplescraper
- internal/metadata
- testdata
- templates
- testdata
34 files changed
+3414
-543
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
402 | 402 | | |
403 | 403 | | |
404 | 404 | | |
| 405 | + | |
405 | 406 | | |
406 | 407 | | |
407 | 408 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
231 | 231 | | |
232 | 232 | | |
233 | 233 | | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
234 | 252 | | |
235 | 253 | | |
236 | 254 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| 54 | + | |
54 | 55 | | |
55 | 56 | | |
56 | 57 | | |
| |||
263 | 264 | | |
264 | 265 | | |
265 | 266 | | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
266 | 279 | | |
267 | 280 | | |
268 | 281 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
29 | 31 | | |
30 | 32 | | |
31 | 33 | | |
| |||
412 | 414 | | |
413 | 415 | | |
414 | 416 | | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
415 | 428 | | |
416 | 429 | | |
417 | 430 | | |
| |||
476 | 489 | | |
477 | 490 | | |
478 | 491 | | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
479 | 517 | | |
480 | 518 | | |
481 | 519 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
63 | 78 | | |
64 | 79 | | |
65 | 80 | | |
| |||
Lines changed: 68 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 60 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments