Documentation ¶
Overview ¶
Package machine keeps track of machines and applications for scotty.
Index ¶
- func ByHostAndName(list []*Endpoint)
- type Endpoint
- type EndpointObservation
- type EndpointObservations
- type EndpointStore
- func (e *EndpointStore) AllActiveWithStore() ([]*Endpoint, *store.Store)
- func (e *EndpointStore) AllWithStore() (result []*Endpoint, astore *store.Store)
- func (e *EndpointStore) ByHostAndName(host, name string) (*Endpoint, *store.Store)
- func (e *EndpointStore) LogChangedMetricCount(ep *scotty.Endpoint, metricCount uint)
- func (e *EndpointStore) ReportError(ep *scotty.Endpoint, err error, ts time.Time)
- func (e *EndpointStore) Store() *store.Store
- func (e *EndpointStore) UpdateEndpoints(timestamp float64, endpoints map[string]EndpointObservation)
- func (e *EndpointStore) UpdateMachines(timestamp float64, activeHosts []mdb.Machine)
- func (e *EndpointStore) UpdateState(ep *scotty.Endpoint, newState *scotty.State)
- type Machine
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ByHostAndName ¶
func ByHostAndName(list []*Endpoint)
ByHostAndName sorts list by the hostname and then by application name in ascending order.
Types ¶
type Endpoint ¶
type Endpoint struct { M *Machine App *application.Application }
Endpoint represents an endpoint, a single application running on a single machine.
type EndpointObservation ¶
type EndpointObservation struct { // The observation number that increases by 1 each time SeqNo uint64 // The name of each appliation and the port it is running on. Endpoints namesandports.NamesAndPorts }
EndpointObservation represents an observation of applications and ports running on a certain machine.
type EndpointObservations ¶
type EndpointObservations struct {
// contains filtered or unexported fields
}
EndpointObservations stores endpoint observations for all machines. EndpointObservations is safe to use with multiple goroutines.
func NewEndpointObservations ¶
func NewEndpointObservations() *EndpointObservations
NewEndpointObservations returns an empty EndpointObservations
func (*EndpointObservations) GetAll ¶
func (e *EndpointObservations) GetAll() map[string]EndpointObservation
GetAll returns a snapshot of all the endpoint observations.
func (*EndpointObservations) MaybeAddApp ¶
func (e *EndpointObservations) MaybeAddApp(hostName, appName string, port uint)
MaybeAddApp atomically adds an application for hostName if its port isn't there already without incrementing the sequence number. If nothing has been previously stored for hostName, MaybeAddApp adds appName and sets the sequence number to 1. IsTLS for added app is false for now.
func (*EndpointObservations) Save ¶
func (e *EndpointObservations) Save( hostName string, namesAndPorts namesandports.NamesAndPorts)
Save saves namesAndPorts for hostName and increments the sequence number by 1.
type EndpointStore ¶
type EndpointStore struct {
// contains filtered or unexported fields
}
EndpointStore stores all the endpoints for scotty along with a store that stores the metrics for each endpoint.
func NewEndpointStore ¶
func NewEndpointStore( astore *store.Store, config awsinfo.Config, countToInactivate int) *EndpointStore
NewEndpointStore returns a new EndpointStore. astore is a prototype of the store object for storing metrics. The caller should not hold onto the astore reference after passing it to NewEndpointStore. config contains information for understanding AWS information. countToInactive is how many times an application must be reported as missing before it is marked inactive.
func (*EndpointStore) AllActiveWithStore ¶
func (e *EndpointStore) AllActiveWithStore() ([]*Endpoint, *store.Store)
AllActiveWithStore returns all active endpoints along with the metric store
func (*EndpointStore) AllWithStore ¶
func (e *EndpointStore) AllWithStore() ( result []*Endpoint, astore *store.Store)
AllWithStore returns all endpoints along with the metric store
func (*EndpointStore) ByHostAndName ¶
func (e *EndpointStore) ByHostAndName(host, name string) ( *Endpoint, *store.Store)
ByHostAndName returns the endpoint for given host name and application name along with the current metric store. If the host name application name combination doesn't exist, ByHostAndName returns nil for the endpoint.
func (*EndpointStore) LogChangedMetricCount ¶
func (e *EndpointStore) LogChangedMetricCount( ep *scotty.Endpoint, metricCount uint)
LogChangedMetricCount logs the number of changed metrics for given / endpoint.
func (*EndpointStore) ReportError ¶
ReportError reports an error for given endpoint.
func (*EndpointStore) Store ¶
func (e *EndpointStore) Store() *store.Store
Store returns the current metric store
func (*EndpointStore) UpdateEndpoints ¶
func (e *EndpointStore) UpdateEndpoints( timestamp float64, endpoints map[string]EndpointObservation)
UpdateEndpints tells this instance of all the applications running on al the hosts. endpoints are all the applications running keyed by hostname. If the sequence number for a given host hasn't changed since the last call to UpdateEndpoints, then UpdateEndpoints() becomes a no-op for that hostname.
func (*EndpointStore) UpdateMachines ¶
func (e *EndpointStore) UpdateMachines( timestamp float64, activeHosts []mdb.Machine)
UpdateMachines updates the available machines.
func (*EndpointStore) UpdateState ¶
func (e *EndpointStore) UpdateState( ep *scotty.Endpoint, newState *scotty.State)
UpdateState updates the state of the given endpoint.
type Machine ¶
type Machine struct { // The host name of the machine Host string // The region of the machine Region string // The IP address of the machine IpAddress string // Whether or not machine is active Active bool // Aws information for machine. nil if no aws information available. Aws *awsinfo.AwsInfo }
Machine represents a single machine
func (*Machine) AccountId ¶
AccountId is a convenience routine that returns the aws account id. If no aws information, returns the empty string.
func (*Machine) CloudHealth ¶
CloudHealth is a convenience routine that returns true if scotty should write cloud health data for machine.
func (*Machine) CloudWatchStr ¶
CloudWatchStr is a convenience routine that returns how often scotty should write to cloud watch for the machine as a string (e.g "5m"). Returns the empty string if no aws information is available or if no data should be written to cloud watch.
func (*Machine) InstanceId ¶
AccountId is a convenience routine that returns the aws instance id. If no aws information, returns the empty string.