Skip to content

Commit

Permalink
Merge pull request #1390 from tomaslin/titus-use-instance-ids-for-health
Browse files Browse the repository at this point in the history
Titus: link titus task to discovery instance with the instanceId
  • Loading branch information
tomaslin authored Jan 24, 2017
2 parents dfd14d6 + 0916894 commit edc1e22
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class TitusCachingProvider implements Provider, EurekaAwareProvider {

@Override
Boolean isProviderForEurekaRecord(Map<String, Object> attributes) {
attributes.containsKey('titusTaskId') && attributes.get('titusTaskId') != null
attributes.containsKey('titusTaskId') && attributes.get('titusTaskId') != null && attributes.get('instanceId') != null
}

@Override
Expand All @@ -52,7 +52,7 @@ class TitusCachingProvider implements Provider, EurekaAwareProvider {

@Override
String getInstanceHealthKey(Map<String, Object> attributes, String region, String healthId) {
Keys.getInstanceHealthKey(attributes.titusTaskId, healthId)
Keys.getInstanceHealthKey(attributes.instanceId, healthId)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ class TitusClusterProvider implements ClusterProvider<TitusCluster> {
instanceData.each { instanceEntry ->
externalHealthProviders.each { externalHealthProvider ->
externalHealthProvider.agents.each { externalHealthAgent ->
def key = Keys.getInstanceHealthKey(instanceEntry.attributes.task.id, externalHealthAgent.healthId)
def key = Keys.getInstanceHealthKey(instanceEntry.attributes.task.instanceId, externalHealthAgent.healthId)
healthKeysToInstance.put(key, instanceEntry.id)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class TitusInstanceProvider implements InstanceProvider<TitusInstance> {
externalHealthProviders.each { externalHealthProvider ->
def healthKeys = []
externalHealthProvider.agents.each { externalHealthAgent ->
healthKeys << Keys.getInstanceHealthKey(instance.name, externalHealthAgent.healthId)
healthKeys << Keys.getInstanceHealthKey(instance.instanceId, externalHealthAgent.healthId)
}
healthKeys.unique().each { key ->
def externalHealth = cacheView.getAll(HEALTH.ns, key)
Expand Down

0 comments on commit edc1e22

Please sign in to comment.