Skip to content

Commit

Permalink
refactor(logging): improve logging for AbstractWaitForClusterWideClou…
Browse files Browse the repository at this point in the history
…ddriverTask

Add specificity to the log message so you can tell which task is actually waiting for something to happen.
So.. instead of:
```
Pipeline 01D9QSYBNK7ENG0BSM7V9V07ZZ is looking for [us-east-1->serverlabmvulfson-dev-v044]
Server groups matching AbstractWaitForClusterWideClouddriverTask$DeployServerGroup(region:us-east-1, name:serverlabmvulfson-dev-v044) ...
```
we will have:
```
Pipeline 01D9R3HMZHZ82H0RNKG1D8JBRW:WaitForClusterDisableTask looking for server groups: [us-east-1->serverlabmvulfson-dev-v047] found: [[instances...
```
  • Loading branch information
marchello2000 committed Apr 30, 2019
1 parent fdc5f6a commit cd9da19
Showing 1 changed file with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ abstract class AbstractWaitForClusterWideClouddriverTask extends AbstractCloudPr
def isMatch = it.region == deployServerGroup.region && it.name == deployServerGroup.name
isMatch
})
log.info "Server groups matching $deployServerGroup : $matchingServerGroups"

log.info("${this.getClass().getSimpleName()}: Server groups matching $deployServerGroup : $matchingServerGroups")
isServerGroupOperationInProgress(stage, interestingHealthProviderNames, matchingServerGroups)
}

Expand All @@ -81,6 +82,11 @@ abstract class AbstractWaitForClusterWideClouddriverTask extends AbstractCloudPr
static class DeployServerGroup {
String region
String name

@Override
String toString() {
return "${region}->${name}"
}
}

static class RemainingDeployServerGroups {
Expand Down Expand Up @@ -110,8 +116,7 @@ abstract class AbstractWaitForClusterWideClouddriverTask extends AbstractCloudPr
}

def serverGroups = cluster.get().serverGroups.collect { new TargetServerGroup(it) }
log.info "Pipeline ${stage.execution?.id} found server groups ${serverGroups.collect { it.region + "->" + it.name }}"
log.info "Pipeline ${stage.execution?.id} is looking for ${remainingDeployServerGroups.collect { it.region + "->" + it.name }}"
log.info "Pipeline ${stage.execution?.id}:${this.getClass().getSimpleName()} looking for server groups: $remainingDeployServerGroups found: $serverGroups"

if (!serverGroups) {
return emptyClusterResult(stage, clusterSelection, cluster.get())
Expand All @@ -121,11 +126,11 @@ abstract class AbstractWaitForClusterWideClouddriverTask extends AbstractCloudPr
List<DeployServerGroup> stillRemaining = remainingDeployServerGroups.findAll(this.&isServerGroupOperationInProgress.curry(stage, serverGroups, healthProviderTypesToCheck))

if (stillRemaining) {
log.info "Pipeline ${stage.execution?.id} still has ${stillRemaining.collect { it.region + "->" + it.name }}"
log.info "Pipeline ${stage.execution?.id}:${this.getClass().getSimpleName()} still has $stillRemaining"
return TaskResult.builder(ExecutionStatus.RUNNING).context([remainingDeployServerGroups: stillRemaining]).build()
}

log.info "Pipeline ${stage.execution?.id} no server groups remain"
log.info "Pipeline ${stage.execution?.id}:${this.getClass().getSimpleName()} no server groups remain"
return TaskResult.SUCCEEDED
}
}

0 comments on commit cd9da19

Please sign in to comment.