无法将Hystrix仪表板与Spring Boot Admin集成
这是我的pom:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>demo</name>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.1.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-server</artifactId>
<version>1.4.3</version>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-server-ui</artifactId>
<version>1.4.3</version>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-server-ui-hystrix</artifactId>
<version>1.4.3</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
我已按照http://codecentric.github.io/spring-boot-admin/1.4.3/#_hystrix_ui_module中的说明进行操作。
我在我的客户端添加了spring boot管理客户端和hystrix依赖项,并使用了@EnableHystrix并将@HystricCommand放在我的端点上,但是我无法在Spring Boot Admin UI中看到hystrix流。
我缺少什么?
如果我遗漏了某些东西,任何人都可以告诉我正确的步骤。
添加客户端pom:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.demo.client</groupId>
<artifactId>democlient</artifactId>
<version>0.0.1</version>
<packaging>jar</packaging>
<name>democlient</name>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.1.RELEASE</version>
<relativePath />
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-hystrix</artifactId>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-client</artifactId>
<version>1.4.3</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>build-info</goal>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
客户代码:
@SpringBootApplication
@RestController
@EnableHystrix
public class DemoClient {
public static void main(String[] Args) {
SpringApplication.run(DemoClient.class, Args);
}
@RequestMapping(value = "/hello")
@HystrixCommand
public ResponseEntity<String> hello() {
return new ResponseEntity<String>("Client Test", HttpStatus.OK);
}
}
Admin application.properties:
spring.boot.admin.routes.endpoints= env,metrics,trace,dump,jolokia,info,configprops,trace,logfile,refresh,flyway,liquibase,heapdump,hystrix.stream,turbine.stream
客户端application.properties:
spring.boot.admin.url=http://localhost:8080
spring.boot.admin.auto-registration= true
spring.boot.admin.auto-deregistration = true
运行应用程序后,端点确实按照管理服务器中的日志进行了注册,但是我收到了警告,我无法在管理界面中看到hystrix流。 管理日志:
INFO 15220 --- [nio-8245-exec-8] d.c.b.a.registry.ApplicationRegistry [register:81] : New Application Application [id=8e14fbfe, name=democlient, managementUrl=http://localhost:8086, healthUrl=http://localhost:8086/health, serviceUrl=http://localhost:8086] registered
INFO 15220 --- [nio-8245-exec-1] o.s.c.n.zuul.web.ZuulHandlerMapping [registerHandler:354] : Mapped URL path [/api/applications/8e14fbfe/health/**] onto handler of type [class de.codecentric.boot.admin.zuul.OptionsDispatchingZuulController]
INFO 15220 --- [nio-8245-exec-1] o.s.c.n.zuul.web.ZuulHandlerMapping [registerHandler:354] : Mapped URL path [/api/applications/8e14fbfe/env/**] onto handler of type [class de.codecentric.boot.admin.zuul.OptionsDispatchingZuulController]
INFO 15220 --- [nio-8245-exec-1] o.s.c.n.zuul.web.ZuulHandlerMapping [registerHandler:354] : Mapped URL path [/api/applications/8e14fbfe/metrics/**] onto handler of type [class de.codecentric.boot.admin.zuul.OptionsDispatchingZuulController]
INFO 15220 --- [nio-8245-exec-1] o.s.c.n.zuul.web.ZuulHandlerMapping [registerHandler:354] : Mapped URL path [/api/applications/8e14fbfe/trace/**] onto handler of type [class de.codecentric.boot.admin.zuul.OptionsDispatchingZuulController]
INFO 15220 --- [nio-8245-exec-1] o.s.c.n.zuul.web.ZuulHandlerMapping [registerHandler:354] : Mapped URL path [/api/applications/8e14fbfe/dump/**] onto handler of type [class de.codecentric.boot.admin.zuul.OptionsDispatchingZuulController]
INFO 15220 --- [nio-8245-exec-1] o.s.c.n.zuul.web.ZuulHandlerMapping [registerHandler:354] : Mapped URL path [/api/applications/8e14fbfe/jolokia/**] onto handler of type [class de.codecentric.boot.admin.zuul.OptionsDispatchingZuulController]
INFO 15220 --- [nio-8245-exec-1] o.s.c.n.zuul.web.ZuulHandlerMapping [registerHandler:354] : Mapped URL path [/api/applications/8e14fbfe/info/**] onto handler of type [class de.codecentric.boot.admin.zuul.OptionsDispatchingZuulController]
INFO 15220 --- [nio-8245-exec-1] o.s.c.n.zuul.web.ZuulHandlerMapping [registerHandler:354] : Mapped URL path [/api/applications/8e14fbfe/configprops/**] onto handler of type [class de.codecentric.boot.admin.zuul.OptionsDispatchingZuulController]
INFO 15220 --- [nio-8245-exec-1] o.s.c.n.zuul.web.ZuulHandlerMapping [registerHandler:354] : Mapped URL path [/api/applications/8e14fbfe/logfile/**] onto handler of type [class de.codecentric.boot.admin.zuul.OptionsDispatchingZuulController]
INFO 15220 --- [nio-8245-exec-1] o.s.c.n.zuul.web.ZuulHandlerMapping [registerHandler:354] : Mapped URL path [/api/applications/8e14fbfe/refresh/**] onto handler of type [class de.codecentric.boot.admin.zuul.OptionsDispatchingZuulController]
INFO 15220 --- [nio-8245-exec-1] o.s.c.n.zuul.web.ZuulHandlerMapping [registerHandler:354] : Mapped URL path [/api/applications/8e14fbfe/flyway/**] onto handler of type [class de.codecentric.boot.admin.zuul.OptionsDispatchingZuulController]
INFO 15220 --- [nio-8245-exec-1] o.s.c.n.zuul.web.ZuulHandlerMapping [registerHandler:354] : Mapped URL path [/api/applications/8e14fbfe/liquibase/**] onto handler of type [class de.codecentric.boot.admin.zuul.OptionsDispatchingZuulController]
INFO 15220 --- [nio-8245-exec-1] o.s.c.n.zuul.web.ZuulHandlerMapping [registerHandler:354] : Mapped URL path [/api/applications/8e14fbfe/heapdump/**] onto handler of type [class de.codecentric.boot.admin.zuul.OptionsDispatchingZuulController]
INFO 15220 --- [nio-8245-exec-1] o.s.c.n.zuul.web.ZuulHandlerMapping [registerHandler:354] : Mapped URL path [/api/applications/8e14fbfe/hystrix.stream/**] onto handler of type [class de.codecentric.boot.admin.zuul.OptionsDispatchingZuulController]
INFO 15220 --- [nio-8245-exec-1] o.s.c.n.zuul.web.ZuulHandlerMapping [registerHandler:354] : Mapped URL path [/api/applications/8e14fbfe/turbine.stream/**] onto handler of type [class de.codecentric.boot.admin.zuul.OptionsDispatchingZuulController]
WARN 15220 --- [nio-8245-exec-2] o.s.c.n.z.filters.post.SendErrorFilter [run:70] : Error during filtering
java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
at java.net.SocketInputStream.read(SocketInputStream.java:170)
at java.net.SocketInputStream.read(SocketInputStream.java:141)
at org.apache.http.impl.io.SessionInputBufferImpl.streamRead(SessionInputBufferImpl.java:137)
at org.apache.http.impl.io.SessionInputBufferImpl.fillBuffer(SessionInputBufferImpl.java:153)
at org.apache.http.impl.io.SessionInputBufferImpl.readLine(SessionInputBufferImpl.java:282)
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:140)
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:57)
at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:259)
at org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:163)
at org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy.java:167)
at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:273)
at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:271)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:117)
at de.codecentric.boot.admin.zuul.filters.route.SimpleHostRoutingFilter.forwardRequest(SimpleHostRoutingFilter.java:349)
at de.codecentric.boot.admin.zuul.filters.route.SimpleHostRoutingFilter.forward(SimpleHostRoutingFilter.java:311)
at de.codecentric.boot.admin.zuul.filters.route.SimpleHostRoutingFilter.run(SimpleHostRoutingFilter.java:186)
at com.netflix.zuul.ZuulFilter.runFilter(ZuulFilter.java:112)
at com.netflix.zuul.FilterProcessor.processZuulFilter(FilterProcessor.java:197)
at com.netflix.zuul.FilterProcessor.runFilters(FilterProcessor.java:161)
at com.netflix.zuul.FilterProcessor.route(FilterProcessor.java:120)
at com.netflix.zuul.ZuulRunner.route(ZuulRunner.java:96)
at com.netflix.zuul.http.ZuulServlet.route(ZuulServlet.java:116)
at com.netflix.zuul.http.ZuulServlet.service(ZuulServlet.java:81)
at org.springframework.web.servlet.mvc.ServletWrappingController.handleRequestInternal(ServletWrappingController.java:157)
at org.springframework.cloud.netflix.zuul.web.ZuulController.handleRequestInternal(ZuulController.java:43)
at de.codecentric.boot.admin.zuul.OptionsDispatchingZuulController.handleRequest(OptionsDispatchingZuulController.java:52)
at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:50)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
at org.springframework.boot.web.filter.ApplicationContextHeaderFilter.doFilterInternal(ApplicationContextHeaderFilter.java:55)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
at org.springframework.boot.actuate.trace.WebRequestTraceFilter.doFilterInternal(WebRequestTraceFilter.java:105)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:89)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
at org.springframework.boot.actuate.autoconfigure.MetricsFilter.doFilterInternal(MetricsFilter.java:107)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:108)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:784)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:802)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1410)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
客户日志:
INFO 6764 --- [gistrationTask1] d.c.b.a.services.ApplicationRegistrator [register:82] : Application registered itself as {managementUrl=http://localhost:8086, healthUrl=http://localhost:8086/health, serviceUrl=http://localhost:8086, name=democlient, id=8e14fbfe, statusInfo={status=UNKNOWN, timestamp=1477856166713}}
WARN 6764 --- [nio-8248-exec-4] o.s.web.servlet.PageNotFound [handleHttpRequestMethodNotSupported:215] : Request method 'HEAD' not supported
答案 0 :(得分:1)
有同样的问题并通过更新解决了。
它显示问题是Boolean flag3rdCombo = false;
function onchangesecondCombo(){
if (flag3rdCombo){
return;
}
.....
}
版本( Camden RT )在客户端上,显示spring-cloud-dependencies
时出现了一些问题(提到here)。< / p>
升级到 Dalston RT 解决了/hystrix.stream
辅助功能的问题(旁注 - 对于Feign上的hystrix功能,您必须通过/hystrix.stream
明确启用它,花一些时间来发现) 。由于SBA feign.hystrix.enabled=true
依赖于 Dalston ,我还在服务器上将SBA升级为1.5.x
。
现在我可以通过动态解析的hystrix板访问SBAS。
希望有人可以从这个答案中受益。
答案 1 :(得分:0)
有时您在Spring Boot Admin Server(SBAS)的应用程序页面中看不到直接的Hystrix选项卡,您必须转到应用程序页面(来自SBAS)并直接访问(例如http://localhost:8080/#/applications/f78fi52c/hystrix)。
我认为@joshiste当他说:检查客户端上的hystrix.stream是否可以访问管理服务器时
稍后,您将看到hystrix标签 Application page in SBAS
另一件事是,在检查Hystrix选项卡之前,在客户端(实现Hystrix)中为某些指标做出一些请求
答案 2 :(得分:0)
我有一个类似的问题:从Spring Boot 1.x升级到2.x之后,我的Hystrix仪表板从Spring Boot Admin中消失了。原来Hystrix仪表板在Spring Boot Admin 2中是dropped。我已经写了Q&A on how to get it back。