From 1fe3d3b06bffb60068449ca350e93484f1a16ca4 Mon Sep 17 00:00:00 2001 From: Julius Volz Date: Tue, 11 Jun 2013 17:54:58 +0200 Subject: [PATCH] Remove obsolete argument from target handling code. --- retrieval/targetmanager.go | 16 ++++++++-------- retrieval/targetmanager_test.go | 6 +++--- web/api/targets.go | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/retrieval/targetmanager.go b/retrieval/targetmanager.go index 8ccb40d78..f2979c6a7 100644 --- a/retrieval/targetmanager.go +++ b/retrieval/targetmanager.go @@ -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) } } } diff --git a/retrieval/targetmanager_test.go b/retrieval/targetmanager_test.go index 0437ef30d..59845e830 100644 --- a/retrieval/targetmanager_test.go +++ b/retrieval/targetmanager_test.go @@ -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) { diff --git a/web/api/targets.go b/web/api/targets.go index f83a76caf..7e4df43be 100644 --- a/web/api/targets.go +++ b/web/api/targets.go @@ -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) }