fetcher

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fetcher

type Fetcher interface {
	// GetHourly returns the prometheus collector that collects pricing data for hourly expenses.
	GetHourly() *prometheus.GaugeVec
	// GetMonthly returns the prometheus collector that collects pricing data for monthly expenses.
	GetMonthly() *prometheus.GaugeVec
	// Run executes a new data fetching cycle and updates the prometheus exposed collectors.
	Run(*hcloud.Client) error
}

Fetcher defines a common interface for types that fetch pricing data from the HCloud API.

func NewFloatingIP

func NewFloatingIP(pricing *PriceProvider, additionalLabels ...string) Fetcher

NewFloatingIP creates a new fetcher that will collect pricing information on floating IPs.

func NewLoadbalancer

func NewLoadbalancer(pricing *PriceProvider, additionalLabels ...string) Fetcher

NewLoadbalancer creates a new fetcher that will collect pricing information on load balancers.

func NewLoadbalancerTraffic added in v0.2.1

func NewLoadbalancerTraffic(pricing *PriceProvider, additionalLabels ...string) Fetcher

NewLoadbalancerTraffic creates a new fetcher that will collect pricing information on load balancer traffic.

func NewPrimaryIP added in v0.5.0

func NewPrimaryIP(pricing *PriceProvider, additionalLabels ...string) Fetcher

NewPrimaryIP creates a new fetcher that will collect pricing information on primary IPs.

func NewServer

func NewServer(pricing *PriceProvider, additionalLabels ...string) Fetcher

NewServer creates a new fetcher that will collect pricing information on servers.

func NewServerBackup

func NewServerBackup(pricing *PriceProvider, additionalLabels ...string) Fetcher

NewServerBackup creates a new fetcher that will collect pricing information on server backups.

func NewServerTraffic

func NewServerTraffic(pricing *PriceProvider, additionalLabels ...string) Fetcher

NewServerTraffic creates a new fetcher that will collect pricing information on server traffic.

func NewSnapshot

func NewSnapshot(pricing *PriceProvider, additionalLabels ...string) Fetcher

NewSnapshot creates a new fetcher that will collect pricing information on server snapshots.

func NewVolume

func NewVolume(pricing *PriceProvider, additionalLabels ...string) Fetcher

NewVolume creates a new fetcher that will collect pricing information on volumes.

type Fetchers added in v0.3.0

type Fetchers []Fetcher

Fetchers defines a type for a slice of fetchers that should be handled together.

func (Fetchers) MustRun added in v0.3.0

func (fetchers Fetchers) MustRun(client *hcloud.Client)

MustRun executes all contained fetchers and panics if any of them threw an error.

func (Fetchers) RegisterCollectors added in v0.3.0

func (fetchers Fetchers) RegisterCollectors(registry *prometheus.Registry)

RegisterCollectors registers all collectors of the contained fetchers into the passed registry.

func (Fetchers) Run added in v0.3.0

func (fetchers Fetchers) Run(client *hcloud.Client) error

Run executes all contained fetchers and returns a single error, even when multiple failures occurred.

type PriceProvider

type PriceProvider struct {
	Client *hcloud.Client
	// contains filtered or unexported fields
}

PriceProvider provides easy access to current HCloud prices.

func (*PriceProvider) FloatingIP

func (provider *PriceProvider) FloatingIP(ipType hcloud.FloatingIPType, location string) float64

FloatingIP returns the current price for a floating IP per month.

func (*PriceProvider) Image

func (provider *PriceProvider) Image() float64

Image returns the current price for an image per GB per month.

func (*PriceProvider) PrimaryIP added in v0.5.0

func (provider *PriceProvider) PrimaryIP(ipType hcloud.PrimaryIPType, location string) (hourly, monthly float64, err error)

PrimaryIP returns the current price for a primary IP per hour and month.

func (*PriceProvider) ServerBackup

func (provider *PriceProvider) ServerBackup() float64

ServerBackup returns the percentage of base price increase for server backups per month.

func (*PriceProvider) Sync

func (provider *PriceProvider) Sync()

Sync forces the provider to re-fetch prices from the HCloud API.

func (*PriceProvider) Traffic

func (provider *PriceProvider) Traffic() float64

Traffic returns the current price for a TB of extra traffic per month.

func (*PriceProvider) Volume

func (provider *PriceProvider) Volume() float64

Volume returns the current price for a volume per GB per month.

Jump to

Keyboard shortcuts

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