Documentation ¶
Overview ¶
Package Watcher is responsible for watching latest metrics from metrics provider via a fetcher client. It exposes an HTTP REST endpoint to get these metrics, in addition to application API via clients This also uses a fast json parser
Index ¶
Constants ¶
View Source
const ( BaseUrl = "/watcher" HealthCheckUrl = "/healthy" MertricUrl = "/metric" JobUrl = "/job" ScheduleUrl = "/schedule" )
View Source
const ( FirstNode = "worker-1" SecondNode = "worker-2" TestServerClientName = "TestServerClient" )
Variables ¶
View Source
var FifteenMinutesMetricsMap = map[string][]metricstype.Metric{ FirstNode: { { Name: "test-cpu", Type: metricstype.CPU, Value: 26, }, }, SecondNode: { { Name: "test-cpu", Type: metricstype.CPU, Value: 60, }, }, }
View Source
var FiveMinutesMetricsMap = map[string][]metricstype.Metric{ FirstNode: { { Name: "test-cpu", Type: metricstype.CPU, Value: 21, }, }, SecondNode: { { Name: "test-cpu", Type: metricstype.CPU, Value: 50, }, }, }
View Source
var TenMinutesMetricsMap = map[string][]metricstype.Metric{ FirstNode: { { Name: "test-cpu", Type: metricstype.CPU, Value: 22, }, }, SecondNode: { { Name: "test-cpu", Type: metricstype.CPU, Value: 65, }, }, }
Functions ¶
func NewTestMetricsServerClient ¶
func NewTestMetricsServerClient() metricsprovider.MetricsProviderClient
Types ¶
type JobRequest ¶
type Watcher ¶
type Watcher struct {
// contains filtered or unexported fields
}
func NewWatcher ¶
func NewWatcher(client metricsprovider.MetricsProviderClient) *Watcher
NewWatcher Returns a new initialised Watcher
func (*Watcher) GetLatestWatcherMetrics ¶
func (w *Watcher) GetLatestWatcherMetrics(duration string) (*metricstype.WatcherMetrics, error)
GetLatestWatcherMetrics It starts from 15 minute window, and falls back to 10 min, 5 min windows subsequently if metrics are not present. StartWatching() should be called before calling this.
func (*Watcher) StartWatching ¶
func (w *Watcher) StartWatching(shutdown chan struct{})
StartWatching This function needs to be called to begin actual watching
Click to show internal directories.
Click to hide internal directories.