rename ScrapeManager struct to Manager to remove stutter

This commit is contained in:
Krasi Georgiev 2018-02-01 10:06:24 +00:00
parent b75428ec19
commit 6ce84dbcb1
2 changed files with 13 additions and 13 deletions

View file

@ -31,10 +31,10 @@ type Appendable interface {
Appender() (storage.Appender, error) Appender() (storage.Appender, error)
} }
// NewManager is the ScrapeManager constructor // NewManager is the Manager constructor
func NewManager(logger log.Logger, app Appendable) *ScrapeManager { func NewManager(logger log.Logger, app Appendable) *Manager {
return &ScrapeManager{ return &Manager{
append: app, append: app,
logger: logger, logger: logger,
scrapeConfigs: make(map[string]*config.ScrapeConfig), scrapeConfigs: make(map[string]*config.ScrapeConfig),
@ -43,9 +43,9 @@ func NewManager(logger log.Logger, app Appendable) *ScrapeManager {
} }
} }
// ScrapeManager maintains a set of scrape pools and manages start/stop cycles // Manager maintains a set of scrape pools and manages start/stop cycles
// when receiving new target groups form the discovery manager. // when receiving new target groups form the discovery manager.
type ScrapeManager struct { type Manager struct {
logger log.Logger logger log.Logger
append Appendable append Appendable
scrapeConfigs map[string]*config.ScrapeConfig scrapeConfigs map[string]*config.ScrapeConfig
@ -55,7 +55,7 @@ type ScrapeManager struct {
} }
// Run starts background processing to handle target updates and reload the scraping loops. // Run starts background processing to handle target updates and reload the scraping loops.
func (m *ScrapeManager) Run(tsets <-chan map[string][]*targetgroup.Group) error { func (m *Manager) Run(tsets <-chan map[string][]*targetgroup.Group) error {
for { for {
select { select {
case ts := <-tsets: case ts := <-tsets:
@ -67,7 +67,7 @@ func (m *ScrapeManager) Run(tsets <-chan map[string][]*targetgroup.Group) error
} }
// Stop cancels all running scrape pools and blocks until all have exited. // Stop cancels all running scrape pools and blocks until all have exited.
func (m *ScrapeManager) Stop() { func (m *Manager) Stop() {
for _, sp := range m.scrapePools { for _, sp := range m.scrapePools {
sp.stop() sp.stop()
} }
@ -75,7 +75,7 @@ func (m *ScrapeManager) Stop() {
} }
// ApplyConfig resets the manager's target providers and job configurations as defined by the new cfg. // ApplyConfig resets the manager's target providers and job configurations as defined by the new cfg.
func (m *ScrapeManager) ApplyConfig(cfg *config.Config) error { func (m *Manager) ApplyConfig(cfg *config.Config) error {
m.mtx.Lock() m.mtx.Lock()
defer m.mtx.Unlock() defer m.mtx.Unlock()
c := make(map[string]*config.ScrapeConfig) c := make(map[string]*config.ScrapeConfig)
@ -98,7 +98,7 @@ func (m *ScrapeManager) ApplyConfig(cfg *config.Config) error {
} }
// TargetMap returns map of active and dropped targets and their corresponding scrape config job name. // TargetMap returns map of active and dropped targets and their corresponding scrape config job name.
func (m *ScrapeManager) TargetMap() map[string][]*Target { func (m *Manager) TargetMap() map[string][]*Target {
m.mtx.Lock() m.mtx.Lock()
defer m.mtx.Unlock() defer m.mtx.Unlock()
@ -116,7 +116,7 @@ func (m *ScrapeManager) TargetMap() map[string][]*Target {
} }
// Targets returns the targets currently being scraped. // Targets returns the targets currently being scraped.
func (m *ScrapeManager) Targets() []*Target { func (m *Manager) Targets() []*Target {
m.mtx.Lock() m.mtx.Lock()
defer m.mtx.Unlock() defer m.mtx.Unlock()
@ -132,7 +132,7 @@ func (m *ScrapeManager) Targets() []*Target {
return targets return targets
} }
func (m *ScrapeManager) reload(t map[string][]*targetgroup.Group) { func (m *Manager) reload(t map[string][]*targetgroup.Group) {
for tsetName, tgroup := range t { for tsetName, tgroup := range t {
scrapeConfig, ok := m.scrapeConfigs[tsetName] scrapeConfig, ok := m.scrapeConfigs[tsetName]
if !ok { if !ok {

View file

@ -71,7 +71,7 @@ var localhostRepresentations = []string{"127.0.0.1", "localhost"}
type Handler struct { type Handler struct {
logger log.Logger logger log.Logger
scrapeManager *scrape.ScrapeManager scrapeManager *scrape.Manager
ruleManager *rules.Manager ruleManager *rules.Manager
queryEngine *promql.Engine queryEngine *promql.Engine
context context.Context context context.Context
@ -125,7 +125,7 @@ type Options struct {
TSDB func() *tsdb.DB TSDB func() *tsdb.DB
Storage storage.Storage Storage storage.Storage
QueryEngine *promql.Engine QueryEngine *promql.Engine
ScrapeManager *scrape.ScrapeManager ScrapeManager *scrape.Manager
RuleManager *rules.Manager RuleManager *rules.Manager
Notifier *notifier.Manager Notifier *notifier.Manager
Version *PrometheusVersion Version *PrometheusVersion