Commit 7cd8f58
authored
[cmd/mdatagen] [chore] Fix entity-scoped MetricsBuilder to respect resource_attributes config (#14762)
This fixes feature brought in
#14660. No
need for changelog if we can merge it before the release
The `Emit()` method in generated entity builders was calling
`entity.CopyToResource()` unconditionally, ignoring the
`resource_attributes` configuration set by the user.
Fix the code generator so that entity structs store attribute values in
plain unexported fields instead of eagerly building an `entity.Entity`.
At `Emit()` time, each entity struct's `copyToResource()` method applies
the ResourceAttributesConfig:
- Disabled identity attributes: suppress the entity entirely; other
enabled attributes are still written directly to the resource without
entity association.
- Disabled descriptive/extra attributes: entity is produced normally but
the disabled attribute is omitted.1 parent 12a8fe0 commit 7cd8f58
7 files changed
Lines changed: 521 additions & 123 deletions
File tree
- cmd/mdatagen/internal
- sampleconnector/internal/metadata
- sampleentityreceiver/internal/metadata
- templates
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
339 | 339 | | |
340 | 340 | | |
341 | 341 | | |
342 | | - | |
343 | | - | |
344 | | - | |
345 | | - | |
346 | | - | |
347 | | - | |
348 | | - | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
349 | 346 | | |
350 | 347 | | |
351 | 348 | | |
| |||
570 | 567 | | |
571 | 568 | | |
572 | 569 | | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
Lines changed: 31 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 62 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 74 additions & 27 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments