lukasmalkmus / rpi_exporter

A Raspberry Pi CPU temperature exporter.
Apache License 2.0
78 stars 17 forks source link

Store prometheus http handlers instead of recreating them for every request #23

Closed ToMe25 closed 11 months ago

ToMe25 commented 1 year ago

This PR changes the http handler to store the internal http.Handler object for every filter combination, instead of recreating them for every request.

The node exporter only stores the unfiltered one, and recreates the filtered ones, if they are needed.
I believe it is fine to store the filtered ones in this project, because having only 3 collectors means there are 7 filter combinations(plus the unfiltered one) at most.
However I would be fine with recreating the filtered ones, if you believe this isn't worth the additional RAM it uses.

Closes #22