Commit e04775db authored by mohammad.salama's avatar mohammad.salama

All Integrated, Logs are Fixed, Log Files Created and Connected to ELK, Load...

All Integrated, Logs are Fixed, Log Files Created and Connected to ELK, Load Balancing Tested, Dependencies are Correct with no conflicts
parent f8b023f8
......@@ -2,6 +2,7 @@
<project version="4">
<component name="CompilerConfiguration">
<annotationProcessing>
<profile default="true" name="Default" enabled="true" />
<profile name="Maven default annotation processors profile" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
......
......@@ -36,6 +36,18 @@
<artifactId>micrometer-registry-prometheus</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-observation</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-tracing-bridge-brave</artifactId>
</dependency>
<dependency>
<groupId>io.zipkin.reporter2</groupId>
<artifactId>zipkin-reporter-brave</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-gateway</artifactId>
......
......@@ -10,18 +10,15 @@ public class FallbackMethod {
@RequestMapping("user-fallback")
public String getCatalogFallback(){
//it can be an empty list of books or last cash result
return "User Service Service is temporary unavailable, Please Try Again Later";
}
@RequestMapping("database-fallback")
public String getMovieFallback(){
//it can be an empty list of books or last cash result
return "Database Service is temporary unavailable, Please Try Again Later";
}
@RequestMapping("weather-fallback")
public String getRatingFallback(){
//it can be an empty list of books or last cash result
return "Weather Service is temporary unavailable, Please Try Again Later";
}
}
......@@ -37,7 +37,8 @@ spring:
args:
name: weatherCircuitBreaker
fallbackUri: forward:/weather-fallback
zipkin:
baseurl: http://localhost:9411
eureka:
client:
......@@ -57,6 +58,9 @@ management:
endpoint:
health:
show-details: always
tracing:
sampling:
probability: 1.0
resilience4j:
circuitbreaker:
......@@ -70,4 +74,8 @@ resilience4j:
waitDurationInOpenState: 10s
permittedNumberOfCallsInHalfOpenState: 3
slidingWindowSize: 10
slidingWindowType: COUNT_BASED
\ No newline at end of file
slidingWindowType: COUNT_BASED
logging:
pattern:
level: ${spring.application.name:},%X{traceId:-},%X{spanId:-}
......@@ -37,7 +37,8 @@ spring:
args:
name: weatherCircuitBreaker
fallbackUri: forward:/weather-fallback
zipkin:
baseurl: http://localhost:9411
eureka:
client:
......@@ -57,6 +58,9 @@ management:
endpoint:
health:
show-details: always
tracing:
sampling:
probability: 1.0
resilience4j:
circuitbreaker:
......@@ -70,4 +74,8 @@ resilience4j:
waitDurationInOpenState: 10s
permittedNumberOfCallsInHalfOpenState: 3
slidingWindowSize: 10
slidingWindowType: COUNT_BASED
\ No newline at end of file
slidingWindowType: COUNT_BASED
logging:
pattern:
level: ${spring.application.name:},%X{traceId:-},%X{spanId:-}
......@@ -22,6 +22,18 @@
<version>0.0.1-SNAPSHOT</version>
<name>DataBase</name>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-tracing-bridge-brave</artifactId>
</dependency>
<dependency>
<groupId>io.zipkin.reporter2</groupId>
<artifactId>zipkin-reporter-brave</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
......@@ -35,6 +47,16 @@
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<dependency>
<groupId>net.logstash.logback</groupId>
<artifactId>logstash-logback-encoder</artifactId>
<version>7.2</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
......@@ -42,6 +64,8 @@
<scope>compile</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
......@@ -51,36 +75,36 @@
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>2.0.9</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.4.11</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>1.4.11</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.9</version>
</dependency>
<dependency>
<groupId>net.logstash.logback</groupId>
<artifactId>logstash-logback-encoder</artifactId>
<version>7.2</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.slf4j</groupId>-->
<!-- <artifactId>slf4j-api</artifactId>-->
<!-- <version>2.0.9</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>ch.qos.logback</groupId>-->
<!-- <artifactId>logback-classic</artifactId>-->
<!-- <version>1.4.11</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>ch.qos.logback</groupId>-->
<!-- <artifactId>logback-core</artifactId>-->
<!-- <version>1.4.11</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>com.google.code.gson</groupId>-->
<!-- <artifactId>gson</artifactId>-->
<!-- <version>2.8.9</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>net.logstash.logback</groupId>-->
<!-- <artifactId>logstash-logback-encoder</artifactId>-->
<!-- <version>7.2</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.projectlombok</groupId>-->
<!-- <artifactId>lombok</artifactId>-->
<!-- <optional>true</optional>-->
<!-- </dependency>-->
</dependencies>
</dependencyManagement>
......
server.port=8081
spring.application.name=database-service
eureka.client.serviceUrl.defaultZone= ${EUREKA_URL:http://localhost:8761/eureka/}
\ No newline at end of file
eureka.client.serviceUrl.defaultZone= ${EUREKA_URL:http://localhost:8761/eureka/}
#Zipkin
spring.zipkin.baseurl= localhost:9411
# All traces should be sent to latency analysis tool, default sampling probability is 10%
management.tracing.sampling.probability=1.0
## traceID and spanId are predefined MDC keys - we want the logs to include them
logging.pattern.level=%5p [${spring.application.name:},%X{traceId:-},%X{spanId:-}]
......@@ -10,9 +10,9 @@
</appender>
<appender name="FILE"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>logs/catalog.log</file>
<file>logs/DataBase.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>logs/catalog.%d{yyyy-MM-dd}.log</fileNamePattern>
<fileNamePattern>logs/DataBase.%d{yyyy-MM-dd}.log</fileNamePattern>
<maxHistory>10</maxHistory>
<totalSizeCap>1GB</totalSizeCap>
</rollingPolicy>
......
server.port=8081
spring.application.name=database-service
eureka.client.serviceUrl.defaultZone= ${EUREKA_URL:http://localhost:8761/eureka/}
\ No newline at end of file
eureka.client.serviceUrl.defaultZone= ${EUREKA_URL:http://localhost:8761/eureka/}
#Zipkin
spring.zipkin.baseurl= localhost:9411
# All traces should be sent to latency analysis tool, default sampling probability is 10%
management.tracing.sampling.probability=1.0
## traceID and spanId are predefined MDC keys - we want the logs to include them
logging.pattern.level=%5p [${spring.application.name:},%X{traceId:-},%X{spanId:-}]
<configuration>
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>INFO</level>
</filter>
<encoder>
<pattern>%d{HH:mm:ss.SSS} %-5level %msg%n</pattern>
<charset>utf8</charset>
</encoder>
</appender>
<appender name="FILE"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>logs/DataBase.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>logs/DataBase.%d{yyyy-MM-dd}.log</fileNamePattern>
<maxHistory>10</maxHistory>
<totalSizeCap>1GB</totalSizeCap>
</rollingPolicy>
<encoder>
<pattern>%d{HH:mm:ss.SSS} %-5level %msg%n</pattern>
</encoder>
</appender>
<appender name="STASH" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
<destination>localhost:5000</destination>
<encoder
class="net.logstash.logback.encoder.LoggingEventCompositeJsonEncoder">
<providers>
<mdc />
<context />
<logLevel />
<loggerName />
<pattern>
<pattern>
{
"appName": "DataBase-service"
}
</pattern>
</pattern>
<threadName />
<message />
<logstashMarkers />
<stackTrace />
</providers>
</encoder>
</appender>
<root level="INFO">
<appender-ref ref="CONSOLE" />
<appender-ref ref="FILE" />
<appender-ref ref="STASH" />
</root>
</configuration>
\ No newline at end of file
......@@ -22,6 +22,18 @@
<spring-cloud.version>2022.0.0</spring-cloud.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-tracing-bridge-brave</artifactId>
</dependency>
<dependency>
<groupId>io.zipkin.reporter2</groupId>
<artifactId>zipkin-reporter-brave</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
......
package org.example;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;
@Configuration
public class RestTemplateConfig
{
@Bean
@LoadBalanced
public RestTemplate restTemplate(RestTemplateBuilder restTemplateBuilder)
{
return restTemplateBuilder.build();
}
}
......@@ -3,6 +3,7 @@ package org.example;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
......@@ -13,6 +14,7 @@ import java.util.ArrayList;
import java.util.List;
@Slf4j
@Component
@RestController
@RequestMapping("/users")
public class UserService
......
......@@ -17,11 +17,4 @@ public class UserServiceApp
SpringApplication.run(UserServiceApp.class, args);
}
@Bean
@LoadBalanced
public RestTemplate getRestTemplate()
{
return new RestTemplate();
}
}
\ No newline at end of file
server.port=8082
spring.main.allow-bean-definition-overriding=true
spring.application.name=user-service
eureka.client.serviceUrl.defaultZone= ${EUREKA_URL:http://localhost:8761/eureka/}
\ No newline at end of file
eureka.client.serviceUrl.defaultZone= ${EUREKA_URL:http://localhost:8761/eureka/}
#Zipkin
spring.zipkin.baseurl= localhost:9411
# All traces should be sent to latency analysis tool, default sampling probability is 10%
management.tracing.sampling.probability=1.0
## traceID and spanId are predefined MDC keys - we want the logs to include them
logging.pattern.level=%5p [${spring.application.name:},%X{traceId:-},%X{spanId:-}]
......@@ -10,9 +10,9 @@
</appender>
<appender name="FILE"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>logs/catalog.log</file>
<file>logs/UserService.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>logs/catalog.%d{yyyy-MM-dd}.log</fileNamePattern>
<fileNamePattern>logs/UserService.%d{yyyy-MM-dd}.log</fileNamePattern>
<maxHistory>10</maxHistory>
<totalSizeCap>1GB</totalSizeCap>
</rollingPolicy>
......
server.port=8082
spring.main.allow-bean-definition-overriding=true
spring.application.name=user-service
eureka.client.serviceUrl.defaultZone= ${EUREKA_URL:http://localhost:8761/eureka/}
\ No newline at end of file
eureka.client.serviceUrl.defaultZone= ${EUREKA_URL:http://localhost:8761/eureka/}
#Zipkin
spring.zipkin.baseurl= localhost:9411
# All traces should be sent to latency analysis tool, default sampling probability is 10%
management.tracing.sampling.probability=1.0
## traceID and spanId are predefined MDC keys - we want the logs to include them
logging.pattern.level=%5p [${spring.application.name:},%X{traceId:-},%X{spanId:-}]
<configuration>
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>INFO</level>
</filter>
<encoder>
<pattern>%d{HH:mm:ss.SSS} %-5level %msg%n</pattern>
<charset>utf8</charset>
</encoder>
</appender>
<appender name="FILE"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>logs/UserService.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>logs/UserService.%d{yyyy-MM-dd}.log</fileNamePattern>
<maxHistory>10</maxHistory>
<totalSizeCap>1GB</totalSizeCap>
</rollingPolicy>
<encoder>
<pattern>%d{HH:mm:ss.SSS} %-5level %msg%n</pattern>
</encoder>
</appender>
<appender name="STASH" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
<destination>localhost:5000</destination>
<encoder
class="net.logstash.logback.encoder.LoggingEventCompositeJsonEncoder">
<providers>
<mdc />
<context />
<logLevel />
<loggerName />
<pattern>
<pattern>
{
"appName": "User-service"
}
</pattern>
</pattern>
<threadName />
<message />
<logstashMarkers />
<stackTrace />
</providers>
</encoder>
</appender>
<root level="INFO">
<appender-ref ref="CONSOLE" />
<appender-ref ref="FILE" />
<appender-ref ref="STASH" />
</root>
</configuration>
\ No newline at end of file
......@@ -22,6 +22,18 @@
<spring-cloud.version>2022.0.0</spring-cloud.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-tracing-bridge-brave</artifactId>
</dependency>
<dependency>
<groupId>io.zipkin.reporter2</groupId>
<artifactId>zipkin-reporter-brave</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
......
package org.example;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;
@Configuration
public class RestTemplateConfig
{
@Bean
@LoadBalanced
public RestTemplate restTemplate(RestTemplateBuilder restTemplateBuilder)
{
return restTemplateBuilder.build();
}
}
......@@ -3,6 +3,7 @@ package org.example;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
......@@ -11,6 +12,7 @@ import org.springframework.web.client.RestTemplate;
import java.util.ArrayList;
import java.util.List;
@Component
@Slf4j
@RestController
@RequestMapping("/users")
......
......@@ -17,11 +17,4 @@ public class UserServiceApp
SpringApplication.run(UserServiceApp.class, args);
}
@Bean
@LoadBalanced
public RestTemplate getRestTemplate()
{
return new RestTemplate();
}
}
\ No newline at end of file
server.port=8085
spring.main.allow-bean-definition-overriding=true
spring.application.name=user-service
eureka.client.serviceUrl.defaultZone= ${EUREKA_URL:http://localhost:8761/eureka/}
\ No newline at end of file
eureka.client.serviceUrl.defaultZone= ${EUREKA_URL:http://localhost:8761/eureka/}
#Zipkin
spring.zipkin.baseurl= localhost:9411
# All traces should be sent to latency analysis tool, default sampling probability is 10%
management.tracing.sampling.probability=1.0
## traceID and spanId are predefined MDC keys - we want the logs to include them
logging.pattern.level=%5p [${spring.application.name:},%X{traceId:-},%X{spanId:-}]
......@@ -10,9 +10,9 @@
</appender>
<appender name="FILE"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>logs/catalog.log</file>
<file>logs/UserServiceReplica.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>logs/catalog.%d{yyyy-MM-dd}.log</fileNamePattern>
<fileNamePattern>logs/UserServiceReplica.%d{yyyy-MM-dd}.log</fileNamePattern>
<maxHistory>10</maxHistory>
<totalSizeCap>1GB</totalSizeCap>
</rollingPolicy>
......
server.port=8085
spring.main.allow-bean-definition-overriding=true
spring.application.name=user-service
eureka.client.serviceUrl.defaultZone= ${EUREKA_URL:http://localhost:8761/eureka/}
\ No newline at end of file
eureka.client.serviceUrl.defaultZone= ${EUREKA_URL:http://localhost:8761/eureka/}
#Zipkin
spring.zipkin.baseurl= localhost:9411
# All traces should be sent to latency analysis tool, default sampling probability is 10%
management.tracing.sampling.probability=1.0
## traceID and spanId are predefined MDC keys - we want the logs to include them
logging.pattern.level=%5p [${spring.application.name:},%X{traceId:-},%X{spanId:-}]
<configuration>
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>INFO</level>
</filter>
<encoder>
<pattern>%d{HH:mm:ss.SSS} %-5level %msg%n</pattern>
<charset>utf8</charset>
</encoder>
</appender>
<appender name="FILE"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>logs/UserServiceReplica.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>logs/UserServiceReplica.%d{yyyy-MM-dd}.log</fileNamePattern>
<maxHistory>10</maxHistory>
<totalSizeCap>1GB</totalSizeCap>
</rollingPolicy>
<encoder>
<pattern>%d{HH:mm:ss.SSS} %-5level %msg%n</pattern>
</encoder>
</appender>
<appender name="STASH" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
<destination>localhost:5000</destination>
<encoder
class="net.logstash.logback.encoder.LoggingEventCompositeJsonEncoder">
<providers>
<mdc />
<context />
<logLevel />
<loggerName />
<pattern>
<pattern>
{
"appName": "User-service-Replica"
}
</pattern>
</pattern>
<threadName />
<message />
<logstashMarkers />
<stackTrace />
</providers>
</encoder>
</appender>
<root level="INFO">
<appender-ref ref="CONSOLE" />
<appender-ref ref="FILE" />
<appender-ref ref="STASH" />
</root>
</configuration>
\ No newline at end of file
......@@ -24,6 +24,18 @@
<spring-cloud.version>2022.0.0</spring-cloud.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-tracing-bridge-brave</artifactId>
</dependency>
<dependency>
<groupId>io.zipkin.reporter2</groupId>
<artifactId>zipkin-reporter-brave</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
......
package org.example;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;
@Configuration
public class RestTemplateConfig
{
@Bean
@LoadBalanced
public RestTemplate restTemplate(RestTemplateBuilder restTemplateBuilder)
{
return restTemplateBuilder.build();
}
}
......@@ -4,6 +4,7 @@ import lombok.extern.slf4j.Slf4j;
import org.codehaus.jettison.json.JSONException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
......@@ -11,6 +12,7 @@ import org.springframework.web.client.RestTemplate;
import java.io.IOException;
@Component
@Slf4j
@RestController
@RequestMapping("/weather")
......@@ -27,13 +29,13 @@ public class WeatherService
@RequestMapping("/{city}")
public Weather getWeather(@PathVariable("city") String city) throws IOException
{
if (city.isEmpty())
{
log.warn("Request With Empty City");
System.out.println("City is Empty");
return new Weather();
}
log.info("Weather Request for : " + city);
Weather weather = new Weather();
try
{
......
......@@ -16,10 +16,4 @@ public class WeatherServiceApp
SpringApplication.run(WeatherServiceApp.class, args);
}
@Bean
@LoadBalanced
public RestTemplate getRestTemplate()
{
return new RestTemplate();
}
}
......@@ -2,4 +2,12 @@ server.port=8083
spring.application.name=weather-service
spring.main.allow-bean-definition-overriding=true
eureka.client.serviceUrl.defaultZone= ${EUREKA_URL:http://localhost:8761/eureka/}
api.key=57afea8fc6e142f29f2115632242604
\ No newline at end of file
api.key=57afea8fc6e142f29f2115632242604
#Zipkin
spring.zipkin.baseurl= localhost:9411
# All traces should be sent to latency analysis tool, default sampling probability is 10%
management.tracing.sampling.probability=1.0
## traceID and spanId are predefined MDC keys - we want the logs to include them
logging.pattern.level=%5p [${spring.application.name:},%X{traceId:-},%X{spanId:-}]
......@@ -10,9 +10,9 @@
</appender>
<appender name="FILE"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>logs/catalog.log</file>
<file>logs/WeatherService.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>logs/catalog.%d{yyyy-MM-dd}.log</fileNamePattern>
<fileNamePattern>logs/WeatherService.%d{yyyy-MM-dd}.log</fileNamePattern>
<maxHistory>10</maxHistory>
<totalSizeCap>1GB</totalSizeCap>
</rollingPolicy>
......
......@@ -2,4 +2,12 @@ server.port=8083
spring.application.name=weather-service
spring.main.allow-bean-definition-overriding=true
eureka.client.serviceUrl.defaultZone= ${EUREKA_URL:http://localhost:8761/eureka/}
api.key=57afea8fc6e142f29f2115632242604
\ No newline at end of file
api.key=57afea8fc6e142f29f2115632242604
#Zipkin
spring.zipkin.baseurl= localhost:9411
# All traces should be sent to latency analysis tool, default sampling probability is 10%
management.tracing.sampling.probability=1.0
## traceID and spanId are predefined MDC keys - we want the logs to include them
logging.pattern.level=%5p [${spring.application.name:},%X{traceId:-},%X{spanId:-}]
<configuration>
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>INFO</level>
</filter>
<encoder>
<pattern>%d{HH:mm:ss.SSS} %-5level %msg%n</pattern>
<charset>utf8</charset>
</encoder>
</appender>
<appender name="FILE"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>logs/WeatherService.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>logs/WeatherService.%d{yyyy-MM-dd}.log</fileNamePattern>
<maxHistory>10</maxHistory>
<totalSizeCap>1GB</totalSizeCap>
</rollingPolicy>
<encoder>
<pattern>%d{HH:mm:ss.SSS} %-5level %msg%n</pattern>
</encoder>
</appender>
<appender name="STASH" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
<destination>localhost:5000</destination>
<encoder
class="net.logstash.logback.encoder.LoggingEventCompositeJsonEncoder">
<providers>
<mdc />
<context />
<logLevel />
<loggerName />
<pattern>
<pattern>
{
"appName": "weather-service"
}
</pattern>
</pattern>
<threadName />
<message />
<logstashMarkers />
<stackTrace />
</providers>
</encoder>
</appender>
<root level="INFO">
<appender-ref ref="CONSOLE" />
<appender-ref ref="FILE" />
<appender-ref ref="STASH" />
</root>
</configuration>
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
15:35:47.952 INFO Starting UserServiceApp using Java 17.0.5 with PID 16104 (D:\HIAST\FIY\SS\Advanced Distributed Systems\Lab\6\MicroServices\MicroServices\UserServiceReplica\target\classes started by M_Salameh in D:\HIAST\FIY\SS\Advanced Distributed Systems\Lab\6\MicroServices\MicroServices)
15:35:47.962 INFO No active profile set, falling back to 1 default profile: "default"
15:35:50.043 INFO BeanFactory id=a7aa9220-1f7e-305d-8e37-521c574fba89
15:35:50.833 INFO Tomcat initialized with port(s): 8085 (http)
15:35:50.846 INFO Initializing ProtocolHandler ["http-nio-8085"]
15:35:50.850 INFO Starting service [Tomcat]
15:35:50.851 INFO Starting Servlet engine: [Apache Tomcat/10.1.4]
15:35:51.142 INFO Initializing Spring embedded WebApplicationContext
15:35:51.143 INFO Root WebApplicationContext: initialization completed in 3088 ms
15:35:54.277 INFO Eureka HTTP Client uses RestTemplate.
15:35:54.331 WARN Spring Cloud LoadBalancer is currently working with the default cache. While this cache implementation is useful for development and tests, it's recommended to use Caffeine cache in production.You can switch to using Caffeine cache, by adding it and org.springframework.cache.caffeine.CaffeineCacheManager to the classpath.
15:35:54.344 INFO Exposing 1 endpoint(s) beneath base path '/actuator'
15:35:54.422 INFO Setting initial instance status as: STARTING
15:35:54.534 INFO Initializing Eureka in region us-east-1
15:35:54.544 INFO Resolving eureka endpoints via configuration
15:35:54.582 INFO Disable delta property : false
15:35:54.583 INFO Single vip registry refresh property : null
15:35:54.583 INFO Force full registry fetch : false
15:35:54.584 INFO Application is null : false
15:35:54.584 INFO Registered Applications size is zero : true
15:35:54.585 INFO Application version is -1: true
15:35:54.585 INFO Getting all instance registry info from the eureka server
15:35:55.024 INFO The response status is 200
15:35:55.030 INFO Starting heartbeat executor: renew interval is: 30
15:35:55.035 INFO InstanceInfoReplicator onDemand update allowed rate per min is 4
15:35:55.044 INFO Discovery Client initialized at timestamp 1714739755043 with initial instances count: 1
15:35:55.049 INFO Registering application USER-SERVICE with eureka with status UP
15:35:55.050 INFO Saw local status change event StatusChangeEvent [timestamp=1714739755050, current=UP, previous=STARTING]
15:35:55.054 INFO DiscoveryClient_USER-SERVICE/M-Salameh:user-service:8085: registering service...
15:35:55.055 INFO Starting ProtocolHandler ["http-nio-8085"]
15:35:55.094 INFO Tomcat started on port(s): 8085 (http) with context path ''
15:35:55.097 INFO Updating port to 8085
15:35:55.128 INFO DiscoveryClient_USER-SERVICE/M-Salameh:user-service:8085 - registration status: 204
15:35:55.688 INFO Started UserServiceApp in 9.85 seconds (process running for 10.649)
15:40:30.581 INFO Initializing Spring DispatcherServlet 'dispatcherServlet'
15:40:30.581 INFO Initializing Servlet 'dispatcherServlet'
15:40:30.583 INFO Completed initialization in 2 ms
15:40:30.659 INFO Query on Weather and Forecast for Destination of Flight : SY11
15:40:54.601 INFO Resolving eureka endpoints via configuration
15:44:18.674 INFO Query on Flights for User with ID : 1
15:44:30.627 INFO Query on Flights for User with ID : 3
15:44:52.775 INFO Unregistering application USER-SERVICE with eureka with status DOWN
15:44:52.775 INFO Saw local status change event StatusChangeEvent [timestamp=1714740292775, current=DOWN, previous=UP]
15:44:52.776 INFO DiscoveryClient_USER-SERVICE/M-Salameh:user-service:8085: registering service...
15:44:52.786 INFO DiscoveryClient_USER-SERVICE/M-Salameh:user-service:8085 - registration status: 204
15:44:52.909 INFO Shutting down DiscoveryClient ...
15:44:55.921 WARN task supervisor shutting down, can't accept the task
15:44:55.922 INFO Unregistering ...
15:44:55.929 INFO DiscoveryClient_USER-SERVICE/M-Salameh:user-service:8085 - deregister status: 200
15:44:55.938 INFO Completed shut down of DiscoveryClient
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment