Пример #1
0
func (m *targetManager) targetPoolForJob(job config.JobConfig) *TargetPool {
	targetPool, ok := m.poolsByJob[job.GetName()]

	if !ok {
		var provider TargetProvider
		if job.SdName != nil {
			provider = NewSdTargetProvider(job)
		}

		interval := job.ScrapeInterval()
		targetPool = NewTargetPool(m, provider, m.ingester, interval)
		glog.Infof("Pool for job %s does not exist; creating and starting...", job.GetName())

		m.poolsByJob[job.GetName()] = targetPool
		go targetPool.Run()
	}

	return targetPool
}
Пример #2
0
func (m *targetManager) TargetPoolForJob(job config.JobConfig) *TargetPool {
	targetPool, ok := m.poolsByJob[job.GetName()]

	if !ok {
		var provider TargetProvider = nil
		if job.SdName != nil {
			provider = NewSdTargetProvider(job)
		}

		targetPool = NewTargetPool(m, provider)
		glog.Infof("Pool for job %s does not exist; creating and starting...", job.GetName())

		interval := job.ScrapeInterval()
		m.poolsByJob[job.GetName()] = targetPool
		// BUG(all): Investigate whether this auto-goroutine creation is desired.
		go targetPool.Run(m.ingester, interval)
	}

	return targetPool
}