Skip to content

Commit c62e919

Browse files
committed
Add comment and pretty
1 parent 5e24311 commit c62e919

File tree

19 files changed

+70
-17
lines changed

19 files changed

+70
-17
lines changed

api-gateway/pom.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,16 @@
5454
<artifactId>junit</artifactId>
5555
<scope>test</scope>
5656
</dependency>
57+
<!-- <dependency>-->
58+
<!-- <groupId>io.micrometer</groupId>-->
59+
<!-- <artifactId>micrometer-registry-prometheus</artifactId>-->
60+
<!-- <version>1.5.5</version>-->
61+
<!-- </dependency>-->
62+
<dependency>
63+
<groupId>io.micrometer</groupId>
64+
<artifactId>micrometer-registry-prometheus</artifactId>
65+
<scope>runtime</scope>
66+
</dependency>
5767

5868
</dependencies>
5969
<dependencyManagement>

api-gateway/src/main/java/com/cevher/ms/cloud/gateway/APIGatewayApplication.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
@EnableEurekaClient
1010
@EnableHystrix
1111
public class APIGatewayApplication {
12-
12+
// We used @EnableEurekaServer and @EnableHystrix
13+
// See application.yml and bootstrap.yml
1314
public static void main(String[] args) {
1415
SpringApplication.run(APIGatewayApplication.class, args);
1516
}

api-gateway/src/main/java/com/cevher/ms/cloud/gateway/FallBackController.java renamed to api-gateway/src/main/java/com/cevher/ms/cloud/gateway/FallBackResource.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,34 @@
33
import org.springframework.web.bind.annotation.GetMapping;
44
import org.springframework.web.bind.annotation.RestController;
55

6+
/**
7+
* We use FallBack URL for Circuit Breaker
8+
*/
69
@RestController
7-
public class FallBackController {
10+
public class FallBackResource {
811

12+
/**
13+
* For User Microservices CircuitBreaker
14+
* @return FallBack Message
15+
*/
916
@GetMapping("/userServiceFallBack")
1017
public String userServiceFallBack(){
1118
return "FallBack User Controller!.. User Service is taking longer then Expected.";
1219
}
1320

21+
/**
22+
* For Department Microservices CircuitBreaker
23+
* @return FallBack Message
24+
*/
1425
@GetMapping("/departmentServiceFallBack")
1526
public String departmentServiceFallBack(){
1627
return "FallBack Department Controller!.. Department Service is taking longer then Expected.";
1728
}
29+
30+
/**
31+
* For Task Microservices CircuitBreaker
32+
* @return FallBack Message
33+
*/
1834
@GetMapping("/taskServiceFallBack")
1935
public String taskServiceFallBack(){
2036
return "FallBack Task Controller!.. Task Service is taking longer then Expected.";

api-gateway/src/main/resources/application.properties

Lines changed: 0 additions & 1 deletion
This file was deleted.

api-gateway/src/main/resources/application.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,15 @@ hystrix:
4444
timeoutInMiliseconds: 4000
4545

4646
management:
47+
metrics:
48+
tags:
49+
application: MonitoringMicroservices
4750
endpoints:
51+
health:
52+
show-detail: always
4853
web:
4954
exposure:
50-
include: hystrix.stream
55+
include: hystrix.stream, prometheus
56+
5157

5258

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
global:
2+
scrape_interval: 15s
3+
4+
scrape_configs:
5+
- job_name: 'prometheus'
6+
scrape_interval: 5s
7+
8+
static_configs:
9+
- targets: [ 'localhost:9090' ]
10+
11+
- job_name: 'spring-actuator'
12+
metrics_path: '/actuator/prometheus'
13+
scrape_interval: 5s
14+
static_configs:
15+
- targets: [ '192.168.0.9:8080' ]
16+
# docker pull prom/prometheus
17+
# docker run -d -p 9090:9090 -v <PATH_TO_prometheus.yml_FILE>:/etc/prometheus/prometheus.yml prom/prometheus
18+
# docker run -d -p 3000:3000 grafana/grafana

config-server/src/main/java/com/cevher/ms/config/ConfigServerApplication.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
@EnableEurekaClient
1010
@EnableConfigServer
1111
public class ConfigServerApplication {
12-
12+
// We used @EnableEurekaClient and @EnableConfigServer
13+
// See application.yml
1314
public static void main(String[] args) {
1415
SpringApplication.run(ConfigServerApplication.class, args);
1516
}
16-
1717
}

config-server/src/main/resources/application.properties

Lines changed: 0 additions & 1 deletion
This file was deleted.

department-service/src/main/java/com/cevher/ms/department/DepartmentServiceApplication.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
@SpringBootApplication
88
@EnableEurekaClient
99
public class DepartmentServiceApplication {
10-
1110
public static void main(String[] args) {
1211
SpringApplication.run(DepartmentServiceApplication.class, args);
1312
}

department-service/src/main/resources/application.properties

Whitespace-only changes.

0 commit comments

Comments
 (0)