Add aws environments to the statistics

but only with the field usedRunners.
This commit is contained in:
Maximilian Paß
2022-04-03 18:07:08 +02:00
parent d7b1c2d691
commit 136f596dc2
7 changed files with 45 additions and 23 deletions

View File

@ -59,5 +59,13 @@ func (n *AbstractManager) Delete(id dto.EnvironmentID) (bool, error) {
}
func (n *AbstractManager) Statistics() map[dto.EnvironmentID]*dto.StatisticalExecutionEnvironmentData {
return map[dto.EnvironmentID]*dto.StatisticalExecutionEnvironmentData{}
if n.runnerManager == nil {
return map[dto.EnvironmentID]*dto.StatisticalExecutionEnvironmentData{}
}
statistics := n.NextHandler().Statistics()
for k, v := range n.runnerManager.EnvironmentStatistics() {
statistics[k] = v
}
return statistics
}

View File

@ -59,6 +59,11 @@ func (a *AWSEnvironment) Sample() (r runner.Runner, ok bool) {
// The following methods are not supported at this moment.
// IdleRunnerCount is not supported as we have no information about the AWS managed prewarming pool.
func (a *AWSEnvironment) IdleRunnerCount() int {
return 0
}
// PrewarmingPoolSize is neither supported nor required. It is handled transparently by AWS.
func (a *AWSEnvironment) PrewarmingPoolSize() uint {
return 0
@ -111,7 +116,3 @@ func (a *AWSEnvironment) AddRunner(_ runner.Runner) {
func (a *AWSEnvironment) DeleteRunner(_ string) {
panic("not supported")
}
func (a *AWSEnvironment) IdleRunnerCount() int {
panic("not supported")
}

View File

@ -67,7 +67,3 @@ func isAWSEnvironment(request dto.ExecutionEnvironmentRequest) bool {
}
return false
}
func (a *AWSEnvironmentManager) Statistics() map[dto.EnvironmentID]*dto.StatisticalExecutionEnvironmentData {
return a.NextHandler().Statistics()
}

View File

@ -120,10 +120,6 @@ func (m *NomadEnvironmentManager) CreateOrUpdate(id dto.EnvironmentID, request d
return !isExistingEnvironment, nil
}
func (m *NomadEnvironmentManager) Statistics() map[dto.EnvironmentID]*dto.StatisticalExecutionEnvironmentData {
return m.runnerManager.EnvironmentStatistics()
}
func (m *NomadEnvironmentManager) Load() error {
templateJobs, err := m.api.LoadEnvironmentJobs()
if err != nil {