prometheus-community / ipmi_exporter

Remote IPMI exporter for Prometheus
MIT License
473 stars 133 forks source link

fix unsupported value type in debug logs due to attempting to log structs directly #88

Closed snaar closed 2 years ago

snaar commented 3 years ago

Instead of this:

level=debug ts=2021-11-09T05:12:58.244Z caller=freeipmi.go:139 msg=Executing command=ipmimonitoring args="unsupported value type"
level=debug ts=2021-11-09T05:12:58.475Z caller=collector_ipmi.go:161 msg="Got values" data="unsupported value type"

You get this now:

level=debug ts=2021-11-09T05:41:58.307Z caller=freeipmi.go:139 msg=Executing command=ipmimonitoring args="[--entity-sensor-names --record-ids=<...> -Q --ignore-unrecognized-events --comma-separated-output --no-header-output --sdr-cache-recreate --output-event-bitmask --config-file <...> -h <...>]"
level=debug ts=2021-11-09T05:41:58.542Z caller=collector_ipmi.go:162 msg="Got values" data="{ID:91 Name:Power Supply 1 Current 1 Type:Current State:Nominal Value:1.4 Unit:A Event:00C0h}"
bitfehler commented 2 years ago

Thanks for looking into this. I am not sure if this is the right approach, though. I was hoping that the new structured logging library could handle, well, structures, like arrays.

@SuperQ can you comment on what the right way to handle this would be? Stringify like or this, or can we make the lib handle arrays?

SuperQ commented 2 years ago

Huh, I guess go-kit/log doesn't support slice or struct values.

bitfehler commented 2 years ago

Alright, then let's get this fixed like this for now, and I'll see if there if there is more idiomatic approach to this once I am back on top of things here. Thanks a lot, @snaar !