grafana / cloudcost-exporter

Prometheus Exporter for Cloud Provider agnostic cost metrics
Apache License 2.0
66 stars 4 forks source link

refactor(provider): Expand Provider interface to have Collect methods #69

Closed Pokom closed 10 months ago

Pokom commented 10 months ago

First commit in a series of commits to refactor the Provider interface to have Collect and Describe methods to implement the Prometheus Collector interface.

This updates all of the mocked interfaces as well.

Why

The primary goal is to use the standard InstrumentMetricHandler method to export metrics. This requires your collector(s) to instrument the Collect interface so that you can pass in channels to emit metrics to. This will allow us to emit new metrics between runs and prevent us from exporting stale metrics.

Pokom commented 10 months ago

One last thing I'd suggest is removing the usage of log (especially calling the global package functions) and instead replace it with an explicit dependency on *slog.Logger. WDYT?

@inkel Plan is to add structured logging in a dedicated commit. See #32

inkel commented 10 months ago

Noice!