-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from KU-Taverse/feat/prometheus
[Feat] prometheus를 위한 설정 추가
- Loading branch information
Showing
5 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package ku.user.client; | ||
|
||
import org.springframework.cloud.openfeign.FeignClient; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
|
||
@FeignClient(name="game-service") | ||
public interface GameServiceClient { | ||
@GetMapping("/game-service/{userId}/games") | ||
String getGameResults(@PathVariable String userId); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package ku.user.config; | ||
|
||
import io.github.resilience4j.circuitbreaker.CircuitBreakerConfig; | ||
import io.github.resilience4j.timelimiter.TimeLimiterConfig; | ||
import org.springframework.cloud.circuitbreaker.resilience4j.Resilience4JCircuitBreakerFactory; | ||
import org.springframework.cloud.circuitbreaker.resilience4j.Resilience4JConfigBuilder; | ||
import org.springframework.cloud.client.circuitbreaker.Customizer; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
import java.time.Duration; | ||
|
||
@Configuration | ||
public class Resilience4JConfig { | ||
@Bean | ||
public Customizer<Resilience4JCircuitBreakerFactory> globalCustomConfiguration(){ | ||
CircuitBreakerConfig circuitBreakerConfig = CircuitBreakerConfig.custom() | ||
.failureRateThreshold(4) | ||
.waitDurationInOpenState(Duration.ofMillis(1000)) | ||
.slidingWindowType(CircuitBreakerConfig.SlidingWindowType.COUNT_BASED) | ||
.slidingWindowSize(2) | ||
.build(); | ||
|
||
TimeLimiterConfig timeLimiterConfig = TimeLimiterConfig.custom() | ||
.timeoutDuration(Duration.ofSeconds(4)) | ||
.build(); | ||
|
||
|
||
return factory -> factory.configureDefault(id -> new Resilience4JConfigBuilder(id) | ||
.timeLimiterConfig(timeLimiterConfig) | ||
.circuitBreakerConfig(circuitBreakerConfig) | ||
.build() | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters