Documentation
¶
Index ¶
- Constants
- func BingenFileBackedStringTableDir() string
- func ConfigureBingen(config *BingenConfiguration)
- func DurationOffsetStrings(_ time.Duration, _ time.Duration) (string, string)
- func IsBingenFileBackedStringTableEnabled() bool
- func ParseProperty(text string) (string, error)
- func ParseProvider(str string) string
- func RoundBack(t time.Time, resolution time.Duration) time.Time
- func RoundForward(t time.Time, resolution time.Duration) time.Time
- type Allocation
- func (a *Allocation) Add(that *Allocation) (*Allocation, error)
- func (a *Allocation) CPUCores() float64
- func (a *Allocation) CPUEfficiency() float64
- func (a *Allocation) CPUTotalCost() float64
- func (a *Allocation) Clone() *Allocation
- func (a *Allocation) GPUTotalCost() float64
- func (a *Allocation) GPUs() float64
- func (a *Allocation) IsAggregated() bool
- func (a *Allocation) IsExternal() bool
- func (a *Allocation) IsIdle() bool
- func (a *Allocation) IsUnallocated() bool
- func (a *Allocation) LBTotalCost() float64
- func (target *Allocation) MarshalBinary() (data []byte, err error)
- func (target *Allocation) MarshalBinaryWithContext(ctx *EncodingContext) (err error)
- func (a *Allocation) Minutes() float64
- func (a *Allocation) NetworkTotalCost() float64
- func (a *Allocation) PVByteHours() float64
- func (a *Allocation) PVBytes() float64
- func (a *Allocation) PVCost() float64
- func (a *Allocation) PVTotalCost() float64
- func (a *Allocation) RAMBytes() float64
- func (a *Allocation) RAMEfficiency() float64
- func (a *Allocation) RAMTotalCost() float64
- func (a *Allocation) ResetAdjustments()
- func (a *Allocation) Resolution() time.Duration
- func (a *Allocation) Share(that *Allocation) (*Allocation, error)
- func (a *Allocation) SharedTotalCost() float64
- func (a *Allocation) String() string
- func (a *Allocation) TotalCost() float64
- func (a *Allocation) TotalEfficiency() float64
- func (target *Allocation) UnmarshalBinary(data []byte) error
- func (target *Allocation) UnmarshalBinaryFromReader(reader io.Reader) error
- func (target *Allocation) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error)
- type AllocationAggregationOptions
- type AllocationAnnotations
- type AllocationLabels
- type AllocationMatchFunc
- type AllocationProperties
- func (p *AllocationProperties) Clone() *AllocationProperties
- func (p *AllocationProperties) Equal(that *AllocationProperties) bool
- func (p *AllocationProperties) Intersection(that *AllocationProperties) *AllocationProperties
- func (target *AllocationProperties) MarshalBinary() (data []byte, err error)
- func (target *AllocationProperties) MarshalBinaryWithContext(ctx *EncodingContext) (err error)
- func (p *AllocationProperties) String() string
- func (target *AllocationProperties) UnmarshalBinary(data []byte) error
- func (target *AllocationProperties) UnmarshalBinaryFromReader(reader io.Reader) error
- func (target *AllocationProperties) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error)
- type AllocationSet
- func (as *AllocationSet) AggregateBy(aggregateBy []string, options *AllocationAggregationOptions) error
- func (as *AllocationSet) Clone() *AllocationSet
- func (as *AllocationSet) ComputeIdleAllocations(assetSet *AssetSet) (map[string]*Allocation, error)
- func (as *AllocationSet) ComputeIdleAllocationsByNode(assetSet *AssetSet) (map[string]*Allocation, error)
- func (as *AllocationSet) Delete(name string)
- func (as *AllocationSet) Each(f func(string, *Allocation))
- func (as *AllocationSet) End() time.Time
- func (as *AllocationSet) ExternalAllocations() map[string]*Allocation
- func (as *AllocationSet) ExternalCost() float64
- func (as *AllocationSet) Get(key string) *Allocation
- func (as *AllocationSet) IdleAllocations() map[string]*Allocation
- func (as *AllocationSet) Insert(that *Allocation) error
- func (as *AllocationSet) IsEmpty() bool
- func (as *AllocationSet) Length() int
- func (as *AllocationSet) Map() map[string]*Allocation
- func (target *AllocationSet) MarshalBinary() (data []byte, err error)
- func (target *AllocationSet) MarshalBinaryWithContext(ctx *EncodingContext) (err error)
- func (as *AllocationSet) MarshalJSON() ([]byte, error)
- func (as *AllocationSet) Resolution() time.Duration
- func (as *AllocationSet) Set(alloc *Allocation) error
- func (as *AllocationSet) Start() time.Time
- func (as *AllocationSet) String() string
- func (as *AllocationSet) TotalCost() float64
- func (as *AllocationSet) UTCOffset() time.Duration
- func (target *AllocationSet) UnmarshalBinary(data []byte) error
- func (target *AllocationSet) UnmarshalBinaryFromReader(reader io.Reader) error
- func (target *AllocationSet) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error)
- type AllocationSetRange
- func (asr *AllocationSetRange) Accumulate() (*AllocationSet, error)
- func (asr *AllocationSetRange) AggregateBy(aggregateBy []string, options *AllocationAggregationOptions) error
- func (asr *AllocationSetRange) Append(that *AllocationSet)
- func (asr *AllocationSetRange) Each(f func(int, *AllocationSet))
- func (asr *AllocationSetRange) Get(i int) (*AllocationSet, error)
- func (asr *AllocationSetRange) InsertRange(that *AllocationSetRange) error
- func (asr *AllocationSetRange) Length() int
- func (target *AllocationSetRange) MarshalBinary() (data []byte, err error)
- func (target *AllocationSetRange) MarshalBinaryWithContext(ctx *EncodingContext) (err error)
- func (asr *AllocationSetRange) MarshalJSON() ([]byte, error)
- func (asr *AllocationSetRange) Slice() []*AllocationSet
- func (asr *AllocationSetRange) String() string
- func (asr *AllocationSetRange) UTCOffset() time.Duration
- func (target *AllocationSetRange) UnmarshalBinary(data []byte) error
- func (target *AllocationSetRange) UnmarshalBinaryFromReader(reader io.Reader) error
- func (target *AllocationSetRange) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error)
- func (asr *AllocationSetRange) Window() Window
- type AllocationSetStream
- type Any
- func (a *Any) Add(that Asset) Asset
- func (a *Any) Adjustment() float64
- func (a *Any) Clone() Asset
- func (a *Any) End() time.Time
- func (a *Any) Equal(that Asset) bool
- func (a *Any) ExpandWindow(window Window)
- func (a *Any) Labels() AssetLabels
- func (target *Any) MarshalBinary() (data []byte, err error)
- func (target *Any) MarshalBinaryWithContext(ctx *EncodingContext) (err error)
- func (a *Any) MarshalJSON() ([]byte, error)
- func (a *Any) Minutes() float64
- func (a *Any) Properties() *AssetProperties
- func (a *Any) SetAdjustment(adj float64)
- func (a *Any) SetLabels(labels AssetLabels)
- func (a *Any) SetProperties(props *AssetProperties)
- func (a *Any) SetStartEnd(start, end time.Time)
- func (a *Any) Start() time.Time
- func (a *Any) String() string
- func (a *Any) TotalCost() float64
- func (a *Any) Type() AssetType
- func (target *Any) UnmarshalBinary(data []byte) error
- func (target *Any) UnmarshalBinaryFromReader(reader io.Reader) error
- func (target *Any) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error)
- func (a *Any) Window() Window
- type Asset
- type AssetAggregationOptions
- type AssetLabels
- type AssetMatchFunc
- type AssetProperties
- func (ap *AssetProperties) Clone() *AssetProperties
- func (ap *AssetProperties) Equal(that *AssetProperties) bool
- func (ap *AssetProperties) Keys(props []AssetProperty) []string
- func (target *AssetProperties) MarshalBinary() (data []byte, err error)
- func (target *AssetProperties) MarshalBinaryWithContext(ctx *EncodingContext) (err error)
- func (ap *AssetProperties) Merge(that *AssetProperties) *AssetProperties
- func (ap *AssetProperties) String() string
- func (target *AssetProperties) UnmarshalBinary(data []byte) error
- func (target *AssetProperties) UnmarshalBinaryFromReader(reader io.Reader) error
- func (target *AssetProperties) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error)
- type AssetProperty
- type AssetSet
- func (as *AssetSet) AggregateBy(aggregateBy []string, opts *AssetAggregationOptions) error
- func (as *AssetSet) Clone() *AssetSet
- func (as *AssetSet) Each(f func(string, Asset))
- func (as *AssetSet) End() time.Time
- func (as *AssetSet) FindMatch(query Asset, aggregateBy []string) (Asset, error)
- func (as *AssetSet) Get(key string) (Asset, bool)
- func (as *AssetSet) Insert(asset Asset) error
- func (as *AssetSet) IsEmpty() bool
- func (as *AssetSet) Length() int
- func (as *AssetSet) Map() map[string]Asset
- func (target *AssetSet) MarshalBinary() (data []byte, err error)
- func (target *AssetSet) MarshalBinaryWithContext(ctx *EncodingContext) (err error)
- func (as *AssetSet) MarshalJSON() ([]byte, error)
- func (as *AssetSet) ReconciliationMatch(query Asset) (Asset, bool, error)
- func (as *AssetSet) Set(asset Asset, aggregateBy []string) error
- func (as *AssetSet) Start() time.Time
- func (as *AssetSet) TotalCost() float64
- func (as *AssetSet) UTCOffset() time.Duration
- func (target *AssetSet) UnmarshalBinary(data []byte) error
- func (target *AssetSet) UnmarshalBinaryFromReader(reader io.Reader) error
- func (target *AssetSet) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error)
- type AssetSetRange
- func (asr *AssetSetRange) Accumulate() (*AssetSet, error)
- func (asr *AssetSetRange) AggregateBy(aggregateBy []string, opts *AssetAggregationOptions) error
- func (asr *AssetSetRange) Append(that *AssetSet)
- func (asr *AssetSetRange) Each(f func(int, *AssetSet))
- func (asr *AssetSetRange) Get(i int) (*AssetSet, error)
- func (asr *AssetSetRange) Length() int
- func (target *AssetSetRange) MarshalBinary() (data []byte, err error)
- func (target *AssetSetRange) MarshalBinaryWithContext(ctx *EncodingContext) (err error)
- func (asr *AssetSetRange) MarshalJSON() ([]byte, error)
- func (asr *AssetSetRange) UTCOffset() time.Duration
- func (target *AssetSetRange) UnmarshalBinary(data []byte) error
- func (target *AssetSetRange) UnmarshalBinaryFromReader(reader io.Reader) error
- func (target *AssetSetRange) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error)
- func (asr *AssetSetRange) Window() Window
- type AssetSetStream
- type AssetType
- type BinDecoder
- type BinEncoder
- type BingenConfiguration
- type BingenFieldInfo
- type BingenStream
- type BingenValue
- type BoundaryError
- type Breakdown
- func (b *Breakdown) Clone() *Breakdown
- func (b *Breakdown) Equal(that *Breakdown) bool
- func (target *Breakdown) MarshalBinary() (data []byte, err error)
- func (target *Breakdown) MarshalBinaryWithContext(ctx *EncodingContext) (err error)
- func (target *Breakdown) UnmarshalBinary(data []byte) error
- func (target *Breakdown) UnmarshalBinaryFromReader(reader io.Reader) error
- func (target *Breakdown) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error)
- type Cloud
- func (ca *Cloud) Add(a Asset) Asset
- func (ca *Cloud) Adjustment() float64
- func (ca *Cloud) Clone() Asset
- func (ca *Cloud) End() time.Time
- func (ca *Cloud) Equal(a Asset) bool
- func (ca *Cloud) ExpandWindow(window Window)
- func (ca *Cloud) Labels() AssetLabels
- func (target *Cloud) MarshalBinary() (data []byte, err error)
- func (target *Cloud) MarshalBinaryWithContext(ctx *EncodingContext) (err error)
- func (ca *Cloud) MarshalJSON() ([]byte, error)
- func (ca *Cloud) Minutes() float64
- func (ca *Cloud) Properties() *AssetProperties
- func (ca *Cloud) SetAdjustment(adj float64)
- func (ca *Cloud) SetLabels(labels AssetLabels)
- func (ca *Cloud) SetProperties(props *AssetProperties)
- func (ca *Cloud) SetStartEnd(start, end time.Time)
- func (ca *Cloud) Start() time.Time
- func (ca *Cloud) String() string
- func (ca *Cloud) TotalCost() float64
- func (ca *Cloud) Type() AssetType
- func (target *Cloud) UnmarshalBinary(data []byte) error
- func (target *Cloud) UnmarshalBinaryFromReader(reader io.Reader) error
- func (target *Cloud) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error)
- func (ca *Cloud) Window() Window
- type ClusterManagement
- func (cm *ClusterManagement) Add(a Asset) Asset
- func (cm *ClusterManagement) Adjustment() float64
- func (cm *ClusterManagement) Clone() Asset
- func (cm *ClusterManagement) End() time.Time
- func (cm *ClusterManagement) Equal(a Asset) bool
- func (cm *ClusterManagement) ExpandWindow(window Window)
- func (cm *ClusterManagement) Labels() AssetLabels
- func (target *ClusterManagement) MarshalBinary() (data []byte, err error)
- func (target *ClusterManagement) MarshalBinaryWithContext(ctx *EncodingContext) (err error)
- func (cm *ClusterManagement) MarshalJSON() ([]byte, error)
- func (cm *ClusterManagement) Minutes() float64
- func (cm *ClusterManagement) Properties() *AssetProperties
- func (cm *ClusterManagement) SetAdjustment(float64)
- func (cm *ClusterManagement) SetLabels(props AssetLabels)
- func (cm *ClusterManagement) SetProperties(props *AssetProperties)
- func (cm *ClusterManagement) SetStartEnd(start, end time.Time)
- func (cm *ClusterManagement) Start() time.Time
- func (cm *ClusterManagement) String() string
- func (cm *ClusterManagement) TotalCost() float64
- func (cm *ClusterManagement) Type() AssetType
- func (target *ClusterManagement) UnmarshalBinary(data []byte) error
- func (target *ClusterManagement) UnmarshalBinaryFromReader(reader io.Reader) error
- func (target *ClusterManagement) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error)
- func (cm *ClusterManagement) Window() Window
- type DecodingContext
- type Disk
- func (d *Disk) Add(a Asset) Asset
- func (d *Disk) Adjustment() float64
- func (d *Disk) Bytes() float64
- func (d *Disk) Clone() Asset
- func (d *Disk) End() time.Time
- func (d *Disk) Equal(a Asset) bool
- func (d *Disk) ExpandWindow(window Window)
- func (d *Disk) Labels() AssetLabels
- func (target *Disk) MarshalBinary() (data []byte, err error)
- func (target *Disk) MarshalBinaryWithContext(ctx *EncodingContext) (err error)
- func (d *Disk) MarshalJSON() ([]byte, error)
- func (d *Disk) Minutes() float64
- func (d *Disk) Properties() *AssetProperties
- func (d *Disk) SetAdjustment(adj float64)
- func (d *Disk) SetLabels(labels AssetLabels)
- func (d *Disk) SetProperties(props *AssetProperties)
- func (d *Disk) SetStartEnd(start, end time.Time)
- func (d *Disk) Start() time.Time
- func (d *Disk) String() string
- func (d *Disk) TotalCost() float64
- func (d *Disk) Type() AssetType
- func (target *Disk) UnmarshalBinary(data []byte) error
- func (target *Disk) UnmarshalBinaryFromReader(reader io.Reader) error
- func (target *Disk) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error)
- func (d *Disk) Window() Window
- type EncodingContext
- type FileStringTableReader
- type LoadBalancer
- func (lb *LoadBalancer) Add(a Asset) Asset
- func (lb *LoadBalancer) Adjustment() float64
- func (lb *LoadBalancer) Clone() Asset
- func (lb *LoadBalancer) End() time.Time
- func (lb *LoadBalancer) Equal(a Asset) bool
- func (lb *LoadBalancer) ExpandWindow(w Window)
- func (lb *LoadBalancer) Labels() AssetLabels
- func (target *LoadBalancer) MarshalBinary() (data []byte, err error)
- func (target *LoadBalancer) MarshalBinaryWithContext(ctx *EncodingContext) (err error)
- func (lb *LoadBalancer) MarshalJSON() ([]byte, error)
- func (lb *LoadBalancer) Minutes() float64
- func (lb *LoadBalancer) Properties() *AssetProperties
- func (lb *LoadBalancer) SetAdjustment(adj float64)
- func (lb *LoadBalancer) SetLabels(labels AssetLabels)
- func (lb *LoadBalancer) SetProperties(props *AssetProperties)
- func (lb *LoadBalancer) SetStartEnd(start, end time.Time)
- func (lb *LoadBalancer) Start() time.Time
- func (lb *LoadBalancer) String() string
- func (lb *LoadBalancer) TotalCost() float64
- func (lb *LoadBalancer) Type() AssetType
- func (target *LoadBalancer) UnmarshalBinary(data []byte) error
- func (target *LoadBalancer) UnmarshalBinaryFromReader(reader io.Reader) error
- func (target *LoadBalancer) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error)
- func (lb *LoadBalancer) Window() Window
- type Network
- func (n *Network) Add(a Asset) Asset
- func (n *Network) Adjustment() float64
- func (n *Network) Clone() Asset
- func (n *Network) End() time.Time
- func (n *Network) Equal(a Asset) bool
- func (n *Network) ExpandWindow(window Window)
- func (n *Network) Labels() AssetLabels
- func (target *Network) MarshalBinary() (data []byte, err error)
- func (target *Network) MarshalBinaryWithContext(ctx *EncodingContext) (err error)
- func (n *Network) MarshalJSON() ([]byte, error)
- func (n *Network) Minutes() float64
- func (n *Network) Properties() *AssetProperties
- func (n *Network) SetAdjustment(adj float64)
- func (n *Network) SetLabels(labels AssetLabels)
- func (n *Network) SetProperties(props *AssetProperties)
- func (n *Network) SetStartEnd(start, end time.Time)
- func (n *Network) Start() time.Time
- func (n *Network) String() string
- func (n *Network) TotalCost() float64
- func (n *Network) Type() AssetType
- func (target *Network) UnmarshalBinary(data []byte) error
- func (target *Network) UnmarshalBinaryFromReader(reader io.Reader) error
- func (target *Network) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error)
- func (n *Network) Window() Window
- type Node
- func (n *Node) Add(a Asset) Asset
- func (n *Node) Adjustment() float64
- func (n *Node) CPUCores() float64
- func (n *Node) Clone() Asset
- func (n *Node) End() time.Time
- func (n *Node) Equal(a Asset) bool
- func (n *Node) ExpandWindow(window Window)
- func (n *Node) GPUs() float64
- func (n *Node) IsPreemptible() bool
- func (n *Node) Labels() AssetLabels
- func (target *Node) MarshalBinary() (data []byte, err error)
- func (target *Node) MarshalBinaryWithContext(ctx *EncodingContext) (err error)
- func (n *Node) MarshalJSON() ([]byte, error)
- func (n *Node) Minutes() float64
- func (n *Node) Properties() *AssetProperties
- func (n *Node) RAMBytes() float64
- func (n *Node) SetAdjustment(adj float64)
- func (n *Node) SetLabels(labels AssetLabels)
- func (n *Node) SetProperties(props *AssetProperties)
- func (n *Node) SetStartEnd(start, end time.Time)
- func (n *Node) Start() time.Time
- func (n *Node) String() string
- func (n *Node) TotalCost() float64
- func (n *Node) Type() AssetType
- func (target *Node) UnmarshalBinary(data []byte) error
- func (target *Node) UnmarshalBinaryFromReader(reader io.Reader) error
- func (target *Node) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error)
- func (n *Node) Window() Window
- type PVAllocation
- func (target *PVAllocation) MarshalBinary() (data []byte, err error)
- func (target *PVAllocation) MarshalBinaryWithContext(ctx *EncodingContext) (err error)
- func (target *PVAllocation) UnmarshalBinary(data []byte) error
- func (target *PVAllocation) UnmarshalBinaryFromReader(reader io.Reader) error
- func (target *PVAllocation) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error)
- type PVAllocations
- type PVKey
- func (target *PVKey) MarshalBinary() (data []byte, err error)
- func (target *PVKey) MarshalBinaryWithContext(ctx *EncodingContext) (err error)
- func (target *PVKey) UnmarshalBinary(data []byte) error
- func (target *PVKey) UnmarshalBinaryFromReader(reader io.Reader) error
- func (target *PVKey) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error)
- type RawAllocationOnlyData
- func (r *RawAllocationOnlyData) Clone() *RawAllocationOnlyData
- func (target *RawAllocationOnlyData) MarshalBinary() (data []byte, err error)
- func (target *RawAllocationOnlyData) MarshalBinaryWithContext(ctx *EncodingContext) (err error)
- func (target *RawAllocationOnlyData) UnmarshalBinary(data []byte) error
- func (target *RawAllocationOnlyData) UnmarshalBinaryFromReader(reader io.Reader) error
- func (target *RawAllocationOnlyData) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error)
- type SharedAsset
- func (sa *SharedAsset) Add(a Asset) Asset
- func (sa *SharedAsset) Adjustment() float64
- func (sa *SharedAsset) Clone() Asset
- func (sa *SharedAsset) End() time.Time
- func (sa *SharedAsset) Equal(a Asset) bool
- func (sa *SharedAsset) ExpandWindow(w Window)
- func (sa *SharedAsset) Labels() AssetLabels
- func (target *SharedAsset) MarshalBinary() (data []byte, err error)
- func (target *SharedAsset) MarshalBinaryWithContext(ctx *EncodingContext) (err error)
- func (sa *SharedAsset) MarshalJSON() ([]byte, error)
- func (sa *SharedAsset) Minutes() float64
- func (sa *SharedAsset) Properties() *AssetProperties
- func (sa *SharedAsset) SetAdjustment(float64)
- func (sa *SharedAsset) SetLabels(labels AssetLabels)
- func (sa *SharedAsset) SetProperties(props *AssetProperties)
- func (sa *SharedAsset) SetStartEnd(start, end time.Time)
- func (sa *SharedAsset) Start() time.Time
- func (sa *SharedAsset) String() string
- func (sa *SharedAsset) TotalCost() float64
- func (sa *SharedAsset) Type() AssetType
- func (target *SharedAsset) UnmarshalBinary(data []byte) error
- func (target *SharedAsset) UnmarshalBinaryFromReader(reader io.Reader) error
- func (target *SharedAsset) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error)
- func (sa *SharedAsset) Window() Window
- type SliceStringTableReader
- type StreamFactoryFunc
- type StringTableReader
- type StringTableWriter
- type Window
- func NewClosedWindow(start, end time.Time) Window
- func NewWindow(start, end *time.Time) Window
- func ParseWindowUTC(window string) (Window, error)
- func ParseWindowWithOffset(window string, offset time.Duration) (Window, error)
- func ParseWindowWithOffsetString(window string, offset string) (Window, error)
- func (w Window) ApproximatelyEqual(that Window, threshold time.Duration) bool
- func (w Window) Clone() Window
- func (w Window) Contains(t time.Time) bool
- func (w Window) Duration() time.Duration
- func (w Window) DurationOffset() (time.Duration, time.Duration, error)
- func (w Window) DurationOffsetForPrometheus() (string, string, error)
- func (w Window) DurationOffsetStrings() (string, string)
- func (w Window) End() *time.Time
- func (w Window) Equal(that Window) bool
- func (w Window) Expand(that Window) Window
- func (w Window) ExpandEnd(end time.Time) Window
- func (w Window) ExpandStart(start time.Time) Window
- func (w Window) Hours() float64
- func (w Window) IsEmpty() bool
- func (w Window) IsNegative() bool
- func (w Window) IsOpen() bool
- func (target *Window) MarshalBinary() (data []byte, err error)
- func (target *Window) MarshalBinaryWithContext(ctx *EncodingContext) (err error)
- func (w Window) MarshalJSON() ([]byte, error)
- func (w Window) Minutes() float64
- func (w Window) Set(start, end *time.Time)
- func (w Window) Shift(dur time.Duration) Window
- func (w Window) Start() *time.Time
- func (w Window) String() string
- func (target *Window) UnmarshalBinary(data []byte) error
- func (target *Window) UnmarshalBinaryFromReader(reader io.Reader) error
- func (target *Window) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error)
Constants ¶
const ( AllocationNilProp string = "" AllocationClusterProp string = "cluster" AllocationNodeProp string = "node" AllocationContainerProp string = "container" AllocationControllerProp string = "controller" AllocationControllerKindProp string = "controllerKind" AllocationNamespaceProp string = "namespace" AllocationPodProp string = "pod" AllocationProviderIDProp string = "providerID" AllocationServiceProp string = "service" AllocationLabelProp string = "label" AllocationAnnotationProp string = "annotation" AllocationDeploymentProp string = "deployment" AllocationStatefulSetProp string = "statefulset" AllocationDaemonSetProp string = "daemonset" AllocationJobProp string = "job" )
const ( // GeneratorPackageName is the package the generator is targetting GeneratorPackageName string = "opencost" // BinaryTagStringTable is written and/or read prior to the existence of a string // table (where each index is encoded as a string entry in the resource BinaryTagStringTable string = "BGST" // DefaultCodecVersion is used for any resources listed in the Default version set DefaultCodecVersion uint8 = 16 // AssetsCodecVersion is used for any resources listed in the Assets version set AssetsCodecVersion uint8 = 16 // AllocationCodecVersion is used for any resources listed in the Allocation version set AllocationCodecVersion uint8 = 16 )
const AWSProvider = "AWS"
AWSProvider describes the provider AWS
const AzureProvider = "Azure"
AzureProvider describes the provider Azure
const ComputeCategory = "Compute"
ComputeCategory signifies the Compute Category
const ExternalSuffix = "__external__"
ExternalSuffix indicates an external allocation
const GCPProvider = "GCP"
GCPProvider describes the provider GCP
const IdleSuffix = "__idle__"
IdleSuffix indicates an idle allocation property
const KubernetesService = "Kubernetes"
const ManagementCategory = "Management"
ManagementCategory signifies the Management Category
const NetworkCategory = "Network"
NetworkCategory signifies the Network Category
const NilProvider = "-"
NilProvider describes unknown provider
const OtherCategory = "Other"
OtherCategory signifies an unassigned Category
ShareEven indicates that a shared resource should be shared evenly across all remaining allocations.
ShareNone indicates that a shareable resource should not be shared
ShareWeighted indicates that a shared resource should be shared as a proportion of the cost of the remaining allocations.
SharedCategory signifies an unassigned Category
SharedSuffix indicates an shared allocation property
const StorageCategory = "Storage"
StorageCategory signifies the Storage Category
const UnallocatedSuffix = "__unallocated__"
UnallocatedSuffix indicates an unallocated allocation property
const UndefinedKey = "__undefined__"
UndefinedKey is used in composing Asset group keys if the group does not have that property defined. E.g. if aggregating on Cluster, Assets in the AssetSet where Asset has no cluster will be grouped under key "__undefined__"
const UnmountedSuffix = "__unmounted__"
UnmountedSuffix indicated allocation to an unmounted PV
Variables ¶
This section is empty.
Functions ¶
func BingenFileBackedStringTableDir ¶
func BingenFileBackedStringTableDir() string
BingenFileBackedStringTableDir returns the directory configured for file backed string tables.
func ConfigureBingen ¶
func ConfigureBingen(config *BingenConfiguration)
ConfigureBingen accepts a new *BingenConfiguration instance which updates the internal decoder and encoder behavior.
func DurationOffsetStrings ¶
func IsBingenFileBackedStringTableEnabled ¶
func IsBingenFileBackedStringTableEnabled() bool
IsBingenFileBackedStringTableEnabled accessor for file backed string table configuration
func ParseProperty ¶
func ParseProvider ¶
ParseProvider attempts to parse and return a known provider, given a string
Types ¶
type Allocation ¶
type Allocation struct {
Name string `json:"name"`
Properties *AllocationProperties `json:"properties,omitempty"`
Window Window `json:"window"`
Start time.Time `json:"start"`
End time.Time `json:"end"`
CPUCoreHours float64 `json:"cpuCoreHours"`
CPUCoreRequestAverage float64 `json:"cpuCoreRequestAverage"`
CPUCoreUsageAverage float64 `json:"cpuCoreUsageAverage"`
CPUCost float64 `json:"cpuCost"`
CPUCostAdjustment float64 `json:"cpuCostAdjustment"`
GPUHours float64 `json:"gpuHours"`
GPUCost float64 `json:"gpuCost"`
GPUCostAdjustment float64 `json:"gpuCostAdjustment"`
NetworkTransferBytes float64 `json:"networkTransferBytes"`
NetworkReceiveBytes float64 `json:"networkReceiveBytes"`
NetworkCost float64 `json:"networkCost"`
NetworkCostAdjustment float64 `json:"networkCostAdjustment"`
LoadBalancerCost float64 `json:"loadBalancerCost"`
LoadBalancerCostAdjustment float64 `json:"loadBalancerCostAdjustment"`
PVs PVAllocations `json:"-"`
PVCostAdjustment float64 `json:"pvCostAdjustment"`
RAMByteHours float64 `json:"ramByteHours"`
RAMBytesRequestAverage float64 `json:"ramByteRequestAverage"`
RAMBytesUsageAverage float64 `json:"ramByteUsageAverage"`
RAMCost float64 `json:"ramCost"`
RAMCostAdjustment float64 `json:"ramCostAdjustment"`
ExternalCost float64 `json:"externalCost"`
// RawAllocationOnly is a pointer so if it is not present it will be
// marshalled as null rather than as an object with Go default values.
RawAllocationOnly *RawAllocationOnlyData `json:"rawAllocationOnly"`
TestProperty int `json:"testProperty"` //@bingen:field[version=16, default=0]
TestStr string `json:"testStr"` //@bingen:field[version=16, default=test]
}
Allocation is a unit of resource allocation and cost for a given window of time and for a given kubernetes construct with its associated set of properties. TODO:CLEANUP consider dropping name in favor of just Allocation and an Assets-style key() function for AllocationSet.
func AssetToExternalAllocation ¶
func AssetToExternalAllocation(asset Asset, aggregateBy []string, externalLabelsCfg map[string]string) (*Allocation, error)
AssetToExternalAllocation converts the given asset to an Allocation, given the properties to use to aggregate, and the mapping from Allocation property to Asset label. For example, consider this asset:
CURRENT: Asset ETL stores its data ALREADY MAPPED from label to k8s concept. This isn't ideal-- see the TOOD.
Cloud {
TotalCost: 10.00,
Labels{
"kubernetes_namespace":"monitoring",
"env":"prod"
}
}
Given the following parameters, we expect to return:
single-prop full match aggregateBy = ["namespace"] => Allocation{Name: "monitoring", ExternalCost: 10.00, TotalCost: 10.00}, nil
multi-prop full match aggregateBy = ["namespace", "label:env"] allocationPropertyLabels = {"namespace":"kubernetes_namespace"} => Allocation{Name: "monitoring/env=prod", ExternalCost: 10.00, TotalCost: 10.00}, nil
multi-prop partial match aggregateBy = ["namespace", "label:foo"] => Allocation{Name: "monitoring/__unallocated__", ExternalCost: 10.00, TotalCost: 10.00}, nil
no match aggregateBy = ["cluster"] => nil, err
TODO:
Cloud {
TotalCost: 10.00,
Labels{
"kubernetes_namespace":"monitoring",
"env":"prod"
}
}
Given the following parameters, we expect to return:
single-prop full match aggregateBy = ["namespace"] allocationPropertyLabels = {"namespace":"kubernetes_namespace"} => Allocation{Name: "monitoring", ExternalCost: 10.00, TotalCost: 10.00}, nil
multi-prop full match aggregateBy = ["namespace", "label:env"] allocationPropertyLabels = {"namespace":"kubernetes_namespace"} => Allocation{Name: "monitoring/env=prod", ExternalCost: 10.00, TotalCost: 10.00}, nil
multi-prop partial match aggregateBy = ["namespace", "label:foo"] allocationPropertyLabels = {"namespace":"kubernetes_namespace"} => Allocation{Name: "monitoring/__unallocated__", ExternalCost: 10.00, TotalCost: 10.00}, nil
no match aggregateBy = ["cluster"] allocationPropertyLabels = {"namespace":"kubernetes_namespace"} => nil, err
(See asset_test.go for assertions of these examples and more.)
func (*Allocation) Add ¶
func (a *Allocation) Add(that *Allocation) (*Allocation, error)
Add returns the result of summing the two given Allocations, which sums the summary fields (e.g. costs, resources) and recomputes efficiency. Neither of the two original Allocations are mutated in the process.
func (*Allocation) CPUCores ¶
func (a *Allocation) CPUCores() float64
CPUCores converts the Allocation's CPUCoreHours into average CPUCores
func (*Allocation) CPUEfficiency ¶
func (a *Allocation) CPUEfficiency() float64
CPUEfficiency is the ratio of usage to request. If there is no request and no usage or cost, then efficiency is zero. If there is no request, but there is usage or cost, then efficiency is 100%.
func (*Allocation) CPUTotalCost ¶
func (a *Allocation) CPUTotalCost() float64
CPUTotalCost calculates total CPU cost of Allocation including adjustment
func (*Allocation) Clone ¶
func (a *Allocation) Clone() *Allocation
Clone returns a deep copy of the given Allocation
func (*Allocation) GPUTotalCost ¶
func (a *Allocation) GPUTotalCost() float64
GPUTotalCost calculates total GPU cost of Allocation including adjustment
func (*Allocation) GPUs ¶
func (a *Allocation) GPUs() float64
GPUs converts the Allocation's GPUHours into average GPUs
func (*Allocation) IsAggregated ¶
func (a *Allocation) IsAggregated() bool
IsAggregated is true if the given Allocation has been aggregated, which we define by a lack of AllocationProperties.
func (*Allocation) IsExternal ¶
func (a *Allocation) IsExternal() bool
IsExternal is true if the given Allocation represents external costs.
func (*Allocation) IsIdle ¶
func (a *Allocation) IsIdle() bool
IsIdle is true if the given Allocation represents idle costs.
func (*Allocation) IsUnallocated ¶
func (a *Allocation) IsUnallocated() bool
IsUnallocated is true if the given Allocation represents unallocated costs.
func (*Allocation) LBTotalCost ¶
func (a *Allocation) LBTotalCost() float64
LBTotalCost calculates total LB cost of Allocation including adjustment
func (*Allocation) MarshalBinary ¶
func (target *Allocation) MarshalBinary() (data []byte, err error)
MarshalBinary serializes the internal properties of this Allocation instance into a byte array
func (*Allocation) MarshalBinaryWithContext ¶
func (target *Allocation) MarshalBinaryWithContext(ctx *EncodingContext) (err error)
MarshalBinaryWithContext serializes the internal properties of this Allocation instance into a byte array leveraging a predefined context.
func (*Allocation) Minutes ¶
func (a *Allocation) Minutes() float64
Minutes returns the number of minutes the Allocation represents, as defined by the difference between the end and start times.
func (*Allocation) NetworkTotalCost ¶
func (a *Allocation) NetworkTotalCost() float64
NetworkTotalCost calculates total Network cost of Allocation including adjustment
func (*Allocation) PVByteHours ¶
func (a *Allocation) PVByteHours() float64
PVByteHours calculate cumulative ByteHours of all PVs that Allocation is attached to
func (*Allocation) PVBytes ¶
func (a *Allocation) PVBytes() float64
PVBytes converts the Allocation's PVByteHours into average PVBytes
func (*Allocation) PVCost ¶
func (a *Allocation) PVCost() float64
PVCost calculate cumulative cost of all PVs that Allocation is attached to
func (*Allocation) PVTotalCost ¶
func (a *Allocation) PVTotalCost() float64
PVTotalCost calculates total PV cost of Allocation including adjustment
func (*Allocation) RAMBytes ¶
func (a *Allocation) RAMBytes() float64
RAMBytes converts the Allocation's RAMByteHours into average RAMBytes
func (*Allocation) RAMEfficiency ¶
func (a *Allocation) RAMEfficiency() float64
RAMEfficiency is the ratio of usage to request. If there is no request and no usage or cost, then efficiency is zero. If there is no request, but there is usage or cost, then efficiency is 100%.
func (*Allocation) RAMTotalCost ¶
func (a *Allocation) RAMTotalCost() float64
RAMTotalCost calculates total RAM cost of Allocation including adjustment
func (*Allocation) ResetAdjustments ¶
func (a *Allocation) ResetAdjustments()
ResetAdjustments sets all cost adjustment fields to zero
func (*Allocation) Resolution ¶
func (a *Allocation) Resolution() time.Duration
Resolution returns the duration of time covered by the Allocation
func (*Allocation) Share ¶
func (a *Allocation) Share(that *Allocation) (*Allocation, error)
Share adds the TotalCost of the given Allocation to the SharedCost of the receiving Allocation. No Start, End, Window, or AllocationProperties are considered. Neither Allocation is mutated; a new Allocation is always returned.
func (*Allocation) SharedTotalCost ¶
func (a *Allocation) SharedTotalCost() float64
SharedTotalCost calculates total shared cost of Allocation including adjustment
func (*Allocation) String ¶
func (a *Allocation) String() string
String represents the given Allocation as a string
func (*Allocation) TotalCost ¶
func (a *Allocation) TotalCost() float64
TotalCost is the total cost of the Allocation including adjustments
func (*Allocation) TotalEfficiency ¶
func (a *Allocation) TotalEfficiency() float64
TotalEfficiency is the cost-weighted average of CPU and RAM efficiency. If there is no cost at all, then efficiency is zero.
func (*Allocation) UnmarshalBinary ¶
func (target *Allocation) UnmarshalBinary(data []byte) error
UnmarshalBinary uses the data passed byte array to set all the internal properties of the Allocation type
func (*Allocation) UnmarshalBinaryFromReader ¶
func (target *Allocation) UnmarshalBinaryFromReader(reader io.Reader) error
UnmarshalBinaryFromReader uses the io.Reader data to set all the internal properties of the Allocation type
func (*Allocation) UnmarshalBinaryWithContext ¶
func (target *Allocation) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error)
UnmarshalBinaryWithContext uses the context containing a string table and binary buffer to set all the internal properties of the Allocation type
type AllocationAggregationOptions ¶
type AllocationAggregationOptions struct {
FilterFuncs []AllocationMatchFunc
SplitIdle bool
IdleByNode bool
MergeUnallocated bool
}
AllocationAggregationOptions provide advanced functionality to AggregateBy, including filtering results and sharing allocations. FilterFuncs are a list of match functions such that, if any function fails, the allocation is ignored. ShareFuncs are a list of match functions such that, if any function succeeds, the allocation is marked as a shared resource. ShareIdle is a simple flag for sharing idle resources.
type AllocationAnnotations ¶
AllocationAnnotations is a schema-free mapping of key/value pairs that can be attributed to an Allocation
type AllocationLabels ¶
AllocationLabels is a schema-free mapping of key/value pairs that can be attributed to an Allocation
type AllocationMatchFunc ¶
type AllocationMatchFunc func(*Allocation) bool
AllocationMatchFunc is a function that can be used to match Allocations by returning true for any given Allocation if a condition is met.
type AllocationProperties ¶
type AllocationProperties struct {
Cluster string `json:"cluster,omitempty"`
Node string `json:"node,omitempty"`
Container string `json:"container,omitempty"`
Controller string `json:"controller,omitempty"`
ControllerKind string `json:"controllerKind,omitempty"`
Namespace string `json:"namespace,omitempty"`
Pod string `json:"pod,omitempty"`
Services []string `json:"services,omitempty"`
ProviderID string `json:"providerID,omitempty"`
Labels AllocationLabels `json:"allocationLabels,omitempty"`
Annotations AllocationAnnotations `json:"allocationAnnotations,omitempty"`
}
AllocationProperties describes a set of Kubernetes objects.
func (*AllocationProperties) Clone ¶
func (p *AllocationProperties) Clone() *AllocationProperties
func (*AllocationProperties) Equal ¶
func (p *AllocationProperties) Equal(that *AllocationProperties) bool
func (*AllocationProperties) Intersection ¶
func (p *AllocationProperties) Intersection(that *AllocationProperties) *AllocationProperties
Intersection returns an *AllocationProperties which contains all matching fields between the calling and parameter AllocationProperties nillable slices and maps are left as nil
func (*AllocationProperties) MarshalBinary ¶
func (target *AllocationProperties) MarshalBinary() (data []byte, err error)
MarshalBinary serializes the internal properties of this AllocationProperties instance into a byte array
func (*AllocationProperties) MarshalBinaryWithContext ¶
func (target *AllocationProperties) MarshalBinaryWithContext(ctx *EncodingContext) (err error)
MarshalBinaryWithContext serializes the internal properties of this AllocationProperties instance into a byte array leveraging a predefined context.
func (*AllocationProperties) String ¶
func (p *AllocationProperties) String() string
func (*AllocationProperties) UnmarshalBinary ¶
func (target *AllocationProperties) UnmarshalBinary(data []byte) error
UnmarshalBinary uses the data passed byte array to set all the internal properties of the AllocationProperties type
func (*AllocationProperties) UnmarshalBinaryFromReader ¶
func (target *AllocationProperties) UnmarshalBinaryFromReader(reader io.Reader) error
UnmarshalBinaryFromReader uses the io.Reader data to set all the internal properties of the AllocationProperties type
func (*AllocationProperties) UnmarshalBinaryWithContext ¶
func (target *AllocationProperties) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error)
UnmarshalBinaryWithContext uses the context containing a string table and binary buffer to set all the internal properties of the AllocationProperties type
type AllocationSet ¶
type AllocationSet struct {
sync.RWMutex
FromSource string // stores the name of the source used to compute the data
Window Window
Warnings []string
Errors []string
// contains filtered or unexported fields
}
AllocationSet stores a set of Allocations, each with a unique name, that share a window. An AllocationSet is mutable, so treat it like a threadsafe map.
func NewAllocationSet ¶
func NewAllocationSet(start, end time.Time, allocs ...*Allocation) *AllocationSet
NewAllocationSet instantiates a new AllocationSet and, optionally, inserts the given list of Allocations
func (*AllocationSet) AggregateBy ¶
func (as *AllocationSet) AggregateBy(aggregateBy []string, options *AllocationAggregationOptions) error
AggregateBy aggregates the Allocations in the given AllocationSet by the given AllocationProperty. This will only be legal if the AllocationSet is divisible by the given AllocationProperty; e.g. Containers can be divided by Namespace, but not vice-a-versa.
func (*AllocationSet) Clone ¶
func (as *AllocationSet) Clone() *AllocationSet
Clone returns a new AllocationSet with a deep copy of the given AllocationSet's allocations.
func (*AllocationSet) ComputeIdleAllocations ¶
func (as *AllocationSet) ComputeIdleAllocations(assetSet *AssetSet) (map[string]*Allocation, error)
ComputeIdleAllocations computes the idle allocations for the AllocationSet, given a set of Assets. Ideally, assetSet should contain only Nodes, but if it contains other Assets, they will be ignored; only CPU, GPU and RAM are considered for idle allocation. If the Nodes have adjustments, then apply the adjustments proportionally to each of the resources so that total allocation with idle reflects the adjusted node costs. One idle allocation per-cluster will be computed and returned, keyed by cluster_id.
func (*AllocationSet) ComputeIdleAllocationsByNode ¶
func (as *AllocationSet) ComputeIdleAllocationsByNode(assetSet *AssetSet) (map[string]*Allocation, error)
ComputeIdleAllocationsByNode computes the idle allocations for the AllocationSet, given a set of Assets. Ideally, assetSet should contain only Nodes, but if it contains other Assets, they will be ignored; only CPU, GPU and RAM are considered for idle allocation. If the Nodes have adjustments, then apply the adjustments proportionally to each of the resources so that total allocation with idle reflects the adjusted node costs. One idle allocation per-node will be computed and returned, keyed by cluster_id.
func (*AllocationSet) Delete ¶
func (as *AllocationSet) Delete(name string)
Delete removes the allocation with the given name from the set
func (*AllocationSet) Each ¶
func (as *AllocationSet) Each(f func(string, *Allocation))
Each invokes the given function for each Allocation in the set
func (*AllocationSet) End ¶
func (as *AllocationSet) End() time.Time
End returns the End time of the AllocationSet window
func (*AllocationSet) ExternalAllocations ¶
func (as *AllocationSet) ExternalAllocations() map[string]*Allocation
ExternalAllocations returns a map of the external allocations in the set. Returns clones of the actual Allocations, so mutability is not a problem.
func (*AllocationSet) ExternalCost ¶
func (as *AllocationSet) ExternalCost() float64
ExternalCost returns the total aggregated external costs of the set
func (*AllocationSet) Get ¶
func (as *AllocationSet) Get(key string) *Allocation
Get returns the Allocation at the given key in the AllocationSet
func (*AllocationSet) IdleAllocations ¶
func (as *AllocationSet) IdleAllocations() map[string]*Allocation
IdleAllocations returns a map of the idle allocations in the AllocationSet. Returns clones of the actual Allocations, so mutability is not a problem.
func (*AllocationSet) Insert ¶
func (as *AllocationSet) Insert(that *Allocation) error
Insert aggregates the current entry in the AllocationSet by the given Allocation, but only if the Allocation is valid, i.e. matches the AllocationSet's window. If there is no existing entry, one is created. Nil error response indicates success.
func (*AllocationSet) IsEmpty ¶
func (as *AllocationSet) IsEmpty() bool
IsEmpty returns true if the AllocationSet is nil, or if it contains zero allocations.
func (*AllocationSet) Length ¶
func (as *AllocationSet) Length() int
Length returns the number of Allocations in the set
func (*AllocationSet) Map ¶
func (as *AllocationSet) Map() map[string]*Allocation
Map clones and returns a map of the AllocationSet's Allocations
func (*AllocationSet) MarshalBinary ¶
func (target *AllocationSet) MarshalBinary() (data []byte, err error)
MarshalBinary serializes the internal properties of this AllocationSet instance into a byte array
func (*AllocationSet) MarshalBinaryWithContext ¶
func (target *AllocationSet) MarshalBinaryWithContext(ctx *EncodingContext) (err error)
MarshalBinaryWithContext serializes the internal properties of this AllocationSet instance into a byte array leveraging a predefined context.
func (*AllocationSet) MarshalJSON ¶
func (as *AllocationSet) MarshalJSON() ([]byte, error)
MarshalJSON JSON-encodes the AllocationSet
func (*AllocationSet) Resolution ¶
func (as *AllocationSet) Resolution() time.Duration
Resolution returns the AllocationSet's window duration
func (*AllocationSet) Set ¶
func (as *AllocationSet) Set(alloc *Allocation) error
Set uses the given Allocation to overwrite the existing entry in the AllocationSet under the Allocation's name.
func (*AllocationSet) Start ¶
func (as *AllocationSet) Start() time.Time
Start returns the Start time of the AllocationSet window
func (*AllocationSet) String ¶
func (as *AllocationSet) String() string
String represents the given Allocation as a string
func (*AllocationSet) TotalCost ¶
func (as *AllocationSet) TotalCost() float64
TotalCost returns the sum of all TotalCosts of the allocations contained
func (*AllocationSet) UTCOffset ¶
func (as *AllocationSet) UTCOffset() time.Duration
UTCOffset returns the AllocationSet's configured UTCOffset.
func (*AllocationSet) UnmarshalBinary ¶
func (target *AllocationSet) UnmarshalBinary(data []byte) error
UnmarshalBinary uses the data passed byte array to set all the internal properties of the AllocationSet type
func (*AllocationSet) UnmarshalBinaryFromReader ¶
func (target *AllocationSet) UnmarshalBinaryFromReader(reader io.Reader) error
UnmarshalBinaryFromReader uses the io.Reader data to set all the internal properties of the AllocationSet type
func (*AllocationSet) UnmarshalBinaryWithContext ¶
func (target *AllocationSet) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error)
UnmarshalBinaryWithContext uses the context containing a string table and binary buffer to set all the internal properties of the AllocationSet type
type AllocationSetRange ¶
type AllocationSetRange struct {
sync.RWMutex
FromStore string // stores the name of the store used to retrieve the data
// contains filtered or unexported fields
}
AllocationSetRange is a thread-safe slice of AllocationSets. It is meant to be used such that the AllocationSets held are consecutive and coherent with respect to using the same aggregation properties, UTC offset, and resolution. However these rules are not necessarily enforced, so use wisely.
func NewAllocationSetRange ¶
func NewAllocationSetRange(allocs ...*AllocationSet) *AllocationSetRange
NewAllocationSetRange instantiates a new range composed of the given AllocationSets in the order provided.
func (*AllocationSetRange) Accumulate ¶
func (asr *AllocationSetRange) Accumulate() (*AllocationSet, error)
Accumulate sums each AllocationSet in the given range, returning a single cumulative AllocationSet for the entire range.
func (*AllocationSetRange) AggregateBy ¶
func (asr *AllocationSetRange) AggregateBy(aggregateBy []string, options *AllocationAggregationOptions) error
AggregateBy aggregates each AllocationSet in the range by the given properties and options.
func (*AllocationSetRange) Append ¶
func (asr *AllocationSetRange) Append(that *AllocationSet)
Append appends the given AllocationSet to the end of the range. It does not validate whether or not that violates window continuity.
func (*AllocationSetRange) Each ¶
func (asr *AllocationSetRange) Each(f func(int, *AllocationSet))
Each invokes the given function for each AllocationSet in the range
func (*AllocationSetRange) Get ¶
func (asr *AllocationSetRange) Get(i int) (*AllocationSet, error)
Get retrieves the AllocationSet at the given index of the range.
func (*AllocationSetRange) InsertRange ¶
func (asr *AllocationSetRange) InsertRange(that *AllocationSetRange) error
InsertRange merges the given AllocationSetRange into the receiving one by lining up sets with matching windows, then inserting each allocation from the given ASR into the respective set in the receiving ASR. If the given ASR contains an AllocationSet from a window that does not exist in the receiving ASR, then an error is returned. However, the given ASR does not need to cover the full range of the receiver.
func (*AllocationSetRange) Length ¶
func (asr *AllocationSetRange) Length() int
Length returns the length of the range, which is zero if nil
func (*AllocationSetRange) MarshalBinary ¶
func (target *AllocationSetRange) MarshalBinary() (data []byte, err error)
MarshalBinary serializes the internal properties of this AllocationSetRange instance into a byte array
func (*AllocationSetRange) MarshalBinaryWithContext ¶
func (target *AllocationSetRange) MarshalBinaryWithContext(ctx *EncodingContext) (err error)
MarshalBinaryWithContext serializes the internal properties of this AllocationSetRange instance into a byte array leveraging a predefined context.
func (*AllocationSetRange) MarshalJSON ¶
func (asr *AllocationSetRange) MarshalJSON() ([]byte, error)
MarshalJSON JSON-encodes the range
func (*AllocationSetRange) Slice ¶
func (asr *AllocationSetRange) Slice() []*AllocationSet
Slice copies the underlying slice of AllocationSets, maintaining order, and returns the copied slice.
func (*AllocationSetRange) String ¶
func (asr *AllocationSetRange) String() string
String represents the given AllocationSetRange as a string
func (*AllocationSetRange) UTCOffset ¶
func (asr *AllocationSetRange) UTCOffset() time.Duration
UTCOffset returns the detected UTCOffset of the AllocationSets within the range. Defaults to 0 if the range is nil or empty. Does not warn if there are sets with conflicting UTCOffsets (just returns the first).
func (*AllocationSetRange) UnmarshalBinary ¶
func (target *AllocationSetRange) UnmarshalBinary(data []byte) error
UnmarshalBinary uses the data passed byte array to set all the internal properties of the AllocationSetRange type
func (*AllocationSetRange) UnmarshalBinaryFromReader ¶
func (target *AllocationSetRange) UnmarshalBinaryFromReader(reader io.Reader) error
UnmarshalBinaryFromReader uses the io.Reader data to set all the internal properties of the AllocationSetRange type
func (*AllocationSetRange) UnmarshalBinaryWithContext ¶
func (target *AllocationSetRange) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error)
UnmarshalBinaryWithContext uses the context containing a string table and binary buffer to set all the internal properties of the AllocationSetRange type
func (*AllocationSetRange) Window ¶
func (asr *AllocationSetRange) Window() Window
Window returns the full window that the AllocationSetRange spans, from the start of the first AllocationSet to the end of the last one.
type AllocationSetStream ¶
type AllocationSetStream struct {
// contains filtered or unexported fields
}
AllocationSetStream is a single use field stream for the contents of an AllocationSet instance. Instead of creating an instance and populating the fields on that instance, we provide a streaming iterator which yields (BingenFieldInfo, *BingenValue) tuples for each streamable element. All slices and maps will be flattened one depth and each element streamed individually.
func (*AllocationSetStream) Close ¶
func (stream *AllocationSetStream) Close()
Closes closes the internal io.Reader used to read and parse the AllocationSet fields. This should be called once the stream is no longer needed.
func (*AllocationSetStream) Error ¶
func (stream *AllocationSetStream) Error() error
Error returns an error if one occurred during the process of streaming the AllocationSet This can be checked after iterating through the Stream().
func (*AllocationSetStream) Stream ¶
func (stream *AllocationSetStream) Stream() iter.Seq2[BingenFieldInfo, *BingenValue]
Stream returns the iterator which will stream each field of the target type.
type Any ¶
type Any struct {
Cost float64
// contains filtered or unexported fields
}
Any is the most general Asset, which is usually created as a result of adding two Assets of different types.
func (*Any) Add ¶
Add sums the Asset with the given Asset to produce a new Asset, maintaining as much relevant information as possible (i.e. type, properties, labels).
func (*Any) Adjustment ¶
Adjustment returns the Asset's cost adjustment
func (*Any) ExpandWindow ¶
ExpandWindow expands the Asset's window by the given window
func (*Any) MarshalBinary ¶
MarshalBinary serializes the internal properties of this Any instance into a byte array
func (*Any) MarshalBinaryWithContext ¶
func (target *Any) MarshalBinaryWithContext(ctx *EncodingContext) (err error)
MarshalBinaryWithContext serializes the internal properties of this Any instance into a byte array leveraging a predefined context.
func (*Any) MarshalJSON ¶
MarshalJSON implements json.Marshaler
func (*Any) Properties ¶
func (a *Any) Properties() *AssetProperties
Properties returns the Asset's properties
func (*Any) SetAdjustment ¶
SetAdjustment sets the Asset's cost adjustment
func (*Any) SetLabels ¶
func (a *Any) SetLabels(labels AssetLabels)
SetLabels sets the Asset's labels
func (*Any) SetProperties ¶
func (a *Any) SetProperties(props *AssetProperties)
SetProperties sets the Asset's properties
func (*Any) SetStartEnd ¶
SetStartEnd sets the Asset's Start and End fields
func (*Any) UnmarshalBinary ¶
UnmarshalBinary uses the data passed byte array to set all the internal properties of the Any type
func (*Any) UnmarshalBinaryFromReader ¶
UnmarshalBinaryFromReader uses the io.Reader data to set all the internal properties of the Any type
func (*Any) UnmarshalBinaryWithContext ¶
func (target *Any) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error)
UnmarshalBinaryWithContext uses the context containing a string table and binary buffer to set all the internal properties of the Any type
type Asset ¶
type Asset interface {
// Type identifies the kind of Asset, which must always exist and should
// be defined by the underlying type implementing the interface.
Type() AssetType
// Properties are a map of predefined traits, which may or may not exist,
// but must conform to the AssetProperty schema
Properties() *AssetProperties
SetProperties(*AssetProperties)
// Labels are a map of undefined string-to-string values
Labels() AssetLabels
SetLabels(AssetLabels)
// Monetary values
Adjustment() float64
SetAdjustment(float64)
TotalCost() float64
// Temporal values
Start() time.Time
End() time.Time
SetStartEnd(time.Time, time.Time)
Window() Window
ExpandWindow(Window)
Minutes() float64
// Operations and comparisons
Add(Asset) Asset
Clone() Asset
Equal(Asset) bool
// Representations
encoding.BinaryMarshaler
encoding.BinaryUnmarshaler
json.Marshaler
fmt.Stringer
}
Asset defines an entity within a cluster that has a defined cost over a given period of time.
type AssetAggregationOptions ¶
type AssetAggregationOptions struct {
FilterFuncs []AssetMatchFunc
}
type AssetLabels ¶
AssetLabels is a schema-free mapping of key/value pairs that can be attributed to an Asset as a flexible a
func (AssetLabels) Clone ¶
func (al AssetLabels) Clone() AssetLabels
Clone returns a cloned map of labels
func (AssetLabels) Equal ¶
func (al AssetLabels) Equal(that AssetLabels) bool
Equal returns true only if the two set of labels are exact matches
func (AssetLabels) Merge ¶
func (al AssetLabels) Merge(that AssetLabels) AssetLabels
Merge retains only the labels shared with the given AssetLabels
type AssetMatchFunc ¶
AssetMatchFunc is a function that can be used to match Assets by returning true for any given Asset if a condition is met.
type AssetProperties ¶
type AssetProperties struct {
Category string `json:"category,omitempty"`
Provider string `json:"provider,omitempty"`
Account string `json:"account,omitempty"`
Project string `json:"project,omitempty"`
Service string `json:"service,omitempty"`
Cluster string `json:"cluster,omitempty"`
Name string `json:"name,omitempty"`
ProviderID string `json:"providerID,omitempty"`
}
AssetProperties describes all properties assigned to an Asset.
func (*AssetProperties) Clone ¶
func (ap *AssetProperties) Clone() *AssetProperties
Clone returns a cloned instance of the given AssetProperties
func (*AssetProperties) Equal ¶
func (ap *AssetProperties) Equal(that *AssetProperties) bool
Equal returns true only if both AssetProperties are non-nil exact matches
func (*AssetProperties) Keys ¶
func (ap *AssetProperties) Keys(props []AssetProperty) []string
Keys returns the list of string values used to key the Asset based on the list of properties provided.
func (*AssetProperties) MarshalBinary ¶
func (target *AssetProperties) MarshalBinary() (data []byte, err error)
MarshalBinary serializes the internal properties of this AssetProperties instance into a byte array
func (*AssetProperties) MarshalBinaryWithContext ¶
func (target *AssetProperties) MarshalBinaryWithContext(ctx *EncodingContext) (err error)
MarshalBinaryWithContext serializes the internal properties of this AssetProperties instance into a byte array leveraging a predefined context.
func (*AssetProperties) Merge ¶
func (ap *AssetProperties) Merge(that *AssetProperties) *AssetProperties
Merge retains only the properties shared with the given AssetProperties
func (*AssetProperties) String ¶
func (ap *AssetProperties) String() string
String represents the properties as a string
func (*AssetProperties) UnmarshalBinary ¶
func (target *AssetProperties) UnmarshalBinary(data []byte) error
UnmarshalBinary uses the data passed byte array to set all the internal properties of the AssetProperties type
func (*AssetProperties) UnmarshalBinaryFromReader ¶
func (target *AssetProperties) UnmarshalBinaryFromReader(reader io.Reader) error
UnmarshalBinaryFromReader uses the io.Reader data to set all the internal properties of the AssetProperties type
func (*AssetProperties) UnmarshalBinaryWithContext ¶
func (target *AssetProperties) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error)
UnmarshalBinaryWithContext uses the context containing a string table and binary buffer to set all the internal properties of the AssetProperties type
type AssetProperty ¶
type AssetProperty string
AssetProperty is a kind of property belonging to an Asset
const ( // AssetNilProp is the zero-value of AssetProperty AssetNilProp AssetProperty = "" // AssetAccountProp describes the account of the Asset AssetAccountProp AssetProperty = "account" // AssetCategoryProp describes the category of the Asset AssetCategoryProp AssetProperty = "category" // AssetClusterProp describes the cluster of the Asset AssetClusterProp AssetProperty = "cluster" // AssetNameProp describes the name of the Asset AssetNameProp AssetProperty = "name" // AssetProjectProp describes the project of the Asset AssetProjectProp AssetProperty = "project" // AssetProviderProp describes the provider of the Asset AssetProviderProp AssetProperty = "provider" // AssetProviderIDProp describes the providerID of the Asset AssetProviderIDProp AssetProperty = "providerID" // AssetServiceProp describes the service of the Asset AssetServiceProp AssetProperty = "service" // AssetTypeProp describes the type of the Asset AssetTypeProp AssetProperty = "type" )
func ParseAssetProperty ¶
func ParseAssetProperty(text string) (AssetProperty, error)
ParseAssetProperty attempts to parse a string into an AssetProperty
type AssetSet ¶
type AssetSet struct {
sync.RWMutex
Any map[string]*Any //@bingen:field[ignore]
Cloud map[string]*Cloud //@bingen:field[ignore]
ClusterManagement map[string]*ClusterManagement //@bingen:field[ignore]
Disks map[string]*Disk //@bingen:field[ignore]
Network map[string]*Network //@bingen:field[ignore]
Nodes map[string]*Node //@bingen:field[ignore]
LoadBalancers map[string]*LoadBalancer //@bingen:field[ignore]
FromSource string // stores the name of the source used to compute the data
Window Window
Warnings []string
Errors []string
// contains filtered or unexported fields
}
AssetSet stores a set of Assets, each with a unique name, that share a window. An AssetSet is mutable, so treat it like a threadsafe map.
func NewAssetSet ¶
NewAssetSet instantiates a new AssetSet and, optionally, inserts the given list of Assets
func (*AssetSet) AggregateBy ¶
func (as *AssetSet) AggregateBy(aggregateBy []string, opts *AssetAggregationOptions) error
AggregateBy aggregates the Assets in the AssetSet by the given list of AssetProperties, such that each asset is binned by a key determined by its relevant property values.
func (*AssetSet) Clone ¶
Clone returns a new AssetSet with a deep copy of the given AssetSet's assets.
func (*AssetSet) FindMatch ¶
FindMatch attempts to find a match in the AssetSet for the given Asset on the provided properties and labels. If a match is not found, FindMatch returns nil and a Not Found error.
func (*AssetSet) Get ¶
Get returns the Asset in the AssetSet at the given key, or nil and false if no Asset exists for the given key
func (*AssetSet) Insert ¶
Insert inserts the given Asset into the AssetSet, using the AssetSet's configured properties to determine the key under which the Asset will be inserted.
func (*AssetSet) IsEmpty ¶
IsEmpty returns true if the AssetSet is nil, or if it contains zero assets.
func (*AssetSet) MarshalBinary ¶
MarshalBinary serializes the internal properties of this AssetSet instance into a byte array
func (*AssetSet) MarshalBinaryWithContext ¶
func (target *AssetSet) MarshalBinaryWithContext(ctx *EncodingContext) (err error)
MarshalBinaryWithContext serializes the internal properties of this AssetSet instance into a byte array leveraging a predefined context.
func (*AssetSet) MarshalJSON ¶
MarshalJSON JSON-encodes the AssetSet
func (*AssetSet) ReconciliationMatch ¶
ReconciliationMatch attempts to find an exact match in the AssetSet on (Category, ProviderID). If a match is found, it returns the Asset with the intent to adjust it. If no match exists, it attempts to find one on only (ProviderID). If that match is found, it returns the Asset with the intent to insert the associated Cloud cost.
func (*AssetSet) UnmarshalBinary ¶
UnmarshalBinary uses the data passed byte array to set all the internal properties of the AssetSet type
func (*AssetSet) UnmarshalBinaryFromReader ¶
UnmarshalBinaryFromReader uses the io.Reader data to set all the internal properties of the AssetSet type
func (*AssetSet) UnmarshalBinaryWithContext ¶
func (target *AssetSet) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error)
UnmarshalBinaryWithContext uses the context containing a string table and binary buffer to set all the internal properties of the AssetSet type
type AssetSetRange ¶
type AssetSetRange struct {
sync.RWMutex
FromStore string // stores the name of the store used to retrieve the data
// contains filtered or unexported fields
}
AssetSetRange is a thread-safe slice of AssetSets. It is meant to be used such that the AssetSets held are consecutive and coherent with respect to using the same aggregation properties, UTC offset, and resolution. However these rules are not necessarily enforced, so use wisely.
func NewAssetSetRange ¶
func NewAssetSetRange(assets ...*AssetSet) *AssetSetRange
NewAssetSetRange instantiates a new range composed of the given AssetSets in the order provided.
func (*AssetSetRange) Accumulate ¶
func (asr *AssetSetRange) Accumulate() (*AssetSet, error)
Accumulate sums each AssetSet in the given range, returning a single cumulative AssetSet for the entire range.
func (*AssetSetRange) AggregateBy ¶
func (asr *AssetSetRange) AggregateBy(aggregateBy []string, opts *AssetAggregationOptions) error
func (*AssetSetRange) Append ¶
func (asr *AssetSetRange) Append(that *AssetSet)
func (*AssetSetRange) Each ¶
func (asr *AssetSetRange) Each(f func(int, *AssetSet))
Each invokes the given function for each AssetSet in the range
func (*AssetSetRange) Length ¶
func (asr *AssetSetRange) Length() int
func (*AssetSetRange) MarshalBinary ¶
func (target *AssetSetRange) MarshalBinary() (data []byte, err error)
MarshalBinary serializes the internal properties of this AssetSetRange instance into a byte array
func (*AssetSetRange) MarshalBinaryWithContext ¶
func (target *AssetSetRange) MarshalBinaryWithContext(ctx *EncodingContext) (err error)
MarshalBinaryWithContext serializes the internal properties of this AssetSetRange instance into a byte array leveraging a predefined context.
func (*AssetSetRange) MarshalJSON ¶
func (asr *AssetSetRange) MarshalJSON() ([]byte, error)
func (*AssetSetRange) UTCOffset ¶
func (asr *AssetSetRange) UTCOffset() time.Duration
func (*AssetSetRange) UnmarshalBinary ¶
func (target *AssetSetRange) UnmarshalBinary(data []byte) error
UnmarshalBinary uses the data passed byte array to set all the internal properties of the AssetSetRange type
func (*AssetSetRange) UnmarshalBinaryFromReader ¶
func (target *AssetSetRange) UnmarshalBinaryFromReader(reader io.Reader) error
UnmarshalBinaryFromReader uses the io.Reader data to set all the internal properties of the AssetSetRange type
func (*AssetSetRange) UnmarshalBinaryWithContext ¶
func (target *AssetSetRange) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error)
UnmarshalBinaryWithContext uses the context containing a string table and binary buffer to set all the internal properties of the AssetSetRange type
func (*AssetSetRange) Window ¶
func (asr *AssetSetRange) Window() Window
Window returns the full window that the AssetSetRange spans, from the start of the first AssetSet to the end of the last one.
type AssetSetStream ¶
type AssetSetStream struct {
// contains filtered or unexported fields
}
AssetSetStream is a single use field stream for the contents of an AssetSet instance. Instead of creating an instance and populating the fields on that instance, we provide a streaming iterator which yields (BingenFieldInfo, *BingenValue) tuples for each streamable element. All slices and maps will be flattened one depth and each element streamed individually.
func (*AssetSetStream) Close ¶
func (stream *AssetSetStream) Close()
Closes closes the internal io.Reader used to read and parse the AssetSet fields. This should be called once the stream is no longer needed.
func (*AssetSetStream) Error ¶
func (stream *AssetSetStream) Error() error
Error returns an error if one occurred during the process of streaming the AssetSet This can be checked after iterating through the Stream().
func (*AssetSetStream) Stream ¶
func (stream *AssetSetStream) Stream() iter.Seq2[BingenFieldInfo, *BingenValue]
Stream returns the iterator which will stream each field of the target type.
type AssetType ¶
type AssetType int
AssetType identifies a type of Asset
const ( // AnyAssetType describes the Any AssetType AnyAssetType AssetType = iota // CloudAssetType describes the Cloud AssetType CloudAssetType // ClusterManagementAssetType describes the ClusterManagement AssetType ClusterManagementAssetType // DiskAssetType describes the Disk AssetType DiskAssetType // LoadBalancerAssetType describes the LoadBalancer AssetType LoadBalancerAssetType // NetworkAssetType describes the Network AssetType NetworkAssetType // NodeAssetType describes the Node AssetType NodeAssetType SharedAssetType )
func ParseAssetType ¶
ParseAssetType attempts to parse the given string into an AssetType
type BinDecoder ¶
type BinDecoder interface {
UnmarshalBinaryWithContext(*DecodingContext) error
}
BinDecoder is a decoding interface which defines a context based unmarshal contract.
type BinEncoder ¶
type BinEncoder interface {
MarshalBinaryWithContext(*EncodingContext) error
}
BinEncoder is an encoding interface which defines a context based marshal contract.
type BingenConfiguration ¶
type BingenConfiguration struct {
// FileBackedStringTableEnabled enables the use of file-backed string tables for streaming
// bingen decoding.
FileBackedStringTableEnabled bool
// FileBackedStringTableDir is the directory to write the string table files for reading.
FileBackedStringTableDir string
}
BingenConfiguration is used to set any custom configuration in the way files are encoded or decoded.
func DefaultBingenConfiguration ¶
func DefaultBingenConfiguration() *BingenConfiguration
DefaultBingenConfiguration creates the default implementation of the bingen configuration and returns it.
type BingenFieldInfo ¶
BingenFieldInfo contains the type of the field being streamed as well as the name of the field.
type BingenStream ¶
type BingenStream interface {
// Stream returns the iterator which will stream each field of the target type and
// return the field info as well as the value.
Stream() iter.Seq2[BingenFieldInfo, *BingenValue]
// Close will close any dynamic io.Reader used to stream in the fields
Close()
// Error returns an error if one occurred during the process of streaming the type's fields.
// This can be checked after iterating through the Stream().
Error() error
}
BingenStream is the stream interface for all streamable types
func NewAllocationSetStream ¶
func NewAllocationSetStream(reader io.Reader) BingenStream
NewAllocationSetStream creates a new AllocationSetStream, which uses the io.Reader data to stream all internal fields of an AllocationSet instance
func NewAssetSetStream ¶
func NewAssetSetStream(reader io.Reader) BingenStream
NewAssetSetStream creates a new AssetSetStream, which uses the io.Reader data to stream all internal fields of an AssetSet instance
func NewStreamFor ¶
func NewStreamFor[T any](reader io.Reader) (BingenStream, error)
NewStreamFor accepts an io.Reader, and returns a new BingenStream for the generic T type provided _if_ it is a registered bingen type that is annotated as 'streamable'. See the streamFactoryMap for generated type listings.
type BingenValue ¶
BingenValue contains the value of a field as well as any index/key associated with that value.
func (*BingenValue) IsNil ¶
func (bv *BingenValue) IsNil() bool
IsNil is just a method accessor way to check to see if the value returned was nil
type BoundaryError ¶
func NewBoundaryError ¶
func NewBoundaryError(req, sup Window, msg string) *BoundaryError
func (*BoundaryError) Error ¶
func (be *BoundaryError) Error() string
type Breakdown ¶
type Breakdown struct {
Idle float64 `json:"idle"`
Other float64 `json:"other"`
System float64 `json:"system"`
User float64 `json:"user"`
}
Breakdown describes a resource's use as a percentage of various usage types
func (*Breakdown) MarshalBinary ¶
MarshalBinary serializes the internal properties of this Breakdown instance into a byte array
func (*Breakdown) MarshalBinaryWithContext ¶
func (target *Breakdown) MarshalBinaryWithContext(ctx *EncodingContext) (err error)
MarshalBinaryWithContext serializes the internal properties of this Breakdown instance into a byte array leveraging a predefined context.
func (*Breakdown) UnmarshalBinary ¶
UnmarshalBinary uses the data passed byte array to set all the internal properties of the Breakdown type
func (*Breakdown) UnmarshalBinaryFromReader ¶
UnmarshalBinaryFromReader uses the io.Reader data to set all the internal properties of the Breakdown type
func (*Breakdown) UnmarshalBinaryWithContext ¶
func (target *Breakdown) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error)
UnmarshalBinaryWithContext uses the context containing a string table and binary buffer to set all the internal properties of the Breakdown type
type Cloud ¶
type Cloud struct {
Cost float64
Credit float64 // Credit is a negative value representing dollars credited back to a given line-item
// contains filtered or unexported fields
}
Cloud describes a cloud asset
func (*Cloud) Add ¶
Add sums the Asset with the given Asset to produce a new Asset, maintaining as much relevant information as possible (i.e. type, properties, labels).
func (*Cloud) Adjustment ¶
Adjustment returns the Asset's adjustment value
func (*Cloud) ExpandWindow ¶
ExpandWindow expands the Asset's window by the given window
func (*Cloud) MarshalBinary ¶
MarshalBinary serializes the internal properties of this Cloud instance into a byte array
func (*Cloud) MarshalBinaryWithContext ¶
func (target *Cloud) MarshalBinaryWithContext(ctx *EncodingContext) (err error)
MarshalBinaryWithContext serializes the internal properties of this Cloud instance into a byte array leveraging a predefined context.
func (*Cloud) MarshalJSON ¶
MarshalJSON implements json.Marshaler
func (*Cloud) Properties ¶
func (ca *Cloud) Properties() *AssetProperties
Properties returns the AssetProperties
func (*Cloud) SetAdjustment ¶
SetAdjustment sets the Asset's adjustment value
func (*Cloud) SetLabels ¶
func (ca *Cloud) SetLabels(labels AssetLabels)
SetLabels sets the Asset's labels
func (*Cloud) SetProperties ¶
func (ca *Cloud) SetProperties(props *AssetProperties)
SetProperties sets the Asset's properties
func (*Cloud) SetStartEnd ¶
SetStartEnd sets the Asset's Start and End fields
func (*Cloud) UnmarshalBinary ¶
UnmarshalBinary uses the data passed byte array to set all the internal properties of the Cloud type
func (*Cloud) UnmarshalBinaryFromReader ¶
UnmarshalBinaryFromReader uses the io.Reader data to set all the internal properties of the Cloud type
func (*Cloud) UnmarshalBinaryWithContext ¶
func (target *Cloud) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error)
UnmarshalBinaryWithContext uses the context containing a string table and binary buffer to set all the internal properties of the Cloud type
type ClusterManagement ¶
type ClusterManagement struct {
Cost float64
// contains filtered or unexported fields
}
ClusterManagement describes a provider's cluster management fee
func NewClusterManagement ¶
func NewClusterManagement(provider, cluster string, window Window) *ClusterManagement
NewClusterManagement creates and returns a new ClusterManagement instance
func (*ClusterManagement) Add ¶
func (cm *ClusterManagement) Add(a Asset) Asset
Add sums the Asset with the given Asset to produce a new Asset, maintaining as much relevant information as possible (i.e. type, properties, labels).
func (*ClusterManagement) Adjustment ¶
func (cm *ClusterManagement) Adjustment() float64
Adjustment does not apply to ClusterManagement
func (*ClusterManagement) Clone ¶
func (cm *ClusterManagement) Clone() Asset
Clone returns a cloned instance of the Asset
func (*ClusterManagement) End ¶
func (cm *ClusterManagement) End() time.Time
End returns the Asset's precise end time within the window
func (*ClusterManagement) Equal ¶
func (cm *ClusterManagement) Equal(a Asset) bool
Equal returns true if the given Asset exactly matches the Asset
func (*ClusterManagement) ExpandWindow ¶
func (cm *ClusterManagement) ExpandWindow(window Window)
ExpandWindow expands the Asset's window by the given window
func (*ClusterManagement) Labels ¶
func (cm *ClusterManagement) Labels() AssetLabels
Labels returns the Asset's labels
func (*ClusterManagement) MarshalBinary ¶
func (target *ClusterManagement) MarshalBinary() (data []byte, err error)
MarshalBinary serializes the internal properties of this ClusterManagement instance into a byte array
func (*ClusterManagement) MarshalBinaryWithContext ¶
func (target *ClusterManagement) MarshalBinaryWithContext(ctx *EncodingContext) (err error)
MarshalBinaryWithContext serializes the internal properties of this ClusterManagement instance into a byte array leveraging a predefined context.
func (*ClusterManagement) MarshalJSON ¶
func (cm *ClusterManagement) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshler
func (*ClusterManagement) Minutes ¶
func (cm *ClusterManagement) Minutes() float64
Minutes returns the number of minutes the Asset ran
func (*ClusterManagement) Properties ¶
func (cm *ClusterManagement) Properties() *AssetProperties
Properties returns the Asset's properties
func (*ClusterManagement) SetAdjustment ¶
func (cm *ClusterManagement) SetAdjustment(float64)
SetAdjustment does not apply to ClusterManagement
func (*ClusterManagement) SetLabels ¶
func (cm *ClusterManagement) SetLabels(props AssetLabels)
SetLabels sets the Asset's properties
func (*ClusterManagement) SetProperties ¶
func (cm *ClusterManagement) SetProperties(props *AssetProperties)
SetProperties sets the Asset's properties
func (*ClusterManagement) SetStartEnd ¶
func (cm *ClusterManagement) SetStartEnd(start, end time.Time)
SetStartEnd sets the Asset's Start and End fields (not applicable here)
func (*ClusterManagement) Start ¶
func (cm *ClusterManagement) Start() time.Time
Start returns the Asset's precise start time within the window
func (*ClusterManagement) String ¶
func (cm *ClusterManagement) String() string
String implements fmt.Stringer
func (*ClusterManagement) TotalCost ¶
func (cm *ClusterManagement) TotalCost() float64
TotalCost returns the Asset's total cost
func (*ClusterManagement) Type ¶
func (cm *ClusterManagement) Type() AssetType
Type returns the Asset's type
func (*ClusterManagement) UnmarshalBinary ¶
func (target *ClusterManagement) UnmarshalBinary(data []byte) error
UnmarshalBinary uses the data passed byte array to set all the internal properties of the ClusterManagement type
func (*ClusterManagement) UnmarshalBinaryFromReader ¶
func (target *ClusterManagement) UnmarshalBinaryFromReader(reader io.Reader) error
UnmarshalBinaryFromReader uses the io.Reader data to set all the internal properties of the ClusterManagement type
func (*ClusterManagement) UnmarshalBinaryWithContext ¶
func (target *ClusterManagement) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error)
UnmarshalBinaryWithContext uses the context containing a string table and binary buffer to set all the internal properties of the ClusterManagement type
func (*ClusterManagement) Window ¶
func (cm *ClusterManagement) Window() Window
Window return the Asset's window
type DecodingContext ¶
type DecodingContext struct {
Buffer *util.Buffer
Table StringTableReader
}
DecodingContext is a context object passed to the decoders to ensure parent objects reuse as much data as possible
func NewDecodingContextFromBytes ¶
func NewDecodingContextFromBytes(data []byte) *DecodingContext
NewDecodingContextFromBytes creates a new DecodingContext instance using an byte slice
func NewDecodingContextFromReader ¶
func NewDecodingContextFromReader(reader io.Reader) *DecodingContext
NewDecodingContextFromReader creates a new DecodingContext instance using an io.Reader implementation
func (*DecodingContext) Close ¶
func (dc *DecodingContext) Close()
Close will ensure that any string table resources and buffer resources are cleaned up.
func (*DecodingContext) IsStringTable ¶
func (dc *DecodingContext) IsStringTable() bool
IsStringTable returns true if the table is available
type Disk ¶
type Disk struct {
Cost float64
ByteHours float64
Local float64
Breakdown *Breakdown
// contains filtered or unexported fields
}
Disk represents an in-cluster disk Asset
func (*Disk) Add ¶
Add sums the Asset with the given Asset to produce a new Asset, maintaining as much relevant information as possible (i.e. type, properties, labels).
func (*Disk) Adjustment ¶
Adjustment returns the Asset's cost adjustment
func (*Disk) Bytes ¶
Bytes returns the number of bytes belonging to the disk. This could be fractional because it's the number of byte*hours divided by the number of hours running; e.g. the sum of a 100GiB disk running for the first 10 hours and a 30GiB disk running for the last 20 hours of the same 24-hour window would produce:
(100*10 + 30*20) / 24 = 66.667GiB
However, any number of disks running for the full span of a window will report the actual number of bytes of the static disk; e.g. the above scenario for one entire 24-hour window:
(100*24 + 30*24) / 24 = (100 + 30) = 130GiB
func (*Disk) ExpandWindow ¶
ExpandWindow expands the Asset's window by the given window
func (*Disk) MarshalBinary ¶
MarshalBinary serializes the internal properties of this Disk instance into a byte array
func (*Disk) MarshalBinaryWithContext ¶
func (target *Disk) MarshalBinaryWithContext(ctx *EncodingContext) (err error)
MarshalBinaryWithContext serializes the internal properties of this Disk instance into a byte array leveraging a predefined context.
func (*Disk) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface
func (*Disk) Properties ¶
func (d *Disk) Properties() *AssetProperties
Properties returns the Asset's properties
func (*Disk) SetAdjustment ¶
SetAdjustment sets the Asset's cost adjustment
func (*Disk) SetLabels ¶
func (d *Disk) SetLabels(labels AssetLabels)
SetLabels sets the Asset's labels
func (*Disk) SetProperties ¶
func (d *Disk) SetProperties(props *AssetProperties)
SetProperties sets the Asset's properties
func (*Disk) SetStartEnd ¶
SetStartEnd sets the Asset's Start and End fields
func (*Disk) UnmarshalBinary ¶
UnmarshalBinary uses the data passed byte array to set all the internal properties of the Disk type
func (*Disk) UnmarshalBinaryFromReader ¶
UnmarshalBinaryFromReader uses the io.Reader data to set all the internal properties of the Disk type
func (*Disk) UnmarshalBinaryWithContext ¶
func (target *Disk) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error)
UnmarshalBinaryWithContext uses the context containing a string table and binary buffer to set all the internal properties of the Disk type
type EncodingContext ¶
type EncodingContext struct {
Buffer *util.Buffer
Table *StringTableWriter
}
EncodingContext is a context object passed to the encoders to ensure reuse of buffer and table data
func (*EncodingContext) IsStringTable ¶
func (ec *EncodingContext) IsStringTable() bool
IsStringTable returns true if the table is available
type FileStringTableReader ¶
type FileStringTableReader struct {
// contains filtered or unexported fields
}
FileStringTableReader leverages a local file to write string table data for lookup. On memory focused systems, this allows a slower parse with a significant decrease in memory usage. This implementation is often pair with streaming readers for high throughput with reduced memory usage.
func (*FileStringTableReader) At ¶
func (fstr *FileStringTableReader) At(index int) string
At returns the string from the internal file using the reference's offset and length.
func (*FileStringTableReader) Close ¶
func (fstr *FileStringTableReader) Close() error
Close for the file string table reader closes the file and deletes it.
func (*FileStringTableReader) Len ¶
func (fstr *FileStringTableReader) Len() int
Len returns the total number of strings loaded in the string table.
type LoadBalancer ¶
type LoadBalancer struct {
Cost float64
// contains filtered or unexported fields
}
LoadBalancer is an Asset representing a single load balancer in a cluster TODO: add GB of ingress processed, numForwardingRules once we start recording those to prometheus metric
func NewLoadBalancer ¶
func NewLoadBalancer(name, cluster, providerID string, start, end time.Time, window Window) *LoadBalancer
NewLoadBalancer instantiates and returns a new LoadBalancer
func (*LoadBalancer) Add ¶
func (lb *LoadBalancer) Add(a Asset) Asset
Add sums the Asset with the given Asset to produce a new Asset, maintaining as much relevant information as possible (i.e. type, properties, labels).
func (*LoadBalancer) Adjustment ¶
func (lb *LoadBalancer) Adjustment() float64
Adjustment returns the Asset's cost adjustment
func (*LoadBalancer) Clone ¶
func (lb *LoadBalancer) Clone() Asset
Clone returns a cloned instance of the given Asset
func (*LoadBalancer) End ¶
func (lb *LoadBalancer) End() time.Time
End returns the preceise end point of the Asset within the window
func (*LoadBalancer) Equal ¶
func (lb *LoadBalancer) Equal(a Asset) bool
Equal returns true if the tow Assets match precisely
func (*LoadBalancer) ExpandWindow ¶
func (lb *LoadBalancer) ExpandWindow(w Window)
ExpandWindow expands the Asset's window by the given window
func (*LoadBalancer) Labels ¶
func (lb *LoadBalancer) Labels() AssetLabels
Labels returns the Asset's labels
func (*LoadBalancer) MarshalBinary ¶
func (target *LoadBalancer) MarshalBinary() (data []byte, err error)
MarshalBinary serializes the internal properties of this LoadBalancer instance into a byte array
func (*LoadBalancer) MarshalBinaryWithContext ¶
func (target *LoadBalancer) MarshalBinaryWithContext(ctx *EncodingContext) (err error)
MarshalBinaryWithContext serializes the internal properties of this LoadBalancer instance into a byte array leveraging a predefined context.
func (*LoadBalancer) MarshalJSON ¶
func (lb *LoadBalancer) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshal
func (*LoadBalancer) Minutes ¶
func (lb *LoadBalancer) Minutes() float64
Minutes returns the number of minutes the Asset ran within the window
func (*LoadBalancer) Properties ¶
func (lb *LoadBalancer) Properties() *AssetProperties
Properties returns the Asset's properties
func (*LoadBalancer) SetAdjustment ¶
func (lb *LoadBalancer) SetAdjustment(adj float64)
SetAdjustment sets the Asset's cost adjustment
func (*LoadBalancer) SetLabels ¶
func (lb *LoadBalancer) SetLabels(labels AssetLabels)
SetLabels sets the Asset's labels
func (*LoadBalancer) SetProperties ¶
func (lb *LoadBalancer) SetProperties(props *AssetProperties)
SetProperties sets the Asset's properties
func (*LoadBalancer) SetStartEnd ¶
func (lb *LoadBalancer) SetStartEnd(start, end time.Time)
SetStartEnd sets the Asset's Start and End fields
func (*LoadBalancer) Start ¶
func (lb *LoadBalancer) Start() time.Time
Start returns the preceise start point of the Asset within the window
func (*LoadBalancer) String ¶
func (lb *LoadBalancer) String() string
String implements fmt.Stringer
func (*LoadBalancer) TotalCost ¶
func (lb *LoadBalancer) TotalCost() float64
TotalCost returns the total cost of the Asset
func (*LoadBalancer) Type ¶
func (lb *LoadBalancer) Type() AssetType
Type returns the AssetType of the Asset
func (*LoadBalancer) UnmarshalBinary ¶
func (target *LoadBalancer) UnmarshalBinary(data []byte) error
UnmarshalBinary uses the data passed byte array to set all the internal properties of the LoadBalancer type
func (*LoadBalancer) UnmarshalBinaryFromReader ¶
func (target *LoadBalancer) UnmarshalBinaryFromReader(reader io.Reader) error
UnmarshalBinaryFromReader uses the io.Reader data to set all the internal properties of the LoadBalancer type
func (*LoadBalancer) UnmarshalBinaryWithContext ¶
func (target *LoadBalancer) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error)
UnmarshalBinaryWithContext uses the context containing a string table and binary buffer to set all the internal properties of the LoadBalancer type
func (*LoadBalancer) Window ¶
func (lb *LoadBalancer) Window() Window
Window returns the window within which the Asset ran
type Network ¶
type Network struct {
Cost float64
// contains filtered or unexported fields
}
Network is an Asset representing a single node's network costs
func NewNetwork ¶
NewNetwork creates and returns a new Network Asset
func (*Network) Add ¶
Add sums the Asset with the given Asset to produce a new Asset, maintaining as much relevant information as possible (i.e. type, properties, labels).
func (*Network) Adjustment ¶
Adjustment returns the Asset's cost adjustment
func (*Network) ExpandWindow ¶
ExpandWindow expands the Asset's window by the given window
func (*Network) MarshalBinary ¶
MarshalBinary serializes the internal properties of this Network instance into a byte array
func (*Network) MarshalBinaryWithContext ¶
func (target *Network) MarshalBinaryWithContext(ctx *EncodingContext) (err error)
MarshalBinaryWithContext serializes the internal properties of this Network instance into a byte array leveraging a predefined context.
func (*Network) MarshalJSON ¶
MarshalJSON implements json.Marshal interface
func (*Network) Properties ¶
func (n *Network) Properties() *AssetProperties
Properties returns the Asset's properties
func (*Network) SetAdjustment ¶
SetAdjustment sets the Asset's cost adjustment
func (*Network) SetLabels ¶
func (n *Network) SetLabels(labels AssetLabels)
SetLabels sets the Asset's labels
func (*Network) SetProperties ¶
func (n *Network) SetProperties(props *AssetProperties)
SetProperties sets the Asset's properties
func (*Network) SetStartEnd ¶
SetStartEnd sets the Asset's Start and End fields
func (*Network) UnmarshalBinary ¶
UnmarshalBinary uses the data passed byte array to set all the internal properties of the Network type
func (*Network) UnmarshalBinaryFromReader ¶
UnmarshalBinaryFromReader uses the io.Reader data to set all the internal properties of the Network type
func (*Network) UnmarshalBinaryWithContext ¶
func (target *Network) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error)
UnmarshalBinaryWithContext uses the context containing a string table and binary buffer to set all the internal properties of the Network type
type Node ¶
type Node struct {
NodeType string
CPUCoreHours float64
RAMByteHours float64
GPUHours float64
CPUBreakdown *Breakdown
RAMBreakdown *Breakdown
CPUCost float64
GPUCost float64
GPUCount float64
RAMCost float64
Discount float64
Preemptible float64
// contains filtered or unexported fields
}
Node is an Asset representing a single node in a cluster
func (*Node) Add ¶
Add sums the Asset with the given Asset to produce a new Asset, maintaining as much relevant information as possible (i.e. type, properties, labels).
func (*Node) Adjustment ¶
Adjustment returns the Asset's cost adjustment
func (*Node) CPUCores ¶
CPUCores returns the number of cores belonging to the node. This could be fractional because it's the number of core*hours divided by the number of hours running; e.g. the sum of a 4-core node running for the first 10 hours and a 3-core node running for the last 20 hours of the same 24-hour window would produce:
(4*10 + 3*20) / 24 = 4.167 cores
However, any number of cores running for the full span of a window will report the actual number of cores of the static node; e.g. the above scenario for one entire 24-hour window:
(4*24 + 3*24) / 24 = (4 + 3) = 7 cores
func (*Node) ExpandWindow ¶
ExpandWindow expands the Asset's window by the given window
func (*Node) GPUs ¶
GPUs returns the amount of GPUs belonging to the node. This could be fractional because it's the number of gpu*hours divided by the number of hours running; e.g. the sum of a 2 gpu node running for the first 10 hours and a 1 gpu node running for the last 20 hours of the same 24-hour window would produce:
(2*10 + 1*20) / 24 = 1.667 GPUs
However, any number of GPUs running for the full span of a window will report the actual number of GPUs of the static node; e.g. the above scenario for one entire 24-hour window:
(2*24 + 1*24) / 24 = (2 + 1) = 3 GPUs
func (*Node) IsPreemptible ¶
IsPreemptible returns true if the node is 100% preemptible. It's possible to be "partially preemptible" by adding a preemptible node with a non-preemptible node.
func (*Node) MarshalBinary ¶
MarshalBinary serializes the internal properties of this Node instance into a byte array
func (*Node) MarshalBinaryWithContext ¶
func (target *Node) MarshalBinaryWithContext(ctx *EncodingContext) (err error)
MarshalBinaryWithContext serializes the internal properties of this Node instance into a byte array leveraging a predefined context.
func (*Node) MarshalJSON ¶
MarshalJSON implements json.Marshal interface
func (*Node) Properties ¶
func (n *Node) Properties() *AssetProperties
Properties returns the Asset's properties
func (*Node) RAMBytes ¶
RAMBytes returns the amount of RAM belonging to the node. This could be fractional because it's the number of byte*hours divided by the number of hours running; e.g. the sum of a 12GiB-RAM node running for the first 10 hours and a 16GiB-RAM node running for the last 20 hours of the same 24-hour window would produce:
(12*10 + 16*20) / 24 = 18.333GiB RAM
However, any number of bytes running for the full span of a window will report the actual number of bytes of the static node; e.g. the above scenario for one entire 24-hour window:
(12*24 + 16*24) / 24 = (12 + 16) = 28GiB RAM
func (*Node) SetAdjustment ¶
SetAdjustment sets the Asset's cost adjustment
func (*Node) SetLabels ¶
func (n *Node) SetLabels(labels AssetLabels)
SetLabels sets the Asset's labels
func (*Node) SetProperties ¶
func (n *Node) SetProperties(props *AssetProperties)
SetProperties sets the Asset's properties
func (*Node) SetStartEnd ¶
SetStartEnd sets the Asset's Start and End fields
func (*Node) UnmarshalBinary ¶
UnmarshalBinary uses the data passed byte array to set all the internal properties of the Node type
func (*Node) UnmarshalBinaryFromReader ¶
UnmarshalBinaryFromReader uses the io.Reader data to set all the internal properties of the Node type
func (*Node) UnmarshalBinaryWithContext ¶
func (target *Node) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error)
UnmarshalBinaryWithContext uses the context containing a string table and binary buffer to set all the internal properties of the Node type
type PVAllocation ¶
PVAllocation contains the byte hour usage and cost of an Allocation for a single PV
func (*PVAllocation) MarshalBinary ¶
func (target *PVAllocation) MarshalBinary() (data []byte, err error)
MarshalBinary serializes the internal properties of this PVAllocation instance into a byte array
func (*PVAllocation) MarshalBinaryWithContext ¶
func (target *PVAllocation) MarshalBinaryWithContext(ctx *EncodingContext) (err error)
MarshalBinaryWithContext serializes the internal properties of this PVAllocation instance into a byte array leveraging a predefined context.
func (*PVAllocation) UnmarshalBinary ¶
func (target *PVAllocation) UnmarshalBinary(data []byte) error
UnmarshalBinary uses the data passed byte array to set all the internal properties of the PVAllocation type
func (*PVAllocation) UnmarshalBinaryFromReader ¶
func (target *PVAllocation) UnmarshalBinaryFromReader(reader io.Reader) error
UnmarshalBinaryFromReader uses the io.Reader data to set all the internal properties of the PVAllocation type
func (*PVAllocation) UnmarshalBinaryWithContext ¶
func (target *PVAllocation) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error)
UnmarshalBinaryWithContext uses the context containing a string table and binary buffer to set all the internal properties of the PVAllocation type
type PVAllocations ¶
type PVAllocations map[PVKey]*PVAllocation
PVAllocations is a map of Disk Asset Identifiers to the usage of them by an Allocation as recorded in a PVAllocation
func (*PVAllocations) Add ¶
func (pv *PVAllocations) Add(that PVAllocations) PVAllocations
Add adds contents of that to the calling PVAllocations
func (*PVAllocations) Clone ¶
func (pv *PVAllocations) Clone() PVAllocations
Clone creates a deep copy of a PVAllocations
type PVKey ¶
PVKey for identifying Disk type assets
func (*PVKey) MarshalBinary ¶
MarshalBinary serializes the internal properties of this PVKey instance into a byte array
func (*PVKey) MarshalBinaryWithContext ¶
func (target *PVKey) MarshalBinaryWithContext(ctx *EncodingContext) (err error)
MarshalBinaryWithContext serializes the internal properties of this PVKey instance into a byte array leveraging a predefined context.
func (*PVKey) UnmarshalBinary ¶
UnmarshalBinary uses the data passed byte array to set all the internal properties of the PVKey type
func (*PVKey) UnmarshalBinaryFromReader ¶
UnmarshalBinaryFromReader uses the io.Reader data to set all the internal properties of the PVKey type
func (*PVKey) UnmarshalBinaryWithContext ¶
func (target *PVKey) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error)
UnmarshalBinaryWithContext uses the context containing a string table and binary buffer to set all the internal properties of the PVKey type
type RawAllocationOnlyData ¶
type RawAllocationOnlyData struct {
CPUCoreUsageMax float64 `json:"cpuCoreUsageMax"`
RAMBytesUsageMax float64 `json:"ramByteUsageMax"`
}
RawAllocationOnlyData is information that only belong in "raw" Allocations, those which have not undergone aggregation, accumulation, or any other form of combination to produce a new Allocation from other Allocations.
Max usage data belongs here because computing the overall maximum from two or more Allocations is a non-trivial operation that cannot be defined without maintaining a large amount of state. Consider the following example: _______________________________________________
A1 Using 3 CPU ---- ----- ------ A2 Using 2 CPU ---- ----- ---- A3 Using 1 CPU --- -- _______________________________________________
Time ---->
The logical maximum CPU usage is 5, but this cannot be calculated iteratively, which is how we calculate aggregations and accumulations of Allocations currently. This becomes a problem I could call "maximum sum of overlapping intervals" and is essentially a variant of an interval scheduling algorithm.
If we had types to differentiate between regular Allocations and AggregatedAllocations then this type would be unnecessary and its fields would go into the regular Allocation and not in the AggregatedAllocation.
func (*RawAllocationOnlyData) Clone ¶
func (r *RawAllocationOnlyData) Clone() *RawAllocationOnlyData
Clone returns a deep copy of the given RawAllocationOnlyData
func (*RawAllocationOnlyData) MarshalBinary ¶
func (target *RawAllocationOnlyData) MarshalBinary() (data []byte, err error)
MarshalBinary serializes the internal properties of this RawAllocationOnlyData instance into a byte array
func (*RawAllocationOnlyData) MarshalBinaryWithContext ¶
func (target *RawAllocationOnlyData) MarshalBinaryWithContext(ctx *EncodingContext) (err error)
MarshalBinaryWithContext serializes the internal properties of this RawAllocationOnlyData instance into a byte array leveraging a predefined context.
func (*RawAllocationOnlyData) UnmarshalBinary ¶
func (target *RawAllocationOnlyData) UnmarshalBinary(data []byte) error
UnmarshalBinary uses the data passed byte array to set all the internal properties of the RawAllocationOnlyData type
func (*RawAllocationOnlyData) UnmarshalBinaryFromReader ¶
func (target *RawAllocationOnlyData) UnmarshalBinaryFromReader(reader io.Reader) error
UnmarshalBinaryFromReader uses the io.Reader data to set all the internal properties of the RawAllocationOnlyData type
func (*RawAllocationOnlyData) UnmarshalBinaryWithContext ¶
func (target *RawAllocationOnlyData) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error)
UnmarshalBinaryWithContext uses the context containing a string table and binary buffer to set all the internal properties of the RawAllocationOnlyData type
type SharedAsset ¶
type SharedAsset struct {
// contains filtered or unexported fields
}
SharedAsset is an Asset representing a shared cost
func NewSharedAsset ¶
func NewSharedAsset(name string, window Window) *SharedAsset
NewSharedAsset creates and returns a new SharedAsset
func (*SharedAsset) Add ¶
func (sa *SharedAsset) Add(a Asset) Asset
Add sums the Asset with the given Asset to produce a new Asset, maintaining as much relevant information as possible (i.e. type, properties, labels).
func (*SharedAsset) Adjustment ¶
func (sa *SharedAsset) Adjustment() float64
Adjustment is not relevant to SharedAsset, but required to implement Asset
func (*SharedAsset) Clone ¶
func (sa *SharedAsset) Clone() Asset
Clone returns a deep copy of the given SharedAsset
func (*SharedAsset) End ¶
func (sa *SharedAsset) End() time.Time
End returns the end time of the Asset
func (*SharedAsset) Equal ¶
func (sa *SharedAsset) Equal(a Asset) bool
Equal returns true if the two Assets are exact matches
func (*SharedAsset) ExpandWindow ¶
func (sa *SharedAsset) ExpandWindow(w Window)
ExpandWindow expands the Asset's window
func (*SharedAsset) Labels ¶
func (sa *SharedAsset) Labels() AssetLabels
Labels returns the Asset's labels
func (*SharedAsset) MarshalBinary ¶
func (target *SharedAsset) MarshalBinary() (data []byte, err error)
MarshalBinary serializes the internal properties of this SharedAsset instance into a byte array
func (*SharedAsset) MarshalBinaryWithContext ¶
func (target *SharedAsset) MarshalBinaryWithContext(ctx *EncodingContext) (err error)
MarshalBinaryWithContext serializes the internal properties of this SharedAsset instance into a byte array leveraging a predefined context.
func (*SharedAsset) MarshalJSON ¶
func (sa *SharedAsset) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler
func (*SharedAsset) Minutes ¶
func (sa *SharedAsset) Minutes() float64
Minutes returns the number of minutes the SharedAsset ran within the window
func (*SharedAsset) Properties ¶
func (sa *SharedAsset) Properties() *AssetProperties
Properties returns the Asset's properties
func (*SharedAsset) SetAdjustment ¶
func (sa *SharedAsset) SetAdjustment(float64)
SetAdjustment is not relevant to SharedAsset, but required to implement Asset
func (*SharedAsset) SetLabels ¶
func (sa *SharedAsset) SetLabels(labels AssetLabels)
SetLabels sets the Asset's labels
func (*SharedAsset) SetProperties ¶
func (sa *SharedAsset) SetProperties(props *AssetProperties)
SetProperties sets the Asset's properties
func (*SharedAsset) SetStartEnd ¶
func (sa *SharedAsset) SetStartEnd(start, end time.Time)
SetStartEnd sets the Asset's Start and End fields (not applicable here)
func (*SharedAsset) Start ¶
func (sa *SharedAsset) Start() time.Time
Start returns the start time of the Asset
func (*SharedAsset) TotalCost ¶
func (sa *SharedAsset) TotalCost() float64
TotalCost returns the Asset's total cost
func (*SharedAsset) Type ¶
func (sa *SharedAsset) Type() AssetType
Type returns the AssetType of the Asset
func (*SharedAsset) UnmarshalBinary ¶
func (target *SharedAsset) UnmarshalBinary(data []byte) error
UnmarshalBinary uses the data passed byte array to set all the internal properties of the SharedAsset type
func (*SharedAsset) UnmarshalBinaryFromReader ¶
func (target *SharedAsset) UnmarshalBinaryFromReader(reader io.Reader) error
UnmarshalBinaryFromReader uses the io.Reader data to set all the internal properties of the SharedAsset type
func (*SharedAsset) UnmarshalBinaryWithContext ¶
func (target *SharedAsset) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error)
UnmarshalBinaryWithContext uses the context containing a string table and binary buffer to set all the internal properties of the SharedAsset type
func (*SharedAsset) Window ¶
func (sa *SharedAsset) Window() Window
Window returns the window within the SharedAsset ran
type SliceStringTableReader ¶
type SliceStringTableReader struct {
// contains filtered or unexported fields
}
SliceStringTableReader is a basic pre-loaded []string that provides index-based access. The cost of this implementation is holding all strings in memory, which provides faster lookup performance at the expense of memory usage.
func (*SliceStringTableReader) At ¶
func (sstr *SliceStringTableReader) At(index int) string
At returns the string entry at a specific index, or panics on out of bounds.
func (*SliceStringTableReader) Close ¶
func (sstr *SliceStringTableReader) Close() error
Close for the slice tables just nils out the slice and returns
func (*SliceStringTableReader) Len ¶
func (sstr *SliceStringTableReader) Len() int
Len returns the total number of strings loaded in the string table.
type StreamFactoryFunc ¶
type StreamFactoryFunc func(io.Reader) BingenStream
StreamFactoryFunc is an alias for a func that creates a BingenStream implementation.
type StringTableReader ¶
type StringTableReader interface {
// At returns the string entry at a specific index, or panics on out of bounds.
At(index int) string
// Len returns the total number of strings loaded in the string table.
Len() int
// Close will clear the loaded table, and drop any external resources used.
Close() error
}
StringTableReader is the interface used to read the string table from the decoding.
func NewFileStringTableReaderFrom ¶
func NewFileStringTableReaderFrom(buffer *util.Buffer, dir string) StringTableReader
NewFileStringTableFromBuffer reads exactly tl length-prefixed (uint16) string payloads from buffer and appends each payload to a new temp file. It does not retain full strings in memory.
func NewSliceStringTableReaderFrom ¶
func NewSliceStringTableReaderFrom(buffer *util.Buffer) StringTableReader
NewSliceStringTableReaderFrom creates a new SliceStringTableReader instance loading data directly from the buffer. The buffer's position should start at the table length.
type StringTableWriter ¶
type StringTableWriter struct {
// contains filtered or unexported fields
}
StringTableWriter maps strings to specific indices for encoding
func NewStringTableWriter ¶
func NewStringTableWriter(contents ...string) *StringTableWriter
NewStringTableWriter Creates a new StringTableWriter instance with provided contents
func (*StringTableWriter) AddOrGet ¶
func (st *StringTableWriter) AddOrGet(s string) int
AddOrGet atomically retrieves a string entry's index if it exist. Otherwise, it will add the entry and return the index.
func (*StringTableWriter) ToBytes ¶
func (st *StringTableWriter) ToBytes() []byte
ToBytes Converts the contents to a binary encoded representation
func (*StringTableWriter) ToSlice ¶
func (st *StringTableWriter) ToSlice() []string
ToSlice Converts the contents to a string array for encoding.
type Window ¶
type Window struct {
// contains filtered or unexported fields
}
Window defines a period of time with a start and an end. If either start or end are nil it indicates an open time period.
func NewClosedWindow ¶
NewClosedWindow creates and returns a new Window instance from the given times, which cannot be nil, so they are value types.
func ParseWindowUTC ¶
ParseWindowUTC attempts to parse the given string into a valid Window. It accepts several formats, returning an error if the given string does not match one of the following: - named intervals: "today", "yesterday", "week", "month", "lastweek", "lastmonth" - durations: "24h", "7d", etc. - date ranges: "2020-04-01T00:00:00Z,2020-04-03T00:00:00Z", etc. - timestamp ranges: "1586822400,1586908800", etc.
func ParseWindowWithOffset ¶
ParseWindowWithOffset parses the given window string within the context of the timezone defined by the UTC offset.
func ParseWindowWithOffsetString ¶
ParseWindowWithOffsetString parses the given window string within the context of the timezone defined by the UTC offset string of format -07:00, +01:30, etc.
func (Window) ApproximatelyEqual ¶
ApproximatelyEqual returns true if the start and end times of the two windows, respectively, are within the given threshold of each other.
func (Window) DurationOffset ¶
DurationOffset returns durations representing the duration and offset of the given window
func (Window) DurationOffsetForPrometheus ¶
DurationOffsetForPrometheus returns strings representing durations for the duration and offset of the given window, factoring in the Thanos offset if necessary. Whereas duration is a simple duration string (e.g. "1d"), the offset includes the word "offset" (e.g. " offset 2d") so that the values returned can be used directly in the formatting string "some_metric[%s]%s" to generate the query "some_metric[1d] offset 2d".
func (Window) DurationOffsetStrings ¶
DurationOffsetStrings returns formatted, Prometheus-compatible strings representing the duration and offset of the window in terms of days, hours, minutes, or seconds; e.g. ("7d", "1441m", "30m", "1s", "")
func (Window) IsNegative ¶
func (*Window) MarshalBinary ¶
MarshalBinary serializes the internal properties of this Window instance into a byte array
func (*Window) MarshalBinaryWithContext ¶
func (target *Window) MarshalBinaryWithContext(ctx *EncodingContext) (err error)
MarshalBinaryWithContext serializes the internal properties of this Window instance into a byte array leveraging a predefined context.
func (Window) MarshalJSON ¶
TODO:CLEANUP make this unmarshalable (make Start and End public)
func (*Window) UnmarshalBinary ¶
UnmarshalBinary uses the data passed byte array to set all the internal properties of the Window type
func (*Window) UnmarshalBinaryFromReader ¶
UnmarshalBinaryFromReader uses the io.Reader data to set all the internal properties of the Window type
func (*Window) UnmarshalBinaryWithContext ¶
func (target *Window) UnmarshalBinaryWithContext(ctx *DecodingContext) (err error)
UnmarshalBinaryWithContext uses the context containing a string table and binary buffer to set all the internal properties of the Window type