Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
apollo
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
apollo
Commits
13241ea0
Commit
13241ea0
authored
Apr 14, 2016
by
Yiming Liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update pom to support actuator
parent
44375b3b
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
102 additions
and
48 deletions
+102
-48
AdminServiceHealthIndicator.java
...trip/apollo/adminservice/AdminServiceHealthIndicator.java
+32
-0
pom.xml
apollo-biz/pom.xml
+4
-0
AdminService.java
.../main/java/com/ctrip/apollo/biz/service/AdminService.java
+6
-1
ConfigServiceHealthIndicator.java
...ip/apollo/configservice/ConfigServiceHealthIndicator.java
+32
-0
pom.xml
apollo-portal/pom.xml
+28
-47
No files found.
apollo-adminservice/src/main/java/com/ctrip/apollo/adminservice/AdminServiceHealthIndicator.java
0 → 100644
View file @
13241ea0
package
com
.
ctrip
.
apollo
.
adminservice
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.actuate.health.Health
;
import
org.springframework.boot.actuate.health.HealthIndicator
;
import
org.springframework.data.domain.PageRequest
;
import
org.springframework.stereotype.Component
;
import
com.ctrip.apollo.biz.service.AppService
;
@Component
public
class
AdminServiceHealthIndicator
implements
HealthIndicator
{
@Autowired
private
AppService
appService
;
@Override
public
Health
health
()
{
int
errorCode
=
check
();
if
(
errorCode
!=
0
)
{
return
Health
.
down
().
withDetail
(
"Error Code"
,
errorCode
).
build
();
}
return
Health
.
up
().
build
();
}
private
int
check
()
{
PageRequest
pageable
=
new
PageRequest
(
0
,
1
);
appService
.
findAll
(
pageable
);
return
0
;
}
}
apollo-biz/pom.xml
View file @
13241ea0
...
...
@@ -18,6 +18,10 @@
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-actuator
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-data-jpa
</artifactId>
</dependency>
<dependency>
...
...
apollo-biz/src/main/java/com/ctrip/apollo/biz/service/AdminService.java
View file @
13241ea0
package
com
.
ctrip
.
apollo
.
biz
.
service
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.actuate.metrics.CounterService
;
import
org.springframework.stereotype.Service
;
import
com.ctrip.apollo.biz.entity.App
;
...
...
@@ -27,8 +28,12 @@ public class AdminService {
@Autowired
private
ClusterRepository
clusterRepository
;
@Autowired
private
CounterService
counter
;
public
App
createNewApp
(
String
appId
,
String
appName
,
String
ownerName
,
String
ownerEmail
,
String
namespace
)
{
counter
.
increment
(
"admin.createNewApp.start"
);
App
app
=
new
App
();
app
.
setAppId
(
appId
);
app
.
setName
(
appName
);
...
...
@@ -51,7 +56,7 @@ public class AdminService {
ns
.
setClusterName
(
cluster
.
getName
());
ns
.
setNamespaceName
(
namespace
);
namespaceRepository
.
save
(
ns
);
counter
.
increment
(
"admin.createNewApp.success"
);
return
app
;
}
}
apollo-configservice/src/main/java/com/ctrip/apollo/configservice/ConfigServiceHealthIndicator.java
0 → 100644
View file @
13241ea0
package
com
.
ctrip
.
apollo
.
configservice
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.actuate.health.Health
;
import
org.springframework.boot.actuate.health.HealthIndicator
;
import
org.springframework.data.domain.PageRequest
;
import
org.springframework.stereotype.Component
;
import
com.ctrip.apollo.biz.service.AppService
;
@Component
public
class
ConfigServiceHealthIndicator
implements
HealthIndicator
{
@Autowired
private
AppService
appService
;
@Override
public
Health
health
()
{
int
errorCode
=
check
();
if
(
errorCode
!=
0
)
{
return
Health
.
down
().
withDetail
(
"Error Code"
,
errorCode
).
build
();
}
return
Health
.
up
().
build
();
}
private
int
check
()
{
PageRequest
pageable
=
new
PageRequest
(
0
,
1
);
appService
.
findAll
(
pageable
);
return
0
;
}
}
apollo-portal/pom.xml
View file @
13241ea0
<?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/maven-v4_0_0.xsd"
>
<parent>
<groupId>
com.ctrip.apollo
</groupId>
<artifactId>
apollo
</artifactId>
<version>
0.0.1-SNAPSHOT
</version>
<relativePath>
../pom.xml
</relativePath>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
apollo-portal
</artifactId>
<name>
Apollo Portal
</name>
<dependencies>
<dependency>
<groupId>
com.ctrip.apollo
</groupId>
<artifactId>
apollo-core
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-eureka
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-devtools
</artifactId>
<optional>
true
</optional>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-data-jpa
</artifactId>
</dependency>
<dependency>
<groupId>
com.h2database
</groupId>
<artifactId>
h2
</artifactId>
</dependency>
<dependency>
<groupId>
mysql
</groupId>
<artifactId>
mysql-connector-java
</artifactId>
<scope>
runtime
</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
</plugin>
</plugins>
</build>
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
>
<parent>
<groupId>
com.ctrip.apollo
</groupId>
<artifactId>
apollo
</artifactId>
<version>
0.0.1-SNAPSHOT
</version>
<relativePath>
../pom.xml
</relativePath>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
apollo-portal
</artifactId>
<name>
Apollo Portal
</name>
<dependencies>
<dependency>
<groupId>
com.ctrip.apollo
</groupId>
<artifactId>
apollo-core
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
</plugin>
</plugins>
</build>
</project>
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