Documentation ¶
Index ¶
Constants ¶
const ( Name = "throttler" Usage = "" /* 159-byte string literal not displayed */ )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct { *kingpin.Application // contains filtered or unexported fields }
App holds application state.
func (*App) Main ¶
func (app *App) Main(g prometheus.Gatherer)
Main is the main method of App and should be called in main.main() after flag parsing.
type AutoScalingGroupEnabler ¶
type AutoScalingGroupEnabler struct {
// contains filtered or unexported fields
}
AutoScalingGroupEnabler enables or disabled the scaling actions of an AWS AutoScaling Group. It does this by enabling/disabling the "AlarmNotification" process so the group doesn't react to scaling alarms.
See also: https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-suspend-resume-processes.html
func NewAutoScalingGroupEnabler ¶
func NewAutoScalingGroupEnabler(client asgEnablerClient, log *zap.Logger, dryRun bool, group string) (*AutoScalingGroupEnabler, error)
NewAutoScalingGroupEnabler returns a new AutoScalingGroupEnabler.
func (*AutoScalingGroupEnabler) Disable ¶
func (asge *AutoScalingGroupEnabler) Disable() error
Enable disables scaling actions for the AutoScaling Group. Subsequent calls to Disable are idempotent.
func (*AutoScalingGroupEnabler) Enable ¶
func (asge *AutoScalingGroupEnabler) Enable() error
Enable enables scaling actions for the AutoScaling Group. Subsequent calls to Enable are idempotent.
func (*AutoScalingGroupEnabler) IsEnabled ¶
func (asge *AutoScalingGroupEnabler) IsEnabled() bool
IsEnabled returns true if scaling is enabled.
type ECSServiceState ¶ added in v2.0.2
type ECSServiceState struct { // The number of deployments the service has // going on. The normal number of deployments // is 1: the currently running version of the service. // If there are > 1, that probably means a new version // of the service is being deployed. NumDeployments int }
ECSServiceState represents the state of an AWS ECS Service in the context of the throttler app.
type ECSServiceStateGetter ¶ added in v2.0.2
type ECSServiceStateGetter struct {
// contains filtered or unexported fields
}
ElasticsearchStateGetter queries AWS to return status information about an ECS service in an ECS cluster that is useful when deciding whether to allow scaling up or down of the Elasticsearch cluster.
func MockECSServiceStateGetter ¶ added in v2.0.2
func MockECSServiceStateGetter(mockClient ecsiface.ClientAPI) *ECSServiceStateGetter
MockECSServiceStateGetter takes an ECSClient arg and returns a new ECSServiceStateGetter.
func NewECSServiceStateGetter ¶ added in v2.0.2
func NewECSServiceStateGetter(cfg aws.Config) *ECSServiceStateGetter
NewECSServiceStateGetter returns a new ECSServiceStateGetter.
func (*ECSServiceStateGetter) Get ¶ added in v2.0.2
func (g *ECSServiceStateGetter) Get(cluster, service string) (*ECSServiceState, error)
Get returns the state of an ECS service.
type ElasticsearchState ¶ added in v2.0.2
type ElasticsearchState struct { // One of: "red", "yellow", "green". Status string // True if shards are being moved from one node to another. RelocatingShards bool // True if indices are recovering from data // stored on disk, such as during a node reboot. RecoveringFromStore bool }
ElasticsearchState represents the state of an Elasticsearch cluster in the context of the throttler app.
type ElasticsearchStateGetter ¶ added in v2.0.2
type ElasticsearchStateGetter struct {
// contains filtered or unexported fields
}
ElasticsearchStateGetter queries an Elasticsearch cluster to return status information about the cluster that is useful when deciding whether to allow scaling up or down of the Elasticsearch cluster.
func NewElasticsearchStateGetter ¶ added in v2.0.2
func NewElasticsearchStateGetter(client *elastic.Client) *ElasticsearchStateGetter
NewElasticsearchStateGetter returns a new ElasticsearchStateGetter.
func (*ElasticsearchStateGetter) Get ¶ added in v2.0.2
func (sg *ElasticsearchStateGetter) Get() (*ElasticsearchState, error)
Get returns an ElasticsearchState.
type Flags ¶
type Flags struct { // Names of an AutoScaling Groups to enable/disable // scaling on based on Elasticsearch status. AutoScalingGroupNames []string // The AWS ECS cluster/services that run Elasticsearch. ECSCluster string ECSServices []string // The interval at which throttler should poll // Elasticsearch for status information. PollInterval time.Duration // If true, log actions without actually taking them. DryRun bool *cmd.AWSFlags *cmd.ElasticsearchFlags *cmd.LoggingFlags *cmd.ServerFlags }
Flags holds command line flags for the throttler App.
type Healthchecks ¶
type Healthchecks struct { Handler healthcheck.Handler // Flag to be set true once a connection // to Elasticsearch is successfully established. ElasticSessionCreated bool // Flag to be set true once an AWS session // has been successfully created. AWSSessionCreated bool }
func NewHealthchecks ¶
func NewHealthchecks(r prometheus.Registerer, namespace string) *Healthchecks
type Instrumentation ¶
type Instrumentation struct { // Count of the number of times throttler has // polled Elasticsearch for status information. Loops prometheus.Counter // Set to 1 if autoscaling of the Elasticsearch // cluster is enabled. ScalingStatus *prometheus.GaugeVec }
Instrumentation holds Prometheus metrics specific to the throttler App.
func NewInstrumentation ¶
func NewInstrumentation(namespace string) *Instrumentation
NewInstrumentation returns a new Instrumentation.
func (*Instrumentation) Collect ¶
func (m *Instrumentation) Collect(c chan<- prometheus.Metric)
Collect implements the prometheus.Collector interface.
func (*Instrumentation) Describe ¶
func (m *Instrumentation) Describe(c chan<- *prometheus.Desc)
Describe implements the prometheus.Collector interface.