api

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Interface

type Interface interface {
	GetResourceUsage() (*queue_info.ClusterUsage, error)
}

type UsageDBConfig

type UsageDBConfig struct {
	ClientType             string       `yaml:"clientType" json:"clientType"`
	ConnectionString       string       `yaml:"connectionString" json:"connectionString"`
	ConnectionStringEnvVar string       `yaml:"connectionStringEnvVar" json:"connectionStringEnvVar"`
	UsageParams            *UsageParams `yaml:"usageParams" json:"usageParams"`
}

func (*UsageDBConfig) GetUsageParams added in v0.8.2

func (c *UsageDBConfig) GetUsageParams() *UsageParams

GetUsageParams returns the usage params if set, and default params if not set.

type UsageParams added in v0.8.2

type UsageParams struct {
	// Half life period of the usage. If not set, or set to 0, the usage will not be decayed.
	HalfLifePeriod *time.Duration `yaml:"halfLifePeriod" json:"halfLifePeriod"`
	// Window size of the usage. Default is 1 week.
	WindowSize *time.Duration `yaml:"windowSize" json:"windowSize"`
	// Window type for time-series aggregation. If not set, defaults to sliding.
	WindowType *WindowType `yaml:"windowType" json:"windowType"`
}

UsageParams defines common params for all usage db clients. Some clients may not support all the params.

func (*UsageParams) GetWindowTypeOrDefault added in v0.8.2

func (up *UsageParams) GetWindowTypeOrDefault() WindowType

GetWindowTypeOrDefault returns the window type if set, otherwise returns the default (sliding)

func (*UsageParams) SetDefaults added in v0.8.2

func (up *UsageParams) SetDefaults()

type WindowType added in v0.8.2

type WindowType string

WindowType defines the type of time window for aggregating usage data

const (
	// TumblingWindow represents non-overlapping, fixed-size time windows
	// Example: 1-hour windows at 0-1h, 1-2h, 2-3h
	TumblingWindow WindowType = "tumbling"

	// SlidingWindow represents overlapping time windows that slide forward
	// Example: a 1-hour sliding window will consider the usage of the last 1 hour prior to the current time.
	SlidingWindow WindowType = "sliding"
)

func GetDefaultWindowType added in v0.8.2

func GetDefaultWindowType() WindowType

GetDefaultWindowType returns the default window type (sliding)

func (WindowType) IsValid added in v0.8.2

func (wt WindowType) IsValid() bool

IsValid returns true if the WindowType is a valid value

Jump to

Keyboard shortcuts

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