Skip to content

Use Tickers to populate EC2 pricing maps #274

Open
@paulajulve

Description

@paulajulve

Follow up to #235

Currently these are populated within the main routine in the Collect method on the ec2 package. It means that every time the exporter goes to collect the metrics, it stops to first check if the compute one is outdated, if it is, populate it, and then the same for the storage one, before moving on to actually collecting the metrics that we want to expose.

This responsibility should not belong to the Collect method. Instead, we could follow the same pattern as the aks package:

  • create the maps within the New function instead of the Collect one
  • create tickers for each
  • delegate population to the methods of the map structs themselves
  • spin up a background go routine for them to re-populate in the background whenever they expire, independent of each other and of the Collect function

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions