costupdater

package
v0.0.0-...-10dfb09 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UpsertBatchSize = 100000
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Updater)

Option is a function that can be used to set custom options for the cost updater

func WithBigQueryTable

func WithBigQueryTable(table string) Option

WithBigQueryTable will set a custom BigQuery table to fetch data from

func WithDaysToFetch

func WithDaysToFetch(daysToFetch int) Option

WithDaysToFetch will set a custom number of days to fetch from BigQuery

type Updater

type Updater struct {
	// contains filtered or unexported fields
}

Updater is the cost updater struct

func NewCostUpdater

func NewCostUpdater(bigQueryClient *bigquery.Client, querier costsql.Querier, tenantName string, log logrus.FieldLogger, opts ...Option) *Updater

NewCostUpdater creates a new cost updater

func (*Updater) FetchBigQueryData

func (u *Updater) FetchBigQueryData(ctx context.Context, ch chan<- costsql.CostUpsertParams) error

FetchBigQueryData fetches cost data from BigQuery and sends it to the provided channel

func (*Updater) RefreshView

func (u *Updater) RefreshView(ctx context.Context) error

func (*Updater) ShouldUpdateCosts

func (u *Updater) ShouldUpdateCosts(ctx context.Context) (bool, error)

ShouldUpdateCosts returns true if costs should be updated, false otherwise

func (*Updater) UpdateCosts

func (u *Updater) UpdateCosts(ctx context.Context, ch <-chan costsql.CostUpsertParams) error

UpdateCosts will update the cost data in the database based on data from the provided channel

Jump to

Keyboard shortcuts

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