Commit c9b47615 by Dave Syer

More defensive exception handling

parent 8dd9b830
...@@ -428,11 +428,7 @@ To run the Hystrix Dashboard annotate your Spring Boot main class with `@EnableH ...@@ -428,11 +428,7 @@ To run the Hystrix Dashboard annotate your Spring Boot main class with `@EnableH
Looking at an individual instances Hystrix data is not very useful in terms of the overall health of the system. https://github.com/Netflix/Turbine[Turbine] is an application that aggregates all of the relevant `/hystrix.stream` endpoints into a combined `/turbine.stream` for use in the Hystrix Dashboard. Individual instances are located via Eureka. Running Turbine is as simple as annotating your main class with the `@EnableTurbine` annotation. Looking at an individual instances Hystrix data is not very useful in terms of the overall health of the system. https://github.com/Netflix/Turbine[Turbine] is an application that aggregates all of the relevant `/hystrix.stream` endpoints into a combined `/turbine.stream` for use in the Hystrix Dashboard. Individual instances are located via Eureka. Running Turbine is as simple as annotating your main class with the `@EnableTurbine` annotation.
Configuration key `turbine.appConfig` is a list of eureka serviceId's that turbine will use to lookup instances. And `turbine.aggregator.clusterConfig` is used to group instances together (from the eureka `InstanceInfo`). The clusterName is a SPEL expression evaluated against the InstanceInfo. The default `clusterNameExpression` is `appName`. The turbine stream is then used in the Hystrix dashboard using a url that looks like: http://my.turbine.sever:8080/turbine.stream?cluster=CUSTOMERS Configuration key `turbine.appConfig` is a list of eureka serviceId's that turbine will use to lookup instances. The turbine stream is then used in the Hystrix dashboard using a url that looks like: `http://my.turbine.sever:8080/turbine.stream?cluster=<CLUSTERNAME>` (the cluster parameter can be omitted if the name is "default"). The `cluster` parameter must match an entry in `turbine.aggregator.clusterConfig`. Value returned from eureka are uppercase, thus we expect this example to work if there is an app registered with Eureka called "customers":
The `cluster` parameter must match an entry in `turbine.aggregator.clusterConfig`.
Value returned from eureka are uppercase, thus the examples of all uppercase `CUSTOMERS`
---- ----
turbine: turbine:
...@@ -441,7 +437,13 @@ turbine: ...@@ -441,7 +437,13 @@ turbine:
appConfig: customers appConfig: customers
---- ----
The `clusterName` can be customized by a SPEL expression in `turbine.clusterNameExpression`. For example, `turbine.clusterNameExpression=aSGName` would get the cluster name from the AWS ASG name. The `clusterName` can be customized by a SPEL expression in `turbine.clusterNameExpression`. For example, `turbine.clusterNameExpression=aSGName` would get the cluster name from the AWS ASG name. To use the "default" cluster for all apps you need a string literal expression (with single quotes):
----
turbine:
appConfig: customers,stores
clusterNameExpression: 'default'
----
Spring Cloud provides a `spring-cloud-starter-turbine` that has all the dependencies you need to get a Turbine server running. Just create a Spring Boot application and annotate it with `@EnableTurbine`. Spring Cloud provides a `spring-cloud-starter-turbine` that has all the dependencies you need to get a Turbine server running. Just create a Spring Boot application and annotate it with `@EnableTurbine`.
......
...@@ -122,17 +122,22 @@ public class EurekaInstanceDiscovery implements InstanceDiscovery { ...@@ -122,17 +122,22 @@ public class EurekaInstanceDiscovery implements InstanceDiscovery {
if (app == null) { if (app == null) {
log.warn("Eureka returned null for app: " + appName); log.warn("Eureka returned null for app: " + appName);
} }
List<InstanceInfo> instancesForApp = app.getInstances(); try {
if (instancesForApp != null) { List<InstanceInfo> instancesForApp = app.getInstances();
log.info("Received instance list for app: " + appName + " = " if (instancesForApp != null) {
+ instancesForApp.size()); log.info("Received instance list for app: " + appName + ", size="
for (InstanceInfo iInfo : instancesForApp) { + instancesForApp.size());
Instance instance = marshallInstanceInfo(iInfo); for (InstanceInfo iInfo : instancesForApp) {
if (instance != null) { Instance instance = marshallInstanceInfo(iInfo);
instances.add(instance); if (instance != null) {
instances.add(instance);
}
} }
} }
} }
catch (Exception e) {
log.info("Failed to retrieve instances from Eureka");
}
return instances; return instances;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment