Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[processor/resourcedetection] Add support for host cpuinfo attributes (…
…#26533) **Description:** : Added support for host's cpuinfo attributes as part of the system resourcedetection. This information is retrieved from /proc/cpuinfo. **Link to tracking Issue:** #26532 **Testing:** ### How to test this manually 1. Using the following configuration: ```yml receivers: hostmetrics: collection_interval: 30s scrapers: cpu: processors: resourcedetection/system: detectors: ["system"] system: hostname_sources: ["lookup", "cname", "dns", "os"] resource_attributes: host.name: enabled: true host.id: enabled: true host.cpu.cache.l2.size: enabled: true host.cpu.family: enabled: true host.cpu.model.id: enabled: true host.cpu.model.name: enabled: true host.cpu.stepping: enabled: true host.cpu.vendor.id: enabled: true service: pipelines: metrics: receivers: [hostmetrics] exporters: [file] processors: [resourcedetection/system] exporters: file: path: ./output.json ``` 2. Start the collector with `./bin/otelcontribcol_linux_amd64 --config examples/host_config.yaml` 3. The output reports the added attributes succesfully: ```json { "resourceMetrics":[ { "resource":{ "attributes":[ { "key":"host.name", "value":{ "stringValue":"chrismark-ThinkPad-X1-Carbon-Gen-9" } }, { "key":"os.type", "value":{ "stringValue":"linux" } }, { "key":"host.id", "value":{ "stringValue":"d6488716404e4ce4854ff0e230944c6d" } }, { "key":"host.cpu.vendor.id", "value":{ "stringValue":"GenuineIntel" } }, { "key":"host.cpu.family", "value":{ "stringValue":"6" } }, { "key":"host.cpu.model.id", "value":{ "stringValue":"140" } }, { "key":"host.cpu.model.name", "value":{ "stringValue":"11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz" } }, { "key":"host.cpu.stepping", "value":{ "intValue":"1" } }, { "key":"host.cpu.cache.l2.size", "value":{ "intValue":"12288" } } ] }, "scopeMetrics":[...], "schemaUrl":"https://opentelemetry.io/schemas/1.9.0" } ] } ``` ### Unit tests - **Documentation:** Updated [README.md ](https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/26533/files#diff-2fd609a720e95f7ad6fe8c31180f20671dbf62301fba3c9914fcb81a8cc930aa) Signed-off-by: ChrsMark <chrismarkou92@gmail.com>
- Loading branch information