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
c5df6ad5
Unverified
Commit
c5df6ad5
authored
Jun 13, 2018
by
Spencer Gibb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Auto-configures HystrixMetricsBinder
fixes gh-3007
parent
6cb02576
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
12 deletions
+37
-12
HystrixAutoConfiguration.java
...ework/cloud/netflix/hystrix/HystrixAutoConfiguration.java
+16
-10
HystrixConfigurationTests.java
...work/cloud/netflix/hystrix/HystrixConfigurationTests.java
+21
-2
No files found.
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/hystrix/HystrixAutoConfiguration.java
View file @
c5df6ad5
...
@@ -17,15 +17,24 @@
...
@@ -17,15 +17,24 @@
package
org
.
springframework
.
cloud
.
netflix
.
hystrix
;
package
org
.
springframework
.
cloud
.
netflix
.
hystrix
;
import
com.netflix.hystrix.Hystrix
;
import
com.netflix.hystrix.contrib.javanica.aop.aspectj.HystrixCommandAspect
;
import
com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet
;
import
com.netflix.hystrix.metric.consumer.HystrixDashboardStream
;
import
com.netflix.hystrix.serial.SerialHystrixDashboardData
;
import
io.micrometer.core.instrument.binder.hystrix.HystrixMetricsBinder
;
import
org.reactivestreams.Publisher
;
import
org.reactivestreams.Publisher
;
import
rx.Observable
;
import
rx.RxReactiveStreams
;
import
org.springframework.boot.actuate.autoconfigure.endpoint.condition.ConditionalOnEnabledEndpoint
;
import
org.springframework.boot.actuate.autoconfigure.endpoint.condition.ConditionalOnEnabledEndpoint
;
import
org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator
;
import
org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator
;
import
org.springframework.boot.actuate.autoconfigure.health.HealthIndicatorAutoConfiguration
;
import
org.springframework.boot.actuate.autoconfigure.health.HealthIndicatorAutoConfiguration
;
import
org.springframework.boot.actuate.health.Health
;
import
org.springframework.boot.actuate.health.HealthIndicator
;
import
org.springframework.boot.actuate.health.HealthIndicator
;
import
org.springframework.boot.autoconfigure.AutoConfigureAfter
;
import
org.springframework.boot.autoconfigure.AutoConfigureAfter
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnBean
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnBean
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnClass
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnClass
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.cloud.client.actuator.HasFeatures
;
import
org.springframework.cloud.client.actuator.HasFeatures
;
...
@@ -33,18 +42,9 @@ import org.springframework.context.annotation.Bean;
...
@@ -33,18 +42,9 @@ import org.springframework.context.annotation.Bean;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.web.reactive.DispatcherHandler
;
import
org.springframework.web.reactive.DispatcherHandler
;
import
com.netflix.hystrix.Hystrix
;
import
com.netflix.hystrix.contrib.javanica.aop.aspectj.HystrixCommandAspect
;
import
com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet
;
import
com.netflix.hystrix.metric.consumer.HystrixDashboardStream
;
import
com.netflix.hystrix.serial.SerialHystrixDashboardData
;
import
static
org
.
springframework
.
boot
.
autoconfigure
.
condition
.
ConditionalOnWebApplication
.
Type
.
REACTIVE
;
import
static
org
.
springframework
.
boot
.
autoconfigure
.
condition
.
ConditionalOnWebApplication
.
Type
.
REACTIVE
;
import
static
org
.
springframework
.
boot
.
autoconfigure
.
condition
.
ConditionalOnWebApplication
.
Type
.
SERVLET
;
import
static
org
.
springframework
.
boot
.
autoconfigure
.
condition
.
ConditionalOnWebApplication
.
Type
.
SERVLET
;
import
rx.Observable
;
import
rx.RxReactiveStreams
;
/**
/**
* Auto configuration for Hystrix.
* Auto configuration for Hystrix.
*
*
...
@@ -62,6 +62,12 @@ public class HystrixAutoConfiguration {
...
@@ -62,6 +62,12 @@ public class HystrixAutoConfiguration {
return
new
HystrixHealthIndicator
();
return
new
HystrixHealthIndicator
();
}
}
@Bean
@ConditionalOnProperty
(
value
=
"management.metrics.hystrix.enabled"
,
matchIfMissing
=
true
)
public
HystrixMetricsBinder
hystrixMetricsBinder
()
{
return
new
HystrixMetricsBinder
();
}
/**
/**
* See original {@link org.springframework.boot.actuate.autoconfigure.jolokia.JolokiaEndpointAutoConfiguration}
* See original {@link org.springframework.boot.actuate.autoconfigure.jolokia.JolokiaEndpointAutoConfiguration}
*/
*/
...
...
spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/hystrix/HystrixConfigurationTests.java
View file @
c5df6ad5
...
@@ -16,10 +16,15 @@
...
@@ -16,10 +16,15 @@
package
org
.
springframework
.
cloud
.
netflix
.
hystrix
;
package
org
.
springframework
.
cloud
.
netflix
.
hystrix
;
import
com.netflix.hystrix.contrib.javanica.aop.aspectj.HystrixCommandAspect
;
import
io.micrometer.core.instrument.binder.MeterBinder
;
import
io.micrometer.core.instrument.binder.hystrix.HystrixMetricsBinder
;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.springframework.boot.test.context.runner.ApplicationContextRunner
;
import
com.netflix.hystrix.contrib.javanica.aop.aspectj.HystrixCommandAspect
;
import
org.springframework.boot.SpringBootConfiguration
;
import
org.springframework.boot.autoconfigure.EnableAutoConfiguration
;
import
org.springframework.boot.test.context.runner.ApplicationContextRunner
;
import
org.springframework.boot.test.context.runner.WebApplicationContextRunner
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
...
@@ -38,4 +43,17 @@ public class HystrixConfigurationTests {
...
@@ -38,4 +43,17 @@ public class HystrixConfigurationTests {
});
});
}
}
@Test
public
void
hystrixMetricsConfigured
()
{
new
WebApplicationContextRunner
()
.
withUserConfiguration
(
TestApp
.
class
)
.
run
(
c
->
{
assertThat
(
c
.
getBeansOfType
(
MeterBinder
.
class
).
values
())
.
hasAtLeastOneElementOfType
(
HystrixMetricsBinder
.
class
);
});
}
@SpringBootConfiguration
@EnableAutoConfiguration
protected
static
class
TestApp
{}
}
}
\ No newline at end of file
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