model

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const TimestampDayLayout = "2006-01-02"

Variables

This section is empty.

Functions

This section is empty.

Types

type CostComputation

type CostComputation struct {
	Lines         []map[string]bigquery.Value
	ByteProcessed int64
	ExecutionTime time.Duration
	Query         string
}

CostComputation is the result of running a query

type LabeledCost

type LabeledCost struct {
	// The tag names must match those in the sql query
	Charges float64 `bigquery:"charges" json:"charges"`
	Credits float64 `bigquery:"credits" json:"credits"`

	ProjectName string `bigquery:"project_name" json:"project_name"`
	ProjectID   string `bigquery:"project_id" json:"project_id"`

	GCPService bigquery.NullString `bigquery:"gcp_service" json:"gcp_service"`
	Component  bigquery.NullString `bigquery:"component" json:"component,omitempty"`
	Service    bigquery.NullString `bigquery:"service" json:"service,omitempty"`
	Opex       bigquery.NullString `bigquery:"opex" json:"opex,omitempty"`
}

LabeledCost represents a row of the cost query

func LabeledCostFrom

func LabeledCostFrom(m map[string]bigquery.Value) LabeledCost

func (LabeledCost) GCPServiceMonitorLabel added in v0.2.3

func (c LabeledCost) GCPServiceMonitorLabel() string

GCPServiceMonitorLabel returns a Stackdriver friendly display label for the GCPService

type Params

type Params struct {
	// JSON tag names must match flag option names
	Opex       string `json:"opex,omitempty" `
	DayInMonth int    `json:"day" `
	MonthIndex int    `json:"month" `
	Year       int    `json:"year" `

	// Billing
	BillingTableFQN      string `json:"billing-table,omitempty" `
	QueryExecutionRegion string `json:"query-execution-region,omitempty" `
	QueryExecutionOpex   string `json:"query-execution-opex,omitempty" `
	// Target
	TargetTableFQN         string `json:"target-table,omitempty" `
	TargetDatasetRegion    string `json:"target-region,omitempty" `
	TargetMetricsProjectID string `json:"metrics-project-id,omitempty" `

	DryRun  bool `json:"dryrun" `
	Verbose bool `json:"v" `
}

Params captures all program flags

func ParamsFromContext

func ParamsFromContext(c *cli.Context) Params

func (Params) BillingProjectID

func (p Params) BillingProjectID() string

func (Params) Date

func (p Params) Date() time.Time

func (Params) JSON added in v0.0.2

func (p Params) JSON() string

func (Params) TargetDatasetID

func (p Params) TargetDatasetID() string

func (Params) TargetProjectID

func (p Params) TargetProjectID() string

func (Params) TargetTableID

func (p Params) TargetTableID() string

Jump to

Keyboard shortcuts

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