mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-25 13:44:05 -08:00
Remove obsolete argument from target handling code.
This commit is contained in:
parent
a88a71c6db
commit
1fe3d3b06b
|
@ -24,8 +24,8 @@ import (
|
|||
type TargetManager interface {
|
||||
acquire()
|
||||
release()
|
||||
AddTarget(job config.JobConfig, t Target, defaultScrapeInterval time.Duration)
|
||||
ReplaceTargets(job config.JobConfig, newTargets []Target, defaultScrapeInterval time.Duration)
|
||||
AddTarget(job config.JobConfig, t Target)
|
||||
ReplaceTargets(job config.JobConfig, newTargets []Target)
|
||||
Remove(t Target)
|
||||
AddTargetsFromConfig(config config.Config)
|
||||
Pools() map[string]*TargetPool
|
||||
|
@ -53,7 +53,7 @@ func (m *targetManager) release() {
|
|||
<-m.requestAllowance
|
||||
}
|
||||
|
||||
func (m *targetManager) TargetPoolForJob(job config.JobConfig, defaultScrapeInterval time.Duration) *TargetPool {
|
||||
func (m *targetManager) TargetPoolForJob(job config.JobConfig) *TargetPool {
|
||||
targetPool, ok := m.poolsByJob[job.GetName()]
|
||||
|
||||
if !ok {
|
||||
|
@ -69,14 +69,14 @@ func (m *targetManager) TargetPoolForJob(job config.JobConfig, defaultScrapeInte
|
|||
return targetPool
|
||||
}
|
||||
|
||||
func (m *targetManager) AddTarget(job config.JobConfig, t Target, defaultScrapeInterval time.Duration) {
|
||||
targetPool := m.TargetPoolForJob(job, defaultScrapeInterval)
|
||||
func (m *targetManager) AddTarget(job config.JobConfig, t Target) {
|
||||
targetPool := m.TargetPoolForJob(job)
|
||||
targetPool.AddTarget(t)
|
||||
m.poolsByJob[job.GetName()] = targetPool
|
||||
}
|
||||
|
||||
func (m *targetManager) ReplaceTargets(job config.JobConfig, newTargets []Target, defaultScrapeInterval time.Duration) {
|
||||
targetPool := m.TargetPoolForJob(job, defaultScrapeInterval)
|
||||
func (m *targetManager) ReplaceTargets(job config.JobConfig, newTargets []Target) {
|
||||
targetPool := m.TargetPoolForJob(job)
|
||||
targetPool.replaceTargets(newTargets)
|
||||
}
|
||||
|
||||
|
@ -98,7 +98,7 @@ func (m *targetManager) AddTargetsFromConfig(config config.Config) {
|
|||
|
||||
for _, endpoint := range targetGroup.Target {
|
||||
target := NewTarget(endpoint, time.Second*5, baseLabels)
|
||||
m.AddTarget(job, target, config.ScrapeInterval())
|
||||
m.AddTarget(job, target)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -95,15 +95,15 @@ func testTargetManager(t test.Tester) {
|
|||
interval: time.Minute,
|
||||
}
|
||||
|
||||
targetManager.AddTarget(testJob1, target1GroupA, 0)
|
||||
targetManager.AddTarget(testJob1, target2GroupA, 0)
|
||||
targetManager.AddTarget(testJob1, target1GroupA)
|
||||
targetManager.AddTarget(testJob1, target2GroupA)
|
||||
|
||||
target1GroupB := &fakeTarget{
|
||||
schedules: []time.Time{time.Now()},
|
||||
interval: time.Minute * 2,
|
||||
}
|
||||
|
||||
targetManager.AddTarget(testJob2, target1GroupB, 0)
|
||||
targetManager.AddTarget(testJob2, target1GroupB)
|
||||
}
|
||||
|
||||
func TestTargetManager(t *testing.T) {
|
||||
|
|
|
@ -52,5 +52,5 @@ func (serv MetricsService) SetTargets(targetGroups []TargetGroup, jobName string
|
|||
|
||||
// BUG(julius): Validate that this ScrapeInterval is in fact the proper one
|
||||
// for the job.
|
||||
serv.TargetManager.ReplaceTargets(*job, newTargets, serv.Config.ScrapeInterval())
|
||||
serv.TargetManager.ReplaceTargets(*job, newTargets)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue