-
Notifications
You must be signed in to change notification settings - Fork 243
Dependencies: Bump Vertx and Spring boot to next major version #4520
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
And1sS
wants to merge
27
commits into
master
Choose a base branch
from
dependencies-update
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+604
−1,005
Open
Changes from 5 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
47359d2
Bumped vertx to 5.0
And1sS 00eff37
Replaced custom attempt to implement rolling window for circuit break…
And1sS 28416bf
Removed circuit breaker wrapper entirely.
And1sS 68d2154
Fixed modules.
And1sS 2b2eeb1
Bumped vert.x to 5.1.0. Fixed functional test that has been failing d…
And1sS e3f97ea
WIP
And1sS 173dd13
Fix logger conflict
Net-burst 1753042
WIP
Net-burst 43d5cd7
WIP
525d648
WIP
e93e6eb
Minor refactoring.
And1sS 0615b5b
Refactored ContextRunner.
And1sS 5fd97e0
Unit tests fixes.
And1sS 12cf940
Another minor refactoring.
And1sS e750d10
Fix malformed Groovy files
Net-burst 1dcf911
Revert logger control removal and fix remaining issues
Net-burst ca45f9b
Bump to Java 25
Net-burst bea17a3
Refactor Initializable interface to use Future (#4527)
Lightwood13 d8effa6
Merge branch 'dependencies-update-spring' into dependencies-update
And1sS 335154a
Fix remaining (hopefully) functional test issues
a5be9bf
Merge branch 'dependencies-update-spring' into dependencies-update
And1sS a5fe57c
Reverted unnecessary formating changes.
And1sS 7595087
Fixed couple of functional tests.
And1sS c1b3dbf
Another functional tests fixes.
And1sS dd461cb
Another round of functional tests fixes.
And1sS 1bd591d
update analytics tests
osulzhenko fbc2197
Fixed optable npe.
And1sS File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,27 +1,24 @@ | ||
| package org.prebid.server.geolocation; | ||
|
|
||
| import io.vertx.circuitbreaker.CircuitBreaker; | ||
| import io.vertx.circuitbreaker.CircuitBreakerOptions; | ||
| import io.vertx.circuitbreaker.CircuitBreakerState; | ||
| import io.vertx.core.Future; | ||
| import io.vertx.core.Vertx; | ||
| import org.prebid.server.execution.timeout.Timeout; | ||
| import org.prebid.server.geolocation.model.GeoInfo; | ||
| import org.prebid.server.log.ConditionalLogger; | ||
| import org.prebid.server.log.Logger; | ||
| import org.prebid.server.log.LoggerFactory; | ||
| import org.prebid.server.metric.Metrics; | ||
| import org.prebid.server.vertx.CircuitBreaker; | ||
|
|
||
| import java.time.Clock; | ||
| import java.util.Objects; | ||
| import java.util.concurrent.TimeUnit; | ||
|
|
||
| /** | ||
| * Wrapper for geolocation service with circuit breaker. | ||
| */ | ||
| public class CircuitBreakerSecuredGeoLocationService implements GeoLocationService { | ||
|
|
||
| private static final Logger logger = LoggerFactory.getLogger(CircuitBreakerSecuredGeoLocationService.class); | ||
| private static final ConditionalLogger conditionalLogger = new ConditionalLogger(logger); | ||
| private static final int LOG_PERIOD_SECONDS = 5; | ||
|
|
||
| private final GeoLocationService geoLocationService; | ||
| private final CircuitBreaker breaker; | ||
|
|
@@ -31,39 +28,26 @@ public CircuitBreakerSecuredGeoLocationService(Vertx vertx, | |
| Metrics metrics, | ||
| int openingThreshold, | ||
| long openingIntervalMs, | ||
| long closingIntervalMs, | ||
| Clock clock) { | ||
| long closingIntervalMs) { | ||
|
|
||
| this.geoLocationService = Objects.requireNonNull(geoLocationService); | ||
|
|
||
| breaker = new CircuitBreaker("geo_cb", Objects.requireNonNull(vertx), | ||
| openingThreshold, openingIntervalMs, closingIntervalMs, Objects.requireNonNull(clock)) | ||
| .openHandler(ignored -> circuitOpened()) | ||
| .halfOpenHandler(ignored -> circuitHalfOpened()) | ||
| .closeHandler(ignored -> circuitClosed()); | ||
| breaker = CircuitBreaker.create( | ||
| "geo_cb", | ||
| Objects.requireNonNull(vertx), | ||
| new CircuitBreakerOptions() | ||
| .setNotificationPeriod(0) | ||
| .setMaxFailures(openingThreshold) | ||
| .setFailuresRollingWindow(openingIntervalMs) | ||
| .setResetTimeout(closingIntervalMs)); | ||
|
|
||
| metrics.createGeoLocationCircuitBreakerGauge(breaker::isOpen); | ||
| metrics.createGeoLocationCircuitBreakerGauge(() -> breaker.state() != CircuitBreakerState.CLOSED); | ||
|
|
||
| logger.info("Initialized GeoLocation service with Circuit Breaker"); | ||
| } | ||
|
|
||
| @Override | ||
| public Future<GeoInfo> lookup(String ip, Timeout timeout) { | ||
| return breaker.execute(promise -> geoLocationService.lookup(ip, timeout).onComplete(promise)); | ||
| } | ||
|
|
||
| private void circuitOpened() { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why did you remove these logs? |
||
| conditionalLogger.warn( | ||
| "GeoLocation service is unavailable, circuit opened.", | ||
| LOG_PERIOD_SECONDS, | ||
| TimeUnit.SECONDS); | ||
| } | ||
|
|
||
| private void circuitHalfOpened() { | ||
| logger.warn("GeoLocation service is ready to try again, circuit half-opened."); | ||
| } | ||
|
|
||
| private void circuitClosed() { | ||
| logger.warn("GeoLocation service becomes working, circuit closed."); | ||
| return breaker.execute(() -> geoLocationService.lookup(ip, timeout)); | ||
| } | ||
| } | ||
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.