From 994eab534be621a988946c13939f5aceafe19595 Mon Sep 17 00:00:00 2001 From: qibobo Date: Tue, 17 Dec 2019 14:15:25 +0800 Subject: [PATCH] upgrade prometheus client_golang to v1.2.1 --- .gitmodules | 3 + src/autoscaler/healthendpoint/registrar.go | 7 +- .../metricscollector/fakes/fake_policy_db.go | 437 ------------------ .../operator/fakes/fake_policy_db.go | 437 ------------------ src/github.com/cespare/xxhash | 1 + src/github.com/prometheus/client_golang | 2 +- src/github.com/prometheus/client_model | 2 +- src/github.com/prometheus/common | 2 +- src/github.com/prometheus/procfs | 2 +- 9 files changed, 14 insertions(+), 879 deletions(-) delete mode 100644 src/autoscaler/metricscollector/fakes/fake_policy_db.go delete mode 100644 src/autoscaler/operator/fakes/fake_policy_db.go create mode 160000 src/github.com/cespare/xxhash diff --git a/.gitmodules b/.gitmodules index 8f76e67d6..55eaf627b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -148,3 +148,6 @@ [submodule "src/github.com/juju/ratelimit"] path = src/github.com/juju/ratelimit url = https://github.com/juju/ratelimit +[submodule "src/github.com/cespare/xxhash"] + path = src/github.com/cespare/xxhash + url = https://github.com/cespare/xxhash.git diff --git a/src/autoscaler/healthendpoint/registrar.go b/src/autoscaler/healthendpoint/registrar.go index 905af190b..04ed3ed69 100644 --- a/src/autoscaler/healthendpoint/registrar.go +++ b/src/autoscaler/healthendpoint/registrar.go @@ -10,7 +10,12 @@ import ( func RegisterCollectors(registrar prometheus.Registerer, collectors []prometheus.Collector, includeDefault bool, logger lager.Logger) { if includeDefault { - err := registrar.Register(prometheus.NewProcessCollector(os.Getpid(), "")) + err := registrar.Register(prometheus.NewProcessCollector(prometheus.ProcessCollectorOpts{ + PidFn: func() (int, error) { + return os.Getpid(), nil + }, + Namespace: "", + })) if err != nil { logger.Error("Failed to register process collector", err) } diff --git a/src/autoscaler/metricscollector/fakes/fake_policy_db.go b/src/autoscaler/metricscollector/fakes/fake_policy_db.go deleted file mode 100644 index 88a0f4769..000000000 --- a/src/autoscaler/metricscollector/fakes/fake_policy_db.go +++ /dev/null @@ -1,437 +0,0 @@ -// Code generated by counterfeiter. DO NOT EDIT. -package fakes - -import ( - "autoscaler/db" - "autoscaler/healthendpoint" - "autoscaler/models" - "sync" - "time" - - "code.cloudfoundry.org/clock" -) - -type FakePolicyDB struct { - GetAppIdsStub func() (map[string]bool, error) - getAppIdsMutex sync.RWMutex - getAppIdsArgsForCall []struct{} - getAppIdsReturns struct { - result1 map[string]bool - result2 error - } - getAppIdsReturnsOnCall map[int]struct { - result1 map[string]bool - result2 error - } - GetAppPolicyStub func(appId string) (*models.ScalingPolicy, error) - getAppPolicyMutex sync.RWMutex - getAppPolicyArgsForCall []struct { - appId string - } - getAppPolicyReturns struct { - result1 *models.ScalingPolicy - result2 error - } - getAppPolicyReturnsOnCall map[int]struct { - result1 *models.ScalingPolicy - result2 error - } - RetrievePoliciesStub func() ([]*models.PolicyJson, error) - retrievePoliciesMutex sync.RWMutex - retrievePoliciesArgsForCall []struct{} - retrievePoliciesReturns struct { - result1 []*models.PolicyJson - result2 error - } - retrievePoliciesReturnsOnCall map[int]struct { - result1 []*models.PolicyJson - result2 error - } - CloseStub func() error - closeMutex sync.RWMutex - closeArgsForCall []struct{} - closeReturns struct { - result1 error - } - closeReturnsOnCall map[int]struct { - result1 error - } - EmitHealthMetricsStub func(h healthendpoint.Health, cclock clock.Clock, interval time.Duration) - emitHealthMetricsMutex sync.RWMutex - emitHealthMetricsArgsForCall []struct { - h healthendpoint.Health - cclock clock.Clock - interval time.Duration - } - DeletePolicyStub func(appId string) error - deletePolicyMutex sync.RWMutex - deletePolicyArgsForCall []struct { - appId string - } - deletePolicyReturns struct { - result1 error - } - deletePolicyReturnsOnCall map[int]struct { - result1 error - } - GetCustomMetricsCredsStub func(appId string) (string, string, error) - getCustomMetricsCredsMutex sync.RWMutex - getCustomMetricsCredsArgsForCall []struct { - appId string - } - getCustomMetricsCredsReturns struct { - result1 string - result2 string - result3 error - } - getCustomMetricsCredsReturnsOnCall map[int]struct { - result1 string - result2 string - result3 error - } - invocations map[string][][]interface{} - invocationsMutex sync.RWMutex -} - -func (fake *FakePolicyDB) GetAppIds() (map[string]bool, error) { - fake.getAppIdsMutex.Lock() - ret, specificReturn := fake.getAppIdsReturnsOnCall[len(fake.getAppIdsArgsForCall)] - fake.getAppIdsArgsForCall = append(fake.getAppIdsArgsForCall, struct{}{}) - fake.recordInvocation("GetAppIds", []interface{}{}) - fake.getAppIdsMutex.Unlock() - if fake.GetAppIdsStub != nil { - return fake.GetAppIdsStub() - } - if specificReturn { - return ret.result1, ret.result2 - } - return fake.getAppIdsReturns.result1, fake.getAppIdsReturns.result2 -} - -func (fake *FakePolicyDB) GetAppIdsCallCount() int { - fake.getAppIdsMutex.RLock() - defer fake.getAppIdsMutex.RUnlock() - return len(fake.getAppIdsArgsForCall) -} - -func (fake *FakePolicyDB) GetAppIdsReturns(result1 map[string]bool, result2 error) { - fake.GetAppIdsStub = nil - fake.getAppIdsReturns = struct { - result1 map[string]bool - result2 error - }{result1, result2} -} - -func (fake *FakePolicyDB) GetAppIdsReturnsOnCall(i int, result1 map[string]bool, result2 error) { - fake.GetAppIdsStub = nil - if fake.getAppIdsReturnsOnCall == nil { - fake.getAppIdsReturnsOnCall = make(map[int]struct { - result1 map[string]bool - result2 error - }) - } - fake.getAppIdsReturnsOnCall[i] = struct { - result1 map[string]bool - result2 error - }{result1, result2} -} - -func (fake *FakePolicyDB) GetAppPolicy(appId string) (*models.ScalingPolicy, error) { - fake.getAppPolicyMutex.Lock() - ret, specificReturn := fake.getAppPolicyReturnsOnCall[len(fake.getAppPolicyArgsForCall)] - fake.getAppPolicyArgsForCall = append(fake.getAppPolicyArgsForCall, struct { - appId string - }{appId}) - fake.recordInvocation("GetAppPolicy", []interface{}{appId}) - fake.getAppPolicyMutex.Unlock() - if fake.GetAppPolicyStub != nil { - return fake.GetAppPolicyStub(appId) - } - if specificReturn { - return ret.result1, ret.result2 - } - return fake.getAppPolicyReturns.result1, fake.getAppPolicyReturns.result2 -} - -func (fake *FakePolicyDB) GetAppPolicyCallCount() int { - fake.getAppPolicyMutex.RLock() - defer fake.getAppPolicyMutex.RUnlock() - return len(fake.getAppPolicyArgsForCall) -} - -func (fake *FakePolicyDB) GetAppPolicyArgsForCall(i int) string { - fake.getAppPolicyMutex.RLock() - defer fake.getAppPolicyMutex.RUnlock() - return fake.getAppPolicyArgsForCall[i].appId -} - -func (fake *FakePolicyDB) GetAppPolicyReturns(result1 *models.ScalingPolicy, result2 error) { - fake.GetAppPolicyStub = nil - fake.getAppPolicyReturns = struct { - result1 *models.ScalingPolicy - result2 error - }{result1, result2} -} - -func (fake *FakePolicyDB) GetAppPolicyReturnsOnCall(i int, result1 *models.ScalingPolicy, result2 error) { - fake.GetAppPolicyStub = nil - if fake.getAppPolicyReturnsOnCall == nil { - fake.getAppPolicyReturnsOnCall = make(map[int]struct { - result1 *models.ScalingPolicy - result2 error - }) - } - fake.getAppPolicyReturnsOnCall[i] = struct { - result1 *models.ScalingPolicy - result2 error - }{result1, result2} -} - -func (fake *FakePolicyDB) RetrievePolicies() ([]*models.PolicyJson, error) { - fake.retrievePoliciesMutex.Lock() - ret, specificReturn := fake.retrievePoliciesReturnsOnCall[len(fake.retrievePoliciesArgsForCall)] - fake.retrievePoliciesArgsForCall = append(fake.retrievePoliciesArgsForCall, struct{}{}) - fake.recordInvocation("RetrievePolicies", []interface{}{}) - fake.retrievePoliciesMutex.Unlock() - if fake.RetrievePoliciesStub != nil { - return fake.RetrievePoliciesStub() - } - if specificReturn { - return ret.result1, ret.result2 - } - return fake.retrievePoliciesReturns.result1, fake.retrievePoliciesReturns.result2 -} - -func (fake *FakePolicyDB) RetrievePoliciesCallCount() int { - fake.retrievePoliciesMutex.RLock() - defer fake.retrievePoliciesMutex.RUnlock() - return len(fake.retrievePoliciesArgsForCall) -} - -func (fake *FakePolicyDB) RetrievePoliciesReturns(result1 []*models.PolicyJson, result2 error) { - fake.RetrievePoliciesStub = nil - fake.retrievePoliciesReturns = struct { - result1 []*models.PolicyJson - result2 error - }{result1, result2} -} - -func (fake *FakePolicyDB) RetrievePoliciesReturnsOnCall(i int, result1 []*models.PolicyJson, result2 error) { - fake.RetrievePoliciesStub = nil - if fake.retrievePoliciesReturnsOnCall == nil { - fake.retrievePoliciesReturnsOnCall = make(map[int]struct { - result1 []*models.PolicyJson - result2 error - }) - } - fake.retrievePoliciesReturnsOnCall[i] = struct { - result1 []*models.PolicyJson - result2 error - }{result1, result2} -} - -func (fake *FakePolicyDB) Close() error { - fake.closeMutex.Lock() - ret, specificReturn := fake.closeReturnsOnCall[len(fake.closeArgsForCall)] - fake.closeArgsForCall = append(fake.closeArgsForCall, struct{}{}) - fake.recordInvocation("Close", []interface{}{}) - fake.closeMutex.Unlock() - if fake.CloseStub != nil { - return fake.CloseStub() - } - if specificReturn { - return ret.result1 - } - return fake.closeReturns.result1 -} - -func (fake *FakePolicyDB) CloseCallCount() int { - fake.closeMutex.RLock() - defer fake.closeMutex.RUnlock() - return len(fake.closeArgsForCall) -} - -func (fake *FakePolicyDB) CloseReturns(result1 error) { - fake.CloseStub = nil - fake.closeReturns = struct { - result1 error - }{result1} -} - -func (fake *FakePolicyDB) CloseReturnsOnCall(i int, result1 error) { - fake.CloseStub = nil - if fake.closeReturnsOnCall == nil { - fake.closeReturnsOnCall = make(map[int]struct { - result1 error - }) - } - fake.closeReturnsOnCall[i] = struct { - result1 error - }{result1} -} - -func (fake *FakePolicyDB) EmitHealthMetrics(h healthendpoint.Health, cclock clock.Clock, interval time.Duration) { - fake.emitHealthMetricsMutex.Lock() - fake.emitHealthMetricsArgsForCall = append(fake.emitHealthMetricsArgsForCall, struct { - h healthendpoint.Health - cclock clock.Clock - interval time.Duration - }{h, cclock, interval}) - fake.recordInvocation("EmitHealthMetrics", []interface{}{h, cclock, interval}) - fake.emitHealthMetricsMutex.Unlock() - if fake.EmitHealthMetricsStub != nil { - fake.EmitHealthMetricsStub(h, cclock, interval) - } -} - -func (fake *FakePolicyDB) EmitHealthMetricsCallCount() int { - fake.emitHealthMetricsMutex.RLock() - defer fake.emitHealthMetricsMutex.RUnlock() - return len(fake.emitHealthMetricsArgsForCall) -} - -func (fake *FakePolicyDB) EmitHealthMetricsArgsForCall(i int) (healthendpoint.Health, clock.Clock, time.Duration) { - fake.emitHealthMetricsMutex.RLock() - defer fake.emitHealthMetricsMutex.RUnlock() - return fake.emitHealthMetricsArgsForCall[i].h, fake.emitHealthMetricsArgsForCall[i].cclock, fake.emitHealthMetricsArgsForCall[i].interval -} - -func (fake *FakePolicyDB) DeletePolicy(appId string) error { - fake.deletePolicyMutex.Lock() - ret, specificReturn := fake.deletePolicyReturnsOnCall[len(fake.deletePolicyArgsForCall)] - fake.deletePolicyArgsForCall = append(fake.deletePolicyArgsForCall, struct { - appId string - }{appId}) - fake.recordInvocation("DeletePolicy", []interface{}{appId}) - fake.deletePolicyMutex.Unlock() - if fake.DeletePolicyStub != nil { - return fake.DeletePolicyStub(appId) - } - if specificReturn { - return ret.result1 - } - return fake.deletePolicyReturns.result1 -} - -func (fake *FakePolicyDB) DeletePolicyCallCount() int { - fake.deletePolicyMutex.RLock() - defer fake.deletePolicyMutex.RUnlock() - return len(fake.deletePolicyArgsForCall) -} - -func (fake *FakePolicyDB) DeletePolicyArgsForCall(i int) string { - fake.deletePolicyMutex.RLock() - defer fake.deletePolicyMutex.RUnlock() - return fake.deletePolicyArgsForCall[i].appId -} - -func (fake *FakePolicyDB) DeletePolicyReturns(result1 error) { - fake.DeletePolicyStub = nil - fake.deletePolicyReturns = struct { - result1 error - }{result1} -} - -func (fake *FakePolicyDB) DeletePolicyReturnsOnCall(i int, result1 error) { - fake.DeletePolicyStub = nil - if fake.deletePolicyReturnsOnCall == nil { - fake.deletePolicyReturnsOnCall = make(map[int]struct { - result1 error - }) - } - fake.deletePolicyReturnsOnCall[i] = struct { - result1 error - }{result1} -} - -func (fake *FakePolicyDB) GetCustomMetricsCreds(appId string) (string, string, error) { - fake.getCustomMetricsCredsMutex.Lock() - ret, specificReturn := fake.getCustomMetricsCredsReturnsOnCall[len(fake.getCustomMetricsCredsArgsForCall)] - fake.getCustomMetricsCredsArgsForCall = append(fake.getCustomMetricsCredsArgsForCall, struct { - appId string - }{appId}) - fake.recordInvocation("GetCustomMetricsCreds", []interface{}{appId}) - fake.getCustomMetricsCredsMutex.Unlock() - if fake.GetCustomMetricsCredsStub != nil { - return fake.GetCustomMetricsCredsStub(appId) - } - if specificReturn { - return ret.result1, ret.result2, ret.result3 - } - return fake.getCustomMetricsCredsReturns.result1, fake.getCustomMetricsCredsReturns.result2, fake.getCustomMetricsCredsReturns.result3 -} - -func (fake *FakePolicyDB) GetCustomMetricsCredsCallCount() int { - fake.getCustomMetricsCredsMutex.RLock() - defer fake.getCustomMetricsCredsMutex.RUnlock() - return len(fake.getCustomMetricsCredsArgsForCall) -} - -func (fake *FakePolicyDB) GetCustomMetricsCredsArgsForCall(i int) string { - fake.getCustomMetricsCredsMutex.RLock() - defer fake.getCustomMetricsCredsMutex.RUnlock() - return fake.getCustomMetricsCredsArgsForCall[i].appId -} - -func (fake *FakePolicyDB) GetCustomMetricsCredsReturns(result1 string, result2 string, result3 error) { - fake.GetCustomMetricsCredsStub = nil - fake.getCustomMetricsCredsReturns = struct { - result1 string - result2 string - result3 error - }{result1, result2, result3} -} - -func (fake *FakePolicyDB) GetCustomMetricsCredsReturnsOnCall(i int, result1 string, result2 string, result3 error) { - fake.GetCustomMetricsCredsStub = nil - if fake.getCustomMetricsCredsReturnsOnCall == nil { - fake.getCustomMetricsCredsReturnsOnCall = make(map[int]struct { - result1 string - result2 string - result3 error - }) - } - fake.getCustomMetricsCredsReturnsOnCall[i] = struct { - result1 string - result2 string - result3 error - }{result1, result2, result3} -} - -func (fake *FakePolicyDB) Invocations() map[string][][]interface{} { - fake.invocationsMutex.RLock() - defer fake.invocationsMutex.RUnlock() - fake.getAppIdsMutex.RLock() - defer fake.getAppIdsMutex.RUnlock() - fake.getAppPolicyMutex.RLock() - defer fake.getAppPolicyMutex.RUnlock() - fake.retrievePoliciesMutex.RLock() - defer fake.retrievePoliciesMutex.RUnlock() - fake.closeMutex.RLock() - defer fake.closeMutex.RUnlock() - fake.emitHealthMetricsMutex.RLock() - defer fake.emitHealthMetricsMutex.RUnlock() - fake.deletePolicyMutex.RLock() - defer fake.deletePolicyMutex.RUnlock() - fake.getCustomMetricsCredsMutex.RLock() - defer fake.getCustomMetricsCredsMutex.RUnlock() - copiedInvocations := map[string][][]interface{}{} - for key, value := range fake.invocations { - copiedInvocations[key] = value - } - return copiedInvocations -} - -func (fake *FakePolicyDB) recordInvocation(key string, args []interface{}) { - fake.invocationsMutex.Lock() - defer fake.invocationsMutex.Unlock() - if fake.invocations == nil { - fake.invocations = map[string][][]interface{}{} - } - if fake.invocations[key] == nil { - fake.invocations[key] = [][]interface{}{} - } - fake.invocations[key] = append(fake.invocations[key], args) -} - -var _ db.PolicyDB = new(FakePolicyDB) diff --git a/src/autoscaler/operator/fakes/fake_policy_db.go b/src/autoscaler/operator/fakes/fake_policy_db.go deleted file mode 100644 index 88a0f4769..000000000 --- a/src/autoscaler/operator/fakes/fake_policy_db.go +++ /dev/null @@ -1,437 +0,0 @@ -// Code generated by counterfeiter. DO NOT EDIT. -package fakes - -import ( - "autoscaler/db" - "autoscaler/healthendpoint" - "autoscaler/models" - "sync" - "time" - - "code.cloudfoundry.org/clock" -) - -type FakePolicyDB struct { - GetAppIdsStub func() (map[string]bool, error) - getAppIdsMutex sync.RWMutex - getAppIdsArgsForCall []struct{} - getAppIdsReturns struct { - result1 map[string]bool - result2 error - } - getAppIdsReturnsOnCall map[int]struct { - result1 map[string]bool - result2 error - } - GetAppPolicyStub func(appId string) (*models.ScalingPolicy, error) - getAppPolicyMutex sync.RWMutex - getAppPolicyArgsForCall []struct { - appId string - } - getAppPolicyReturns struct { - result1 *models.ScalingPolicy - result2 error - } - getAppPolicyReturnsOnCall map[int]struct { - result1 *models.ScalingPolicy - result2 error - } - RetrievePoliciesStub func() ([]*models.PolicyJson, error) - retrievePoliciesMutex sync.RWMutex - retrievePoliciesArgsForCall []struct{} - retrievePoliciesReturns struct { - result1 []*models.PolicyJson - result2 error - } - retrievePoliciesReturnsOnCall map[int]struct { - result1 []*models.PolicyJson - result2 error - } - CloseStub func() error - closeMutex sync.RWMutex - closeArgsForCall []struct{} - closeReturns struct { - result1 error - } - closeReturnsOnCall map[int]struct { - result1 error - } - EmitHealthMetricsStub func(h healthendpoint.Health, cclock clock.Clock, interval time.Duration) - emitHealthMetricsMutex sync.RWMutex - emitHealthMetricsArgsForCall []struct { - h healthendpoint.Health - cclock clock.Clock - interval time.Duration - } - DeletePolicyStub func(appId string) error - deletePolicyMutex sync.RWMutex - deletePolicyArgsForCall []struct { - appId string - } - deletePolicyReturns struct { - result1 error - } - deletePolicyReturnsOnCall map[int]struct { - result1 error - } - GetCustomMetricsCredsStub func(appId string) (string, string, error) - getCustomMetricsCredsMutex sync.RWMutex - getCustomMetricsCredsArgsForCall []struct { - appId string - } - getCustomMetricsCredsReturns struct { - result1 string - result2 string - result3 error - } - getCustomMetricsCredsReturnsOnCall map[int]struct { - result1 string - result2 string - result3 error - } - invocations map[string][][]interface{} - invocationsMutex sync.RWMutex -} - -func (fake *FakePolicyDB) GetAppIds() (map[string]bool, error) { - fake.getAppIdsMutex.Lock() - ret, specificReturn := fake.getAppIdsReturnsOnCall[len(fake.getAppIdsArgsForCall)] - fake.getAppIdsArgsForCall = append(fake.getAppIdsArgsForCall, struct{}{}) - fake.recordInvocation("GetAppIds", []interface{}{}) - fake.getAppIdsMutex.Unlock() - if fake.GetAppIdsStub != nil { - return fake.GetAppIdsStub() - } - if specificReturn { - return ret.result1, ret.result2 - } - return fake.getAppIdsReturns.result1, fake.getAppIdsReturns.result2 -} - -func (fake *FakePolicyDB) GetAppIdsCallCount() int { - fake.getAppIdsMutex.RLock() - defer fake.getAppIdsMutex.RUnlock() - return len(fake.getAppIdsArgsForCall) -} - -func (fake *FakePolicyDB) GetAppIdsReturns(result1 map[string]bool, result2 error) { - fake.GetAppIdsStub = nil - fake.getAppIdsReturns = struct { - result1 map[string]bool - result2 error - }{result1, result2} -} - -func (fake *FakePolicyDB) GetAppIdsReturnsOnCall(i int, result1 map[string]bool, result2 error) { - fake.GetAppIdsStub = nil - if fake.getAppIdsReturnsOnCall == nil { - fake.getAppIdsReturnsOnCall = make(map[int]struct { - result1 map[string]bool - result2 error - }) - } - fake.getAppIdsReturnsOnCall[i] = struct { - result1 map[string]bool - result2 error - }{result1, result2} -} - -func (fake *FakePolicyDB) GetAppPolicy(appId string) (*models.ScalingPolicy, error) { - fake.getAppPolicyMutex.Lock() - ret, specificReturn := fake.getAppPolicyReturnsOnCall[len(fake.getAppPolicyArgsForCall)] - fake.getAppPolicyArgsForCall = append(fake.getAppPolicyArgsForCall, struct { - appId string - }{appId}) - fake.recordInvocation("GetAppPolicy", []interface{}{appId}) - fake.getAppPolicyMutex.Unlock() - if fake.GetAppPolicyStub != nil { - return fake.GetAppPolicyStub(appId) - } - if specificReturn { - return ret.result1, ret.result2 - } - return fake.getAppPolicyReturns.result1, fake.getAppPolicyReturns.result2 -} - -func (fake *FakePolicyDB) GetAppPolicyCallCount() int { - fake.getAppPolicyMutex.RLock() - defer fake.getAppPolicyMutex.RUnlock() - return len(fake.getAppPolicyArgsForCall) -} - -func (fake *FakePolicyDB) GetAppPolicyArgsForCall(i int) string { - fake.getAppPolicyMutex.RLock() - defer fake.getAppPolicyMutex.RUnlock() - return fake.getAppPolicyArgsForCall[i].appId -} - -func (fake *FakePolicyDB) GetAppPolicyReturns(result1 *models.ScalingPolicy, result2 error) { - fake.GetAppPolicyStub = nil - fake.getAppPolicyReturns = struct { - result1 *models.ScalingPolicy - result2 error - }{result1, result2} -} - -func (fake *FakePolicyDB) GetAppPolicyReturnsOnCall(i int, result1 *models.ScalingPolicy, result2 error) { - fake.GetAppPolicyStub = nil - if fake.getAppPolicyReturnsOnCall == nil { - fake.getAppPolicyReturnsOnCall = make(map[int]struct { - result1 *models.ScalingPolicy - result2 error - }) - } - fake.getAppPolicyReturnsOnCall[i] = struct { - result1 *models.ScalingPolicy - result2 error - }{result1, result2} -} - -func (fake *FakePolicyDB) RetrievePolicies() ([]*models.PolicyJson, error) { - fake.retrievePoliciesMutex.Lock() - ret, specificReturn := fake.retrievePoliciesReturnsOnCall[len(fake.retrievePoliciesArgsForCall)] - fake.retrievePoliciesArgsForCall = append(fake.retrievePoliciesArgsForCall, struct{}{}) - fake.recordInvocation("RetrievePolicies", []interface{}{}) - fake.retrievePoliciesMutex.Unlock() - if fake.RetrievePoliciesStub != nil { - return fake.RetrievePoliciesStub() - } - if specificReturn { - return ret.result1, ret.result2 - } - return fake.retrievePoliciesReturns.result1, fake.retrievePoliciesReturns.result2 -} - -func (fake *FakePolicyDB) RetrievePoliciesCallCount() int { - fake.retrievePoliciesMutex.RLock() - defer fake.retrievePoliciesMutex.RUnlock() - return len(fake.retrievePoliciesArgsForCall) -} - -func (fake *FakePolicyDB) RetrievePoliciesReturns(result1 []*models.PolicyJson, result2 error) { - fake.RetrievePoliciesStub = nil - fake.retrievePoliciesReturns = struct { - result1 []*models.PolicyJson - result2 error - }{result1, result2} -} - -func (fake *FakePolicyDB) RetrievePoliciesReturnsOnCall(i int, result1 []*models.PolicyJson, result2 error) { - fake.RetrievePoliciesStub = nil - if fake.retrievePoliciesReturnsOnCall == nil { - fake.retrievePoliciesReturnsOnCall = make(map[int]struct { - result1 []*models.PolicyJson - result2 error - }) - } - fake.retrievePoliciesReturnsOnCall[i] = struct { - result1 []*models.PolicyJson - result2 error - }{result1, result2} -} - -func (fake *FakePolicyDB) Close() error { - fake.closeMutex.Lock() - ret, specificReturn := fake.closeReturnsOnCall[len(fake.closeArgsForCall)] - fake.closeArgsForCall = append(fake.closeArgsForCall, struct{}{}) - fake.recordInvocation("Close", []interface{}{}) - fake.closeMutex.Unlock() - if fake.CloseStub != nil { - return fake.CloseStub() - } - if specificReturn { - return ret.result1 - } - return fake.closeReturns.result1 -} - -func (fake *FakePolicyDB) CloseCallCount() int { - fake.closeMutex.RLock() - defer fake.closeMutex.RUnlock() - return len(fake.closeArgsForCall) -} - -func (fake *FakePolicyDB) CloseReturns(result1 error) { - fake.CloseStub = nil - fake.closeReturns = struct { - result1 error - }{result1} -} - -func (fake *FakePolicyDB) CloseReturnsOnCall(i int, result1 error) { - fake.CloseStub = nil - if fake.closeReturnsOnCall == nil { - fake.closeReturnsOnCall = make(map[int]struct { - result1 error - }) - } - fake.closeReturnsOnCall[i] = struct { - result1 error - }{result1} -} - -func (fake *FakePolicyDB) EmitHealthMetrics(h healthendpoint.Health, cclock clock.Clock, interval time.Duration) { - fake.emitHealthMetricsMutex.Lock() - fake.emitHealthMetricsArgsForCall = append(fake.emitHealthMetricsArgsForCall, struct { - h healthendpoint.Health - cclock clock.Clock - interval time.Duration - }{h, cclock, interval}) - fake.recordInvocation("EmitHealthMetrics", []interface{}{h, cclock, interval}) - fake.emitHealthMetricsMutex.Unlock() - if fake.EmitHealthMetricsStub != nil { - fake.EmitHealthMetricsStub(h, cclock, interval) - } -} - -func (fake *FakePolicyDB) EmitHealthMetricsCallCount() int { - fake.emitHealthMetricsMutex.RLock() - defer fake.emitHealthMetricsMutex.RUnlock() - return len(fake.emitHealthMetricsArgsForCall) -} - -func (fake *FakePolicyDB) EmitHealthMetricsArgsForCall(i int) (healthendpoint.Health, clock.Clock, time.Duration) { - fake.emitHealthMetricsMutex.RLock() - defer fake.emitHealthMetricsMutex.RUnlock() - return fake.emitHealthMetricsArgsForCall[i].h, fake.emitHealthMetricsArgsForCall[i].cclock, fake.emitHealthMetricsArgsForCall[i].interval -} - -func (fake *FakePolicyDB) DeletePolicy(appId string) error { - fake.deletePolicyMutex.Lock() - ret, specificReturn := fake.deletePolicyReturnsOnCall[len(fake.deletePolicyArgsForCall)] - fake.deletePolicyArgsForCall = append(fake.deletePolicyArgsForCall, struct { - appId string - }{appId}) - fake.recordInvocation("DeletePolicy", []interface{}{appId}) - fake.deletePolicyMutex.Unlock() - if fake.DeletePolicyStub != nil { - return fake.DeletePolicyStub(appId) - } - if specificReturn { - return ret.result1 - } - return fake.deletePolicyReturns.result1 -} - -func (fake *FakePolicyDB) DeletePolicyCallCount() int { - fake.deletePolicyMutex.RLock() - defer fake.deletePolicyMutex.RUnlock() - return len(fake.deletePolicyArgsForCall) -} - -func (fake *FakePolicyDB) DeletePolicyArgsForCall(i int) string { - fake.deletePolicyMutex.RLock() - defer fake.deletePolicyMutex.RUnlock() - return fake.deletePolicyArgsForCall[i].appId -} - -func (fake *FakePolicyDB) DeletePolicyReturns(result1 error) { - fake.DeletePolicyStub = nil - fake.deletePolicyReturns = struct { - result1 error - }{result1} -} - -func (fake *FakePolicyDB) DeletePolicyReturnsOnCall(i int, result1 error) { - fake.DeletePolicyStub = nil - if fake.deletePolicyReturnsOnCall == nil { - fake.deletePolicyReturnsOnCall = make(map[int]struct { - result1 error - }) - } - fake.deletePolicyReturnsOnCall[i] = struct { - result1 error - }{result1} -} - -func (fake *FakePolicyDB) GetCustomMetricsCreds(appId string) (string, string, error) { - fake.getCustomMetricsCredsMutex.Lock() - ret, specificReturn := fake.getCustomMetricsCredsReturnsOnCall[len(fake.getCustomMetricsCredsArgsForCall)] - fake.getCustomMetricsCredsArgsForCall = append(fake.getCustomMetricsCredsArgsForCall, struct { - appId string - }{appId}) - fake.recordInvocation("GetCustomMetricsCreds", []interface{}{appId}) - fake.getCustomMetricsCredsMutex.Unlock() - if fake.GetCustomMetricsCredsStub != nil { - return fake.GetCustomMetricsCredsStub(appId) - } - if specificReturn { - return ret.result1, ret.result2, ret.result3 - } - return fake.getCustomMetricsCredsReturns.result1, fake.getCustomMetricsCredsReturns.result2, fake.getCustomMetricsCredsReturns.result3 -} - -func (fake *FakePolicyDB) GetCustomMetricsCredsCallCount() int { - fake.getCustomMetricsCredsMutex.RLock() - defer fake.getCustomMetricsCredsMutex.RUnlock() - return len(fake.getCustomMetricsCredsArgsForCall) -} - -func (fake *FakePolicyDB) GetCustomMetricsCredsArgsForCall(i int) string { - fake.getCustomMetricsCredsMutex.RLock() - defer fake.getCustomMetricsCredsMutex.RUnlock() - return fake.getCustomMetricsCredsArgsForCall[i].appId -} - -func (fake *FakePolicyDB) GetCustomMetricsCredsReturns(result1 string, result2 string, result3 error) { - fake.GetCustomMetricsCredsStub = nil - fake.getCustomMetricsCredsReturns = struct { - result1 string - result2 string - result3 error - }{result1, result2, result3} -} - -func (fake *FakePolicyDB) GetCustomMetricsCredsReturnsOnCall(i int, result1 string, result2 string, result3 error) { - fake.GetCustomMetricsCredsStub = nil - if fake.getCustomMetricsCredsReturnsOnCall == nil { - fake.getCustomMetricsCredsReturnsOnCall = make(map[int]struct { - result1 string - result2 string - result3 error - }) - } - fake.getCustomMetricsCredsReturnsOnCall[i] = struct { - result1 string - result2 string - result3 error - }{result1, result2, result3} -} - -func (fake *FakePolicyDB) Invocations() map[string][][]interface{} { - fake.invocationsMutex.RLock() - defer fake.invocationsMutex.RUnlock() - fake.getAppIdsMutex.RLock() - defer fake.getAppIdsMutex.RUnlock() - fake.getAppPolicyMutex.RLock() - defer fake.getAppPolicyMutex.RUnlock() - fake.retrievePoliciesMutex.RLock() - defer fake.retrievePoliciesMutex.RUnlock() - fake.closeMutex.RLock() - defer fake.closeMutex.RUnlock() - fake.emitHealthMetricsMutex.RLock() - defer fake.emitHealthMetricsMutex.RUnlock() - fake.deletePolicyMutex.RLock() - defer fake.deletePolicyMutex.RUnlock() - fake.getCustomMetricsCredsMutex.RLock() - defer fake.getCustomMetricsCredsMutex.RUnlock() - copiedInvocations := map[string][][]interface{}{} - for key, value := range fake.invocations { - copiedInvocations[key] = value - } - return copiedInvocations -} - -func (fake *FakePolicyDB) recordInvocation(key string, args []interface{}) { - fake.invocationsMutex.Lock() - defer fake.invocationsMutex.Unlock() - if fake.invocations == nil { - fake.invocations = map[string][][]interface{}{} - } - if fake.invocations[key] == nil { - fake.invocations[key] = [][]interface{}{} - } - fake.invocations[key] = append(fake.invocations[key], args) -} - -var _ db.PolicyDB = new(FakePolicyDB) diff --git a/src/github.com/cespare/xxhash b/src/github.com/cespare/xxhash new file mode 160000 index 000000000..d7df74196 --- /dev/null +++ b/src/github.com/cespare/xxhash @@ -0,0 +1 @@ +Subproject commit d7df74196a9e781ede915320c11c378c1b2f3a1f diff --git a/src/github.com/prometheus/client_golang b/src/github.com/prometheus/client_golang index 82f5ff156..554505791 160000 --- a/src/github.com/prometheus/client_golang +++ b/src/github.com/prometheus/client_golang @@ -1 +1 @@ -Subproject commit 82f5ff156b29e276022b1a958f7d385870fb9814 +Subproject commit 55450579111f95e3722cb93dec62fe9e847d6130 diff --git a/src/github.com/prometheus/client_model b/src/github.com/prometheus/client_model index 99fa1f4be..14fe0d1b0 160000 --- a/src/github.com/prometheus/client_model +++ b/src/github.com/prometheus/client_model @@ -1 +1 @@ -Subproject commit 99fa1f4be8e564e8a6b613da7fa6f46c9edafc6c +Subproject commit 14fe0d1b01d4d5fc031dd4bec1823bd3ebbe8016 diff --git a/src/github.com/prometheus/common b/src/github.com/prometheus/common index d811d2e9b..287d3e634 160000 --- a/src/github.com/prometheus/common +++ b/src/github.com/prometheus/common @@ -1 +1 @@ -Subproject commit d811d2e9bf898806ecfb6ef6296774b13ffc314c +Subproject commit 287d3e634a1e550c9e463dd7e5a75a422c614505 diff --git a/src/github.com/prometheus/procfs b/src/github.com/prometheus/procfs index 8b1c2da0d..499c85531 160000 --- a/src/github.com/prometheus/procfs +++ b/src/github.com/prometheus/procfs @@ -1 +1 @@ -Subproject commit 8b1c2da0d56deffdbb9e48d4414b4e674bd8083e +Subproject commit 499c85531f756d1129edd26485a5f73871eeb308