Skip to content

[processor/resourcedetection] failed to convert cpuinfo family to integer #29025

Closed
@povilasv

Description

@povilasv

Component(s)

processor/resourcedetection

What happened?

Description

system resource detection fails with:

{"level":"warn","ts":1699364976.361069,"caller":"system/system.go:102","msg":"failed to get host cpuinfo","kind":"processor","name":"resourcedetection/env","pipeline":"metrics","error":"failed to convert cpuinfo family to integer: strconv.ParseInt: parsing \"POWER\": invalid syntax"}

The issue is that system detector expects the family to be int in:

family, err := strconv.ParseInt(cpuInfo.Family, 10, 64)

But the actual library returns POWER string in certain cases:

SEE: https://github.com/shirou/gopsutil/blob/e74324b6a726997ce756b8f79dbbd7a3a0999ba0/cpu/cpu_linux.go#L264

Also looking at this repo which has a lot of example of cpuinfo, there seems to be a lot of families that are not numbers:

https://github.com/search?q=repo%3Arandombit%2Fcpuinfo%20Family&type=code

Steps to Reproduce

Expected Result

No error

Actual Result

Collector version

v0.88.0

Environment information

No response

OpenTelemetry Collector configuration

No response

Log output

No response

Additional context

I believe we need to change host.cpu.family to be a string resource attribute instead of int and get rid of parsing.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions