nickbabcock/collectd-rust-plugin

Parsing value lists?

matthiasbeyer opened this issue · 3 comments

Hi, I'm new to collectd, so this might be completely wrong!

As far as I understand, collectd can submit collected data via MQTT for example. It does sovia the MQTT plugin, which serializes data into a value list.

So if I want to be able to read this data, I would need to parse this "value list" data structure into a rust type to be able to work with it conveniently. Is that right?

As far as I can see, this crate does not provide functionality for parsing value lists, only for building them. Would it be possible to add such functionality to this crate?


I understand if this is out of scope for this crate, of course!

Welcome! The MQTT plugin uses an internal collectd API called parse_values. Since parse_values is not exposed for us to wrap, we'd have to reimplement the parsing logic in Rust, which may be more work and error prone than simply wrapping a C function, but would have the added benefit that the collectd shared library wouldn't need to be accessible to use this functionality (I'm not sure what your deployment environment looks like and if omitting the collectd requirement would be seen as a good thing).

I'm not sure what your deployment environment looks like and if omitting the collectd requirement would be seen as a good thing

It definitively would be, as I'm only consuming collectd output data in my environment. That's also why I wrote

I understand if this is out of scope for this crate, of course!

as (, as far as I understand,) this library is meant to write components for collectd rather than interacting with its exported data.

Makes sense. I think parsing logic can certainly be exposed by this crate as coupling to a collectd instance is not required.