mweinelt / kea-exporter

Export Kea Metrics in the Prometheus Exposition Format
MIT License
34 stars 17 forks source link

Optional interval #45

Closed Qwiko closed 8 months ago

Qwiko commented 8 months ago

Proposed solution for: #38. I am not sure if we should make interval optional or if we should remove it completely. My implementation with optional interval looks messy and could confuse users about functionality. However some users that have many prometheus pollers could have a use-case for interval-based polling instead to limit load on the service.

@mweinelt what do you think?

Qwiko commented 8 months ago

I remade my implementation to use a counter-class instead that is more elegant in my opinion. If interval == 0 exporter.update will always run.

Qwiko commented 8 months ago

Refactored to timer instead of counter.

Qwiko commented 8 months ago

If it works, I'd be okay with that approach.

~Need to run black on it. Reminds me that I wanted to migrate to ruff at some point, but oh well.~

Can you run ruff format?

I have now run ruff format

Qwiko commented 8 months ago

I did a rebase to reflect all new changes to main. I don't know if I broke anything, @mweinelt please check 😊

Qwiko commented 8 months ago

I fixed my rebase to protect other commits.

mweinelt commented 8 months ago

Tested and looks like it does what it claims to do. Thanks!