s3

package
v0.7.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 12, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
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.

func (*Collector) Describe

func (c *Collector) Describe(ch chan<- *prometheus.Desc) error

Describe is used to register the metrics with the Prometheus client

func (*Collector) Name

func (c *Collector) Name() string

func (*Collector) Register

func (c *Collector) Register(registry provider.Registry) error

Register is called prior to the first collection. It registers any custom metric that needs to be exported for AWS billing data

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.

func NewMetrics

func NewMetrics() Metrics

NewMetrics returns a new Metrics instance.

type Pricing

type Pricing struct {
	Usage    float64
	Cost     float64
	Units    string
	UnitCost float64
}

type PricingModel

type PricingModel struct {
	// Model is a map where string is the component and Pricing is the usage, cost and unit
	Model map[string]*Pricing
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL