metrics-rs / metrics

A metrics ecosystem for Rust.
MIT License
1.08k stars 148 forks source link

`no_std` support #441

Open elpiel opened 7 months ago

elpiel commented 7 months ago

Hello, I just noticed that metrics still only supports std env. and it would be beneficial to take a look at how much effort is needed to make it no_std and suitable for use in embedded systems.

tobz commented 6 months ago

A while ago, I had tried to add the relevant cfg flags and what not to support no_std environments, but truthfully, I myself don't have any no_std projects so the support was purely theoretical and based on the other code required (like an exporter that was also no_std compatible), we removed all the no_std bits to avoid any confusion/frustration.

If you wanted to do some of this exploration work, perhaps by forking the library and seeing how much work it took to get it working in a no_std environment, I'd be interested in seeing that and helping/guiding where possible.

Unfortunately, this isn't something I can commit any time to researching.

elpiel commented 6 months ago

Thank you very much for your response @tobz . Apart from embedded systems it seems that there are more and more container runtimes that can run no_std in Linux user space. I might look into it and see how much work it is to do it. Given the fact that the embedded ecosystem is growing rapidly, it might be a good opportunity to introduce this to metrics but only if it's worth it.

The go-to-standard for logging - defmt is specifically created to support no_std and log also supports it but there isn't anything for metrics yet.