Documentation
¶
Index ¶
- func CountActiveInstances(instances []*Instance, active bool) int
- func CountInstancesByStatus(instances []*Instance, status Status) int
- type ByResultValues
- type Configuration
- type ContainerSpec
- type EventType
- type Events
- type Instance
- func GetActiveInstances(instances []*Instance, active bool) []*Instance
- func GetInstancesByProvider(instances []*Instance, provider string) []*Instance
- func GetInstancesByStatus(instances []*Instance, status Status) []*Instance
- func GetInstancesWithoutStatus(instances []*Instance, status Status) []*Instance
- func NewInstance(provider string, spec InstanceSpec) *Instance
- type InstanceEvent
- type InstanceSpec
- type InstanceStatus
- type MetricsReceiver
- type ProviderSpec
- type ReactiveThreshold
- type ResultValue
- type ScalingResult
- type ScrapeTarget
- type StaticSpec
- type Status
- type Subscription
- type Threshold
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CountActiveInstances ¶
func CountInstancesByStatus ¶
Types ¶
type ByResultValues ¶
type ByResultValues func(p1, p2 *ResultValue) bool
func (ByResultValues) Sort ¶
func (by ByResultValues) Sort(vars []*ResultValue)
type Configuration ¶
type Configuration struct { PrometheusURL string `json:"prometheus_url"` ScrapeTargets []struct { Name string `json:"name"` Path string `json:"path"` Description string `json:"description"` Query string `json:"query"` ProviderSpec struct { Weights map[string]int `json:"weights"` } `json:"provider"` InstanceSpec struct { ContainerSpec struct { Name string `json:"name"` Image string `json:"image"` } `json:"container"` } `json:"spec"` StaticSpec struct { Endpoints []string `json:"endpoints"` } `json:"static"` } `json:"targets"` }
type ContainerSpec ¶
type Events ¶
type Events struct {
// contains filtered or unexported fields
}
Events represents an event bus to broadcast instance updates
func (*Events) PublishInstanceEvent ¶
func (e *Events) PublishInstanceEvent(event InstanceEvent)
func (*Events) SubscribeToInstanceEvents ¶
func (e *Events) SubscribeToInstanceEvents(channel chan InstanceEvent) Subscription
func (*Events) UnsubscribeFromInstanceEvents ¶
func (e *Events) UnsubscribeFromInstanceEvents(s Subscription)
type Instance ¶
type Instance struct { Name string `json:"name"` Endpoint string `json:"endpoint"` Provider string `json:"provider"` Active bool `json:"active"` Container ContainerSpec `json:"container"` Status InstanceStatus `json:"status"` }
func GetActiveInstances ¶
func GetInstancesByProvider ¶
func GetInstancesByStatus ¶
func NewInstance ¶
func NewInstance(provider string, spec InstanceSpec) *Instance
TODO: add instance spec as attribute to InstanceDemand
type InstanceEvent ¶
type InstanceEvent struct { EventType EventType `json:"type"` ScrapeTarget string `json:"target"` Instances []*Instance `json:"data"` }
InstanceEvent is an event to be pushed to the instance event bus.
func NewInstanceEvent ¶
func NewInstanceEvent(eventType EventType, instance []*Instance) InstanceEvent
NewInstanceEvent creates a new event to be published via instance event bus.
type InstanceSpec ¶
type InstanceSpec struct {
Container ContainerSpec `json:"container"`
}
type InstanceStatus ¶
type MetricsReceiver ¶
type MetricsReceiver struct {
// contains filtered or unexported fields
}
func NewMetricsReceiver ¶
func NewMetricsReceiver(prometheusUrl string) (*MetricsReceiver, error)
type ProviderSpec ¶
type ReactiveThreshold ¶
type ReactiveThreshold struct {
// contains filtered or unexported fields
}
func NewReactiveThreshold ¶
func NewReactiveThreshold() *ReactiveThreshold
func NewReactiveThresholdWithThreshold ¶
func NewReactiveThresholdWithThreshold(threshold Threshold) *ReactiveThreshold
func (*ReactiveThreshold) Calculate ¶
func (c *ReactiveThreshold) Calculate(scrapeTarget *ScrapeTarget, instances []*Instance, metricValue float64) ScalingResult
type ResultValue ¶
type ScalingResult ¶
type ScalingResult struct {
Result []*ResultValue // the rounded demand for new instances
}
ScalingResult represents the calculated demand for instances
func (*ScalingResult) Sum ¶
func (s *ScalingResult) Sum() int
type ScrapeTarget ¶
type ScrapeTarget struct { Name string `json:"name"` Path string `json:"path"` Description string `json:"description"` Query string `json:"query"` ProviderSpec ProviderSpec `json:"provider"` InstanceSpec InstanceSpec `json:"instanceSpec"` StaticSpec StaticSpec `json:"static"` }
func ParseConfiguration ¶
func ParseConfiguration(config Configuration) ([]*ScrapeTarget, error)
type StaticSpec ¶
type StaticSpec struct {
Endpoints []string `json:"endpoints"`
}
type Subscription ¶
type Subscription struct {
// contains filtered or unexported fields
}
Subscription represents a subscription to the Events channel. It is used to identify a registered channel
Source Files
¶
Click to show internal directories.
Click to hide internal directories.