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
7423decc
Commit
7423decc
authored
Dec 15, 2014
by
Spencer Gibb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated EurekaHealthIndicator to implement the new DiscoveryHealthIndicator
fixes gh-98
parent
70648b0e
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
33 additions
and
7 deletions
+33
-7
EurekaDiscoveryClient.java
...framework/cloud/netflix/eureka/EurekaDiscoveryClient.java
+9
-2
EurekaHealthIndicator.java
...framework/cloud/netflix/eureka/EurekaHealthIndicator.java
+7
-2
ApplicationTests.java
...amework/cloud/netflix/eureka/sample/ApplicationTests.java
+1
-1
EurekaSampleApplication.java
.../cloud/netflix/eureka/sample/EurekaSampleApplication.java
+8
-2
SidecarApplication.java
...ngframework/cloud/netflix/sidecar/SidecarApplication.java
+8
-0
No files found.
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/eureka/EurekaDiscoveryClient.java
View file @
7423decc
...
...
@@ -20,13 +20,20 @@ import static com.google.common.collect.Iterables.*;
*/
public
class
EurekaDiscoveryClient
implements
DiscoveryClient
{
@Autowired
public
static
final
String
DESCRIPTION
=
"Spring Cloud Eureka Discovery Client"
;
@Autowired
private
EurekaInstanceConfigBean
config
;
@Autowired
private
com
.
netflix
.
discovery
.
DiscoveryClient
discovery
;
@Override
@Override
public
String
description
()
{
return
DESCRIPTION
;
}
@Override
public
ServiceInstance
getLocalServiceInstance
()
{
return
new
ServiceInstance
()
{
@Override
...
...
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/eureka/EurekaHealthIndicator.java
View file @
7423decc
...
...
@@ -21,7 +21,6 @@ import java.util.Map;
import
org.springframework.boot.actuate.health.Health
;
import
org.springframework.boot.actuate.health.Health.Builder
;
import
org.springframework.boot.actuate.health.HealthIndicator
;
import
org.springframework.boot.actuate.health.Status
;
import
org.springframework.boot.actuate.metrics.Metric
;
import
org.springframework.boot.actuate.metrics.reader.MetricReader
;
...
...
@@ -30,12 +29,13 @@ import com.netflix.appinfo.EurekaInstanceConfig;
import
com.netflix.discovery.DiscoveryClient
;
import
com.netflix.discovery.shared.Application
;
import
com.netflix.discovery.shared.Applications
;
import
org.springframework.cloud.client.discovery.DiscoveryHealthIndicator
;
/**
* @author Dave Syer
*
*/
public
class
EurekaHealthIndicator
implements
HealthIndicator
{
public
class
EurekaHealthIndicator
implements
Discovery
HealthIndicator
{
private
EurekaInstanceConfig
instanceConfig
;
...
...
@@ -54,6 +54,11 @@ public class EurekaHealthIndicator implements HealthIndicator {
}
@Override
public
String
getName
()
{
return
"eureka"
;
}
@Override
public
Health
health
()
{
Builder
builder
=
Health
.
unknown
();
Status
status
=
getStatus
(
builder
);
...
...
spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/eureka/sample/ApplicationTests.java
View file @
7423decc
...
...
@@ -9,7 +9,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import
org.springframework.test.context.web.WebAppConfiguration
;
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@SpringApplicationConfiguration
(
classes
=
Application
.
class
)
@SpringApplicationConfiguration
(
classes
=
EurekaSample
Application
.
class
)
@WebAppConfiguration
@IntegrationTest
(
"server.port=0"
)
@DirtiesContext
...
...
spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/eureka/sample/Application.java
→
spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/eureka/sample/
EurekaSample
Application.java
View file @
7423decc
...
...
@@ -2,6 +2,7 @@ package org.springframework.cloud.netflix.eureka.sample;
import
com.netflix.appinfo.HealthCheckHandler
;
import
com.netflix.appinfo.InstanceInfo
;
import
org.springframework.boot.actuate.metrics.repository.InMemoryMetricRepository
;
import
org.springframework.boot.autoconfigure.EnableAutoConfiguration
;
import
org.springframework.boot.builder.SpringApplicationBuilder
;
import
org.springframework.cloud.client.discovery.EnableDiscoveryClient
;
...
...
@@ -16,7 +17,12 @@ import org.springframework.web.bind.annotation.RestController;
@EnableAutoConfiguration
@RestController
@EnableDiscoveryClient
public
class
Application
{
public
class
EurekaSampleApplication
{
@Bean
public
InMemoryMetricRepository
inMemoryMetricRepository
()
{
return
new
InMemoryMetricRepository
();
}
@Bean
public
HealthCheckHandler
healthCheckHandler
()
{
...
...
@@ -34,7 +40,7 @@ public class Application {
}
public
static
void
main
(
String
[]
args
)
{
new
SpringApplicationBuilder
(
Application
.
class
).
web
(
true
).
run
(
args
);
new
SpringApplicationBuilder
(
EurekaSample
Application
.
class
).
web
(
true
).
run
(
args
);
}
}
spring-cloud-netflix-sidecar/src/test/java/org/springframework/cloud/netflix/sidecar/SidecarApplication.java
View file @
7423decc
package
org
.
springframework
.
cloud
.
netflix
.
sidecar
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.actuate.metrics.repository.InMemoryMetricRepository
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.web.bind.annotation.RestController
;
@SpringBootApplication
@EnableSidecar
@RestController
public
class
SidecarApplication
{
@Bean
public
InMemoryMetricRepository
inMemoryMetricRepository
()
{
return
new
InMemoryMetricRepository
();
}
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
SidecarApplication
.
class
,
args
);
}
...
...
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