You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[processor/resourcedetection] add resource_attributes to every detector in resource processor (#23253)
**Description:** Adding resource_attributes option to every detector in
resource detection processor
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
**Link to tracking Issue:**
[21482](#21482)
**Testing:** Unit test for `resource_attribute` config, adjusting
current unit tests to the new implementation
**Documentation:** Updated README.md
---------
Co-authored-by: Dmitrii Anoshin <[email protected]>
# determines if existing resource attributes should be overridden or preserved, defaults to true
456
456
override: <bool>
457
-
# When included, only attributes in the list will be appened. Applies to all detectors.
457
+
# [DEPRECATED] When included, only attributes in the list will be appended. Applies to all detectors.
458
458
attributes: [ <string> ]
459
459
```
460
460
461
+
Moreover, you have the ability to specify which detector should collect each attribute with `resource_attributes` option. An example of such a configuration is:
462
+
463
+
```yaml
464
+
resourcedetection:
465
+
detectors: [system, ec2]
466
+
system:
467
+
resource_attributes:
468
+
host.name:
469
+
enabled: true
470
+
host.id:
471
+
enabled: false
472
+
ec2:
473
+
resource_attributes:
474
+
host.name:
475
+
enabled: false
476
+
host.id:
477
+
enabled: true
478
+
```
479
+
480
+
### Migration from attributes to resource_attributes
481
+
482
+
The `attributes` option is deprecated and will be removed soon, from now on you should enable/disable attributes through `resource_attributes`.
483
+
For example, this config:
484
+
485
+
```yaml
486
+
resourcedetection:
487
+
detectors: [system]
488
+
attributes: ['host.name', 'host.id']
489
+
```
490
+
491
+
can be replaced with:
492
+
493
+
```yaml
494
+
resourcedetection:
495
+
detectors: [system]
496
+
system:
497
+
resource_attributes:
498
+
host.name:
499
+
enabled: true
500
+
host.id:
501
+
enabled: true
502
+
os.type:
503
+
enabled: false
504
+
```
505
+
506
+
NOTE: Currently all attributes are enabled by default for backwards compatibility purposes, but it will change in the future.
507
+
461
508
## Ordering
462
509
463
510
Note that if multiple detectors are inserting the same attribute name, the first detector to insert wins. For example if you had `detectors: [eks, ec2]` then `cloud.platform` will be `aws_eks` instead of `ec2`. The below ordering is recommended.
0 commit comments