Prometheus back-end for history

A feature that I’ve been thinking about is Prometheus for the history addon, instead of MySQL or the other RDBMS back-ends. I’d like to look into this myself to build, but I’m curious if there’s attraction for it in the community/suggestions from devs as I haven’t looked in the complexity yet.

The purposed implementation would be to move a large portion of the time-series MySQL data to Prometheus and read history from Prometheus. Entity states should still be stored in-memory (preferably not MySQL). Furthermore it would involve exposing an official /metrics endpoint (or maybe re-use the Prometheus exporter that’s currently available) that Prometheus is able to scrape and provide data for the history plugin.

I’m suggesting this because I’m having scalability issues with MySQL. In the recent changes this became a bit better, but still - I experience a wide variety of locking issues and performance bottlenecks. In another project I’ve got Prometheus up-and-running, in which I scrape way more data (about ~10Mbps of data continuously) then Home Assistant currently does - on a smaller server.

Curious to your idea, thanks & Stay Safe,
Wouter

Hi @Wouter0100 !
Can you please elaborate on this feature a bit more?

Sure! What kind of additional information would you like to have?

It’s a replacement for the history kept in MySQL. Prometheus is specially designed for such a purpose, and perfect for this use-case. In that case it would be awesome to be able to swap out MySQL as a history backend with Prometheus.

Prometheus is a TSDB as well as VictoriaMetrics. But the main differens between Prometheus TSDB and MYSQL is that Prometheus can’t store string or char types. So could you explain what type of data you mean when say “history backend” ?