Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RunBillingMetricsCollector ¶
func RunBillingMetricsCollector( backgroundCtx context.Context, parentLogger *zap.Logger, conf *Config, store VMStoreForNode, metrics PromMetrics, )
Types ¶
type Config ¶
type Config struct { URL string `json:"url"` CPUMetricName string `json:"cpuMetricName"` ActiveTimeMetricName string `json:"activeTimeMetricName"` CollectEverySeconds uint `json:"collectEverySeconds"` AccumulateEverySeconds uint `json:"accumulateEverySeconds"` PushEverySeconds uint `json:"pushEverySeconds"` PushRequestTimeoutSeconds uint `json:"pushRequestTimeoutSeconds"` MaxBatchSize uint `json:"maxBatchSize"` }
type PromMetrics ¶
type PromMetrics struct {
// contains filtered or unexported fields
}
func NewPromMetrics ¶
func NewPromMetrics() PromMetrics
func (PromMetrics) MustRegister ¶
func (m PromMetrics) MustRegister(reg *prometheus.Registry)
type VMNodeIndex ¶
type VMNodeIndex struct {
// contains filtered or unexported fields
}
VMNodeIndex is a watch.Index that stores all of the VMs for a particular node
We have to implement this ourselves because K8s does not (as of 2023-04-04) support field selectors on CRDs, so we can't have the API server filter out VMs for us.
For more info, see: https://github.com/kubernetes/kubernetes/issues/53459 This comment in particular was particularly instructive: https://github.com/kubernetes/kubernetes/issues/53459#issuecomment-1146200268
func NewVMNodeIndex ¶
func NewVMNodeIndex(node string) *VMNodeIndex
func (*VMNodeIndex) Add ¶
func (i *VMNodeIndex) Add(vm *vmapi.VirtualMachine)
func (*VMNodeIndex) Delete ¶
func (i *VMNodeIndex) Delete(vm *vmapi.VirtualMachine)
func (*VMNodeIndex) List ¶
func (i *VMNodeIndex) List() []*vmapi.VirtualMachine
func (*VMNodeIndex) Update ¶
func (i *VMNodeIndex) Update(oldVM, newVM *vmapi.VirtualMachine)
type VMStoreForNode ¶
type VMStoreForNode = watch.IndexedStore[vmapi.VirtualMachine, *VMNodeIndex]
Click to show internal directories.
Click to hide internal directories.