Merge remote-tracking branch 'origin/4.1.x'
# Conflicts: # docs/pom.xml # pom.xml # spring-cloud-netflix-dependencies/pom.xml # spring-cloud-netflix-eureka-client-tls-tests/pom.xml # spring-cloud-netflix-eureka-client/pom.xml # spring-cloud-netflix-eureka-server/pom.xml # spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/EurekaInstanceMonitorTests.java # spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/EurekaInstanceMonitorWithCustomTagsProviderTests.java # spring-cloud-starter-netflix-eureka-client/pom.xml # spring-cloud-starter-netflix-eureka-server/pom.xml
This commit is contained in:
@@ -71,12 +71,18 @@ public class EurekaInstanceMonitor implements SmartApplicationListener {
|
||||
|
||||
@Override
|
||||
public void onApplicationEvent(ApplicationEvent event) {
|
||||
final Map<Tags, Long> aggregatedCounts = instanceRegistry.getApplications()
|
||||
executor.execute(() -> {
|
||||
Map<Tags, Long> aggregatedCounts = collectAggregatedCounts();
|
||||
registerMetrics(aggregatedCounts);
|
||||
});
|
||||
}
|
||||
|
||||
private Map<Tags, Long> collectAggregatedCounts() {
|
||||
return instanceRegistry.getApplications()
|
||||
.getRegisteredApplications()
|
||||
.stream()
|
||||
.flatMap(application -> application.getInstances().stream())
|
||||
.collect(Collectors.groupingBy(tagProvider::eurekaInstanceTags, Collectors.counting()));
|
||||
executor.execute(() -> registerMetrics(aggregatedCounts));
|
||||
}
|
||||
|
||||
private void registerMetrics(Map<Tags, Long> aggregatedCounts) {
|
||||
|
||||
Reference in New Issue
Block a user