Documentation ¶
Index ¶
Constants ¶
const (
// This needs to line up with yace so we can properly join the data in PromQL
StandardLabel = "StandardStorage"
)
HoursInMonth is the average hours in a month, used to calculate the cost of storage If we wanted to be clever, we can get the number of hours in the current month 365.25 * 24 / 12 ~= 730.5
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BillingData ¶
type BillingData struct { // Regions is a map where string is the region and PricingModel is the value Regions map[string]*PricingModel }
BillingData is the struct for the data we will be collecting
func NewS3BillingData ¶
func NewS3BillingData() *BillingData
func (*BillingData) AddMetricGroup ¶
func (s *BillingData) AddMetricGroup(region string, component string, group types.Group)
AddMetricGroup adds a metric group to the Region. If the key is empty, it will not add the metric group to the Region. If the dimension is empty, it will not add the metric group to the Region. Dimensions are cumulative and will be added to the same dimension if the dimension already exists.
type Collector ¶
type Collector struct {
// contains filtered or unexported fields
}
Collector is the AWS implementation of the Collector interface It is responsible for registering and collecting metrics
func New ¶
func New(scrapeInterval time.Duration, client costexplorer.CostExplorer) *Collector
New creates a new Collector with a client and scrape interval defined.
func (*Collector) Collect ¶
func (c *Collector) Collect(ch chan<- prometheus.Metric) error
Collect is the function that will be called by the Prometheus client anytime a scrape is performed.
func (*Collector) CollectMetrics ¶
func (c *Collector) CollectMetrics(ch chan<- prometheus.Metric) float64
Collect is the function that will be called by the Prometheus client anytime a scrape is performed.
type Metrics ¶
type Metrics struct { // StorageGauge measures the cost of storage in $/GiB, per region and class. StorageGauge *prometheus.GaugeVec // OperationsGauge measures the cost of operations in $/1k requests OperationsGauge *prometheus.GaugeVec // RequestCount is a counter that tracks the number of requests made to the AWS Cost Explorer API RequestCount prometheus.Counter // RequestErrorsCount is a counter that tracks the number of errors when making requests to the AWS Cost Explorer API RequestErrorsCount prometheus.Counter // NextScrapeGauge is a gauge that tracks the next time the exporter will scrape AWS billing data NextScrapeGauge prometheus.Gauge }
Metrics exported by this collector.