Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
spring-cloud-netflix
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
openSource
spring-cloud-netflix
Commits
4ca9d5f7
Commit
4ca9d5f7
authored
Sep 02, 2014
by
Dave Syer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Break up hystrix dashboard
parent
cf96d6dd
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
76 additions
and
24 deletions
+76
-24
pom.xml
pom.xml
+15
-0
HystrixConfiguration.java
...framework/cloud/netflix/hystrix/HystrixConfiguration.java
+1
-1
HystrixDashboardConfiguration.java
.../cloud/netflix/hystrix/HystrixDashboardConfiguration.java
+28
-12
HystrixStreamEndpoint.java
...ramework/cloud/netflix/hystrix/HystrixStreamEndpoint.java
+3
-1
EnableHystrixDashboard.java
...d/netflix/hystrix/annotations/EnableHystrixDashboard.java
+21
-0
HystrixDashboardApplication.java
...ng/cloud/netflix/hystrix/HystrixDashboardApplication.java
+6
-8
application.yml
...-cloud-netflix-hystrix/src/main/resources/application.yml
+0
-1
Application.java
...c/main/java/io/spring/cloud/netflix/zuul/Application.java
+2
-1
No files found.
pom.xml
View file @
4ca9d5f7
...
...
@@ -159,6 +159,21 @@
<artifactId>
jersey-server
</artifactId>
<version>
1.13
</version>
</dependency>
<dependency>
<groupId>
org.webjars
</groupId>
<artifactId>
d3js
</artifactId>
<version>
3.4.11
</version>
</dependency>
<dependency>
<groupId>
org.webjars
</groupId>
<artifactId>
jquery
</artifactId>
<version>
2.1.1
</version>
</dependency>
<dependency>
<groupId>
org.webjars
</groupId>
<artifactId>
bootstrap
</artifactId>
<version>
3.2.0
</version>
</dependency>
</dependencies>
</dependencyManagement>
...
...
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/hystrix/HystrixConfiguration.java
View file @
4ca9d5f7
package
org
.
springframework
.
cloud
.
netflix
.
hystrix
;
import
com.netflix.hystrix.contrib.javanica.aop.aspectj.HystrixCommandAspect
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
...
...
@@ -8,7 +9,6 @@ import org.springframework.context.annotation.ImportAware;
import
org.springframework.core.annotation.AnnotationAttributes
;
import
org.springframework.core.type.AnnotationMetadata
;
import
org.springframework.cloud.netflix.hystrix.annotations.EnableHystrix
;
import
org.springframework.cloud.netflix.endpoint.HystrixStreamEndpoint
;
import
org.springframework.util.Assert
;
import
org.springframework.util.CollectionUtils
;
...
...
spring-cloud-netflix-
hystrix/src/main/java/io/spring/cloud/netflix/hystrix/stream/ProxyStreamServlet
.java
→
spring-cloud-netflix-
core/src/main/java/org/springframework/cloud/netflix/hystrix/HystrixDashboardConfiguration
.java
View file @
4ca9d5f7
package
io
.
spring
.
cloud
.
netflix
.
hystrix
.
stream
;
package
org
.
springframework
.
cloud
.
netflix
.
hystrix
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.OutputStream
;
import
java.util.Map
;
import
javax.servlet.ServletException
;
import
javax.servlet.http.HttpServlet
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.apache.http.Header
;
import
org.apache.http.HttpResponse
;
...
...
@@ -11,21 +21,27 @@ import org.apache.http.params.HttpConnectionParams;
import
org.apache.http.params.HttpParams
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
javax.servlet.ServletException
;
import
javax.servlet.http.HttpServlet
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.OutputStream
;
import
java.util.Map
;
import
org.springframework.boot.context.embedded.ServletRegistrationBean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
/**
* @author Dave Syer
*/
@SuppressWarnings
(
"deprecation"
)
@Configuration
public
class
HystrixDashboardConfiguration
{
@Bean
public
ServletRegistrationBean
proxyStreamServlet
()
{
return
new
ServletRegistrationBean
(
new
ProxyStreamServlet
(),
"/proxy.stream"
);
}
/**
* Proxy an EventStream request (data.stream via proxy.stream) since EventStream does not yet support CORS (https://bugs.webkit.org/show_bug.cgi?id=61862)
* so that a UI can request a stream from a different server.
*/
publ
ic
class
ProxyStreamServlet
extends
HttpServlet
{
public
stat
ic
class
ProxyStreamServlet
extends
HttpServlet
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
ProxyStreamServlet
.
class
);
...
...
@@ -55,7 +71,6 @@ public class ProxyStreamServlet extends HttpServlet {
if
(
origin
.
contains
(
"?"
))
{
hasFirstParameter
=
true
;
}
@SuppressWarnings
(
"unchecked"
)
Map
<
String
,
String
[]>
params
=
request
.
getParameterMap
();
for
(
String
key
:
params
.
keySet
())
{
if
(!
key
.
equals
(
"origin"
))
{
...
...
@@ -149,4 +164,5 @@ public class ProxyStreamServlet extends HttpServlet {
threadSafeConnectionManager
.
setMaxTotal
(
400
);
}
}
}
}
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/
endpoint
/HystrixStreamEndpoint.java
→
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/
hystrix
/HystrixStreamEndpoint.java
View file @
4ca9d5f7
package
org
.
springframework
.
cloud
.
netflix
.
endpoint
;
package
org
.
springframework
.
cloud
.
netflix
.
hystrix
;
import
org.springframework.cloud.netflix.endpoint.ServletWrappingEndpoint
;
import
com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet
;
...
...
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/hystrix/annotations/EnableHystrixDashboard.java
0 → 100644
View file @
4ca9d5f7
package
org
.
springframework
.
cloud
.
netflix
.
hystrix
.
annotations
;
import
java.lang.annotation.Documented
;
import
java.lang.annotation.ElementType
;
import
java.lang.annotation.Retention
;
import
java.lang.annotation.RetentionPolicy
;
import
java.lang.annotation.Target
;
import
org.springframework.cloud.netflix.hystrix.HystrixDashboardConfiguration
;
import
org.springframework.context.annotation.Import
;
/**
* Created by sgibb on 6/19/14.
*/
@Target
(
ElementType
.
TYPE
)
@Retention
(
RetentionPolicy
.
RUNTIME
)
@Documented
@Import
(
HystrixDashboardConfiguration
.
class
)
public
@interface
EnableHystrixDashboard
{
}
\ No newline at end of file
spring-cloud-netflix-hystrix/src/main/java/io/spring/cloud/netflix/hystrix/Application.java
→
spring-cloud-netflix-hystrix/src/main/java/io/spring/cloud/netflix/hystrix/
HystrixDashboard
Application.java
View file @
4ca9d5f7
package
io
.
spring
.
cloud
.
netflix
.
hystrix
;
import
io.spring.cloud.netflix.hystrix.stream.MockStreamServlet
;
import
io.spring.cloud.netflix.hystrix.stream.ProxyStreamServlet
;
import
org.springframework.boot.autoconfigure.EnableAutoConfiguration
;
import
org.springframework.boot.builder.SpringApplicationBuilder
;
import
org.springframework.boot.context.embedded.ServletRegistrationBean
;
import
org.springframework.boot.context.web.SpringBootServletInitializer
;
import
org.springframework.cloud.netflix.hystrix.annotations.EnableHystrixDashboard
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.ComponentScan
;
import
org.springframework.context.annotation.Configuration
;
...
...
@@ -15,16 +16,17 @@ import org.springframework.context.annotation.Configuration;
*/
@Configuration
@ComponentScan
@EnableHystrixDashboard
@EnableAutoConfiguration
public
class
Application
extends
SpringBootServletInitializer
{
public
class
HystrixDashboard
Application
extends
SpringBootServletInitializer
{
@Override
protected
SpringApplicationBuilder
configure
(
SpringApplicationBuilder
application
)
{
return
application
.
sources
(
Application
.
class
).
web
(
true
);
return
application
.
sources
(
HystrixDashboard
Application
.
class
).
web
(
true
);
}
public
static
void
main
(
String
[]
args
)
{
new
SpringApplicationBuilder
(
Application
.
class
).
web
(
true
).
run
(
args
);
new
SpringApplicationBuilder
(
HystrixDashboard
Application
.
class
).
web
(
true
).
run
(
args
);
}
@Bean
...
...
@@ -32,8 +34,4 @@ public class Application extends SpringBootServletInitializer {
return
new
ServletRegistrationBean
(
new
MockStreamServlet
(),
"/mock.stream"
);
}
@Bean
public
ServletRegistrationBean
proxyStreamServlet
()
{
return
new
ServletRegistrationBean
(
new
ProxyStreamServlet
(),
"/proxy.stream"
);
}
}
spring-cloud-netflix-hystrix/src/main/resources/application.yml
View file @
4ca9d5f7
...
...
@@ -9,7 +9,6 @@ endpoints:
server
:
port
:
7979
context-path
:
/hystrix-dashboard
logging
:
level
:
INFO
...
...
spring-cloud-netflix-zuul/src/main/java/io/spring/cloud/netflix/zuul/Application.java
View file @
4ca9d5f7
package
io
.
spring
.
cloud
.
netflix
.
zuul
;
import
com.netflix.zuul.context.ContextLifecycleFilter
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.EnableAutoConfiguration
;
import
org.springframework.boot.context.embedded.FilterRegistrationBean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.ComponentScan
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.cloud.netflix.
endpoint
.HystrixStreamEndpoint
;
import
org.springframework.cloud.netflix.
hystrix
.HystrixStreamEndpoint
;
import
org.springframework.cloud.netflix.zuul.Routes
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment