Skip to content

Commit

Permalink
chore(aws): Log LB instances that have "still registering" state desc…
Browse files Browse the repository at this point in the history
…ription (#4840)
  • Loading branch information
robzienert committed Aug 26, 2020
1 parent 31bedcb commit f694e4d
Showing 1 changed file with 13 additions and 2 deletions.
Expand Up @@ -48,15 +48,17 @@ import static com.netflix.spinnaker.clouddriver.core.provider.agent.Namespace.LO

@Slf4j
class AmazonLoadBalancerInstanceStateCachingAgent implements CachingAgent, HealthProvidingCachingAgent, AccountAware {

final static String healthId = "aws-load-balancer-instance-health"
private final static String STILL_REGISTERING_DESCRIPTION = "Instance registration is still in progress."

final AmazonClientProvider amazonClientProvider
final NetflixAmazonCredentials account
final String region
final ObjectMapper objectMapper
final ApplicationContext ctx

private Cache cacheView
final static String healthId = "aws-load-balancer-instance-health"


AmazonLoadBalancerInstanceStateCachingAgent(AmazonClientProvider amazonClientProvider,
NetflixAmazonCredentials account, String region,
Expand Down Expand Up @@ -125,6 +127,15 @@ class AmazonLoadBalancerInstanceStateCachingAgent implements CachingAgent, Healt
instanceState.reasonCode,
instanceState.description)
loadBalancerInstances << loadBalancerInstance

// We want to track how long instances remain in a "still registering" state. Logging any time we
// see an instance with this description is a poor man's way of getting the metrics we need, without
// having to do expensive lookups - we can defer this to our logging platform to do the maths.
// TODO(rz): This kind of metric may be easier to create if we had a method of emitting events when
// cache state changes.
if (instanceState.description == STILL_REGISTERING_DESCRIPTION) {
log.info("Instance '${instanceState.instanceId}' is still registering with load balancer '$lbName'")
}
}

LoadBalancerInstanceState loadBalancerInstanceState = new LoadBalancerInstanceState(
Expand Down

0 comments on commit f694e4d

Please sign in to comment.