28 lines
3.8 KiB
HTML
28 lines
3.8 KiB
HTML
<html><head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
|
<title>65. Hystrix metrics aggregation with Turbine and Consul</title><link rel="stylesheet" type="text/css" href="css/manual-multipage.css"><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="multi_spring-cloud.html" title="Spring Cloud"><link rel="up" href="multi__spring_cloud_consul.html" title="Part VIII. Spring Cloud Consul"><link rel="prev" href="multi_spring-cloud-consul-hystrix.html" title="64. Circuit Breaker with Hystrix"><link rel="next" href="multi__spring_cloud_zookeeper.html" title="Part IX. Spring Cloud Zookeeper"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">65. Hystrix metrics aggregation with Turbine and Consul</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="multi_spring-cloud-consul-hystrix.html">Prev</a> </td><th width="60%" align="center">Part VIII. Spring Cloud Consul</th><td width="20%" align="right"> <a accesskey="n" href="multi__spring_cloud_zookeeper.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="spring-cloud-consul-turbine" href="#spring-cloud-consul-turbine"></a>65. Hystrix metrics aggregation with Turbine and Consul</h2></div></div></div><p>Turbine (provided by the Spring Cloud Netflix project), aggregates multiple instances Hystrix metrics streams, so the dashboard can display an aggregate view. Turbine uses the <code class="literal">DiscoveryClient</code> interface to lookup relevant instances. To use Turbine with Spring Cloud Consul, configure the Turbine application in a manner similar to the following examples:</p><p><b>pom.xml. </b>
|
|
</p><pre class="screen"><dependency>
|
|
<groupId>org.springframework.cloud</groupId>
|
|
<artifactId>spring-cloud-netflix-turbine</artifactId>
|
|
</dependency>
|
|
<dependency>
|
|
<groupId>org.springframework.cloud</groupId>
|
|
<artifactId>spring-cloud-starter-consul-discovery</artifactId>
|
|
</dependency></pre><p>
|
|
</p><p>Notice that the Turbine dependency is not a starter. The turbine starter includes support for Netflix Eureka.</p><p><b>application.yml. </b>
|
|
</p><pre class="screen">spring.application.name: turbine
|
|
applications: consulhystrixclient
|
|
turbine:
|
|
aggregator:
|
|
clusterConfig: ${applications}
|
|
appConfig: ${applications}</pre><p>
|
|
</p><p>The <code class="literal">clusterConfig</code> and <code class="literal">appConfig</code> sections must match, so it’s useful to put the comma-separated list of service ID’s into a separate configuration property.</p><p><b>Turbine.java. </b>
|
|
</p><pre class="screen">@EnableTurbine
|
|
@EnableDiscoveryClient
|
|
@SpringBootApplication
|
|
public class Turbine {
|
|
public static void main(String[] args) {
|
|
SpringApplication.run(DemoturbinecommonsApplication.class, args);
|
|
}
|
|
}</pre><p>
|
|
</p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="multi_spring-cloud-consul-hystrix.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="multi__spring_cloud_consul.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="multi__spring_cloud_zookeeper.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">64. Circuit Breaker with Hystrix </td><td width="20%" align="center"><a accesskey="h" href="multi_spring-cloud.html">Home</a></td><td width="40%" align="right" valign="top"> Part IX. Spring Cloud Zookeeper</td></tr></table></div></body></html> |