-
Notifications
You must be signed in to change notification settings - Fork 184
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
Greenbids fix geolookup: host and fetch GCS + mock dbReader UT #3626
base: master
Are you sure you want to change the base?
Conversation
e5faad5
to
ee640d3
Compare
...a/org/prebid/server/hooks/modules/greenbids/real/time/data/config/DatabaseReaderFactory.java
Outdated
Show resolved
Hide resolved
...a/org/prebid/server/hooks/modules/greenbids/real/time/data/config/DatabaseReaderFactory.java
Outdated
Show resolved
Hide resolved
...server/hooks/modules/greenbids/real/time/data/config/GreenbidsRealTimeDataConfiguration.java
Outdated
Show resolved
Hide resolved
...prebid/server/hooks/modules/greenbids/real/time/data/core/GreenbidsInferenceDataService.java
Outdated
Show resolved
Hide resolved
Groovy IT is failing
I will push an empty commit to see if it is a flaky one |
...a/org/prebid/server/hooks/modules/greenbids/real/time/data/config/DatabaseReaderFactory.java
Outdated
Show resolved
Hide resolved
...a/org/prebid/server/hooks/modules/greenbids/real/time/data/config/DatabaseReaderFactory.java
Outdated
Show resolved
Hide resolved
...a/org/prebid/server/hooks/modules/greenbids/real/time/data/config/DatabaseReaderFactory.java
Outdated
Show resolved
Hide resolved
...a/org/prebid/server/hooks/modules/greenbids/real/time/data/config/DatabaseReaderFactory.java
Outdated
Show resolved
Hide resolved
...a/org/prebid/server/hooks/modules/greenbids/real/time/data/config/DatabaseReaderFactory.java
Outdated
Show resolved
Hide resolved
...a/org/prebid/server/hooks/modules/greenbids/real/time/data/config/DatabaseReaderFactory.java
Outdated
Show resolved
Hide resolved
...id/server/hooks/modules/greenbids/real/time/data/config/GreenbidsRealTimeDataProperties.java
Outdated
Show resolved
Hide resolved
final String country = Optional.ofNullable(bidRequest.getDevice()) | ||
.map(Device::getGeo) | ||
.map(Geo::getCountry) | ||
.map(GreenbidsInferenceDataService::getCountryNameFromAlpha3) | ||
.orElseGet(() -> getCountry(ip)); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this change is not covered by the unit tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After checking Locale docs, the alpha3 code is not convertable to countryName via getCountry
(only works for alpha2).
So need to use CountryCodeMapper mapToAlpha2 to convert alpha3 -> alpha2 and then via Locale alpha2 -> countryName.
private String resolveAlpha2CountryCode(Device device) {
return Optional.ofNullable(device)
.map(Device::getGeo)
.map(Geo::getCountry)
.map(countryCodeMapper::mapToAlpha2)
.orElse(null);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, if you need it
Also need to not forget to remove As we discussed on Slack on the current state the usage of As the current objective of this PR is to fix the PBS codebase I propose to find the solution in the PR #3596 |
final String downloadUrl = properties.geoLiteCountryPath; | ||
final String tmpPath = properties.tmpPath; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use getters
final String country = Optional.ofNullable(bidRequest.getDevice()) | ||
.map(Device::getGeo) | ||
.map(Geo::getCountry) | ||
.map(GreenbidsInferenceDataService::getCountryNameFromAlpha3) | ||
.orElseGet(() -> getCountry(ip)); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, if you need it
🔧 Type of changes
✨ What's the context?
🧠 Rationale behind the change
GeoLite2-Country.mmdb
in Greenbids GCS bucket instead of open source URL: gs://greenbids-europe-west1-prebid-server-staging/GeoLite2-Country.mmdbgetCountry(ip)
only in case ifDevice::getGeo
is null (geoLookupEnabled is false in GeoLocationServiceWrapper)🔎 New Bid Adapter Checklist
🧪 Test plan
How do you know the changes are safe to ship to production?
🏎 Quality check