Skip to content

Commit b5bd09b

Browse files
committed
Merge branch 'refs/heads/master' into support-gpp-usnat-v2
2 parents f7f2f99 + 6363e1d commit b5bd09b

198 files changed

Lines changed: 5099 additions & 2038 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/code-path-changes.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Notify Code Path Changes
22

33
on:
4-
pull_request:
4+
pull_request_target:
55
types: [opened, synchronize]
66
paths:
77
- '**'
@@ -14,6 +14,9 @@ env:
1414
GITHUB_PR_NUMBER: ${{ github.event.pull_request.number }}
1515
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1616

17+
permissions:
18+
contents: read
19+
1720
jobs:
1821
notify:
1922
runs-on: ubuntu-latest

docs/config-app.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ Removes and downloads file again if depending service cant process probably corr
120120

121121
## Setuid
122122
- `setuid.default-timeout-ms` - default operation timeout for requests to `/setuid` endpoint.
123+
- `setuid.number-of-uid-cookies` - specifies the maximum number of UID cookies that can be returned in the `/setuid` endpoint response. If it's not specified `1` will be taken as the default value.
123124

124125
## Cookie Sync
125126
- `cookie-sync.default-timeout-ms` - default operation timeout for requests to `/cookie_sync` endpoint.

extra/bundle/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>org.prebid</groupId>
77
<artifactId>prebid-server-aggregator</artifactId>
8-
<version>3.19.0-SNAPSHOT</version>
8+
<version>3.21.0-SNAPSHOT</version>
99
<relativePath>../../extra/pom.xml</relativePath>
1010
</parent>
1111

extra/modules/confiant-ad-quality/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>org.prebid.server.hooks.modules</groupId>
77
<artifactId>all-modules</artifactId>
8-
<version>3.19.0-SNAPSHOT</version>
8+
<version>3.21.0-SNAPSHOT</version>
99
</parent>
1010

1111
<artifactId>confiant-ad-quality</artifactId>

extra/modules/fiftyone-devicedetection/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>org.prebid.server.hooks.modules</groupId>
77
<artifactId>all-modules</artifactId>
8-
<version>3.19.0-SNAPSHOT</version>
8+
<version>3.21.0-SNAPSHOT</version>
99
</parent>
1010

1111
<artifactId>fiftyone-devicedetection</artifactId>

extra/modules/greenbids-real-time-data/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>org.prebid.server.hooks.modules</groupId>
66
<artifactId>all-modules</artifactId>
7-
<version>3.19.0-SNAPSHOT</version>
7+
<version>3.21.0-SNAPSHOT</version>
88
</parent>
99

1010
<artifactId>greenbids-real-time-data</artifactId>

extra/modules/greenbids-real-time-data/src/main/java/org/prebid/server/hooks/modules/greenbids/real/time/data/core/GreenbidsInferenceDataService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ private List<ThrottlingMessage> extractMessagesForImp(
115115
private static String getCountryNameFromAlpha2(String isoCode) {
116116
return StringUtils.isBlank(isoCode)
117117
? StringUtils.EMPTY
118-
: new Locale(StringUtils.EMPTY, isoCode).getDisplayCountry();
118+
: Locale.forLanguageTag("und-" + isoCode).getDisplayCountry(Locale.ENGLISH);
119119
}
120120

121121
private String getCountry(String ip) {

extra/modules/greenbids-real-time-data/src/main/java/org/prebid/server/hooks/modules/greenbids/real/time/data/core/GreenbidsInvocationService.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import org.apache.commons.lang3.StringUtils;
88
import org.prebid.server.analytics.reporter.greenbids.model.ExplorationResult;
99
import org.prebid.server.analytics.reporter.greenbids.model.Ortb2ImpExtResult;
10-
import org.prebid.server.hooks.modules.greenbids.real.time.data.model.data.Partner;
10+
import org.prebid.server.hooks.modules.greenbids.real.time.data.model.data.GreenbidsConfig;
1111
import org.prebid.server.hooks.modules.greenbids.real.time.data.model.result.AnalyticsResult;
1212
import org.prebid.server.hooks.modules.greenbids.real.time.data.model.result.GreenbidsInvocationResult;
1313
import org.prebid.server.hooks.v1.InvocationAction;
@@ -22,13 +22,15 @@ public class GreenbidsInvocationService {
2222

2323
private static final int RANGE_16_BIT_INTEGER_DIVISION_BASIS = 0x10000;
2424

25+
private static final double DEFAULT_EXPLORATION_RATE = 1.0;
26+
2527
public GreenbidsInvocationResult createGreenbidsInvocationResult(
26-
Partner partner,
28+
GreenbidsConfig greenbidsConfig,
2729
BidRequest bidRequest,
2830
Map<String, Map<String, Boolean>> impsBiddersFilterMap) {
2931

3032
final String greenbidsId = UUID.randomUUID().toString();
31-
final boolean isExploration = isExploration(partner, greenbidsId);
33+
final boolean isExploration = isExploration(greenbidsConfig, greenbidsId);
3234

3335
final BidRequest updatedBidRequest = isExploration
3436
? bidRequest
@@ -49,10 +51,12 @@ public GreenbidsInvocationResult createGreenbidsInvocationResult(
4951
return GreenbidsInvocationResult.of(updatedBidRequest, invocationAction, analyticsResult);
5052
}
5153

52-
private Boolean isExploration(Partner partner, String greenbidsId) {
54+
private Boolean isExploration(GreenbidsConfig greenbidsConfig, String greenbidsId) {
55+
final double explorationRate = Optional.ofNullable(greenbidsConfig.getExplorationRate())
56+
.orElse(DEFAULT_EXPLORATION_RATE);
5357
final int hashInt = Integer.parseInt(
5458
greenbidsId.substring(greenbidsId.length() - 4), 16);
55-
return hashInt < partner.getExplorationRate() * RANGE_16_BIT_INTEGER_DIVISION_BASIS;
59+
return hashInt < explorationRate * RANGE_16_BIT_INTEGER_DIVISION_BASIS;
5660
}
5761

5862
private List<Imp> updateImps(BidRequest bidRequest, Map<String, Map<String, Boolean>> impsBiddersFilterMap) {

extra/modules/greenbids-real-time-data/src/main/java/org/prebid/server/hooks/modules/greenbids/real/time/data/core/OnnxModelRunnerWithThresholds.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package org.prebid.server.hooks.modules.greenbids.real.time.data.core;
22

33
import io.vertx.core.Future;
4-
import org.prebid.server.hooks.modules.greenbids.real.time.data.model.data.Partner;
4+
import org.prebid.server.hooks.modules.greenbids.real.time.data.model.data.GreenbidsConfig;
55

66
import java.util.Objects;
77

@@ -18,14 +18,14 @@ public OnnxModelRunnerWithThresholds(
1818
this.thresholdCache = Objects.requireNonNull(thresholdCache);
1919
}
2020

21-
public Future<OnnxModelRunner> retrieveOnnxModelRunner(Partner partner) {
22-
final String onnxModelPath = "models_pbuid=" + partner.getPbuid() + ".onnx";
23-
return modelCache.get(onnxModelPath, partner.getPbuid());
21+
public Future<OnnxModelRunner> retrieveOnnxModelRunner(GreenbidsConfig greenbidsConfig) {
22+
final String onnxModelPath = "models_pbuid=" + greenbidsConfig.getPbuid() + ".onnx";
23+
return modelCache.get(onnxModelPath, greenbidsConfig.getPbuid());
2424
}
2525

26-
public Future<Double> retrieveThreshold(Partner partner) {
27-
final String thresholdJsonPath = "thresholds_pbuid=" + partner.getPbuid() + ".json";
28-
return thresholdCache.get(thresholdJsonPath, partner.getPbuid())
29-
.map(partner::getThreshold);
26+
public Future<Double> retrieveThreshold(GreenbidsConfig greenbidsConfig) {
27+
final String thresholdJsonPath = "thresholds_pbuid=" + greenbidsConfig.getPbuid() + ".json";
28+
return thresholdCache.get(thresholdJsonPath, greenbidsConfig.getPbuid())
29+
.map(greenbidsConfig::getThreshold);
3030
}
3131
}

extra/modules/greenbids-real-time-data/src/main/java/org/prebid/server/hooks/modules/greenbids/real/time/data/model/data/Partner.java renamed to extra/modules/greenbids-real-time-data/src/main/java/org/prebid/server/hooks/modules/greenbids/real/time/data/model/data/GreenbidsConfig.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,31 @@
66

77
import java.util.Comparator;
88
import java.util.List;
9+
import java.util.Optional;
910
import java.util.stream.IntStream;
1011

1112
@Value(staticConstructor = "of")
12-
public class Partner {
13+
public class GreenbidsConfig {
14+
15+
private static final double DEFAULT_TPR = 1.0;
1316

1417
String pbuid;
1518

16-
@JsonProperty("targetTpr")
19+
@JsonProperty("target-tpr")
1720
Double targetTpr;
1821

19-
@JsonProperty("explorationRate")
22+
@JsonProperty("exploration-rate")
2023
Double explorationRate;
2124

2225
public Double getThreshold(ThrottlingThresholds throttlingThresholds) {
26+
final double safeTargetTpr = targetTpr != null ? targetTpr : DEFAULT_TPR;
2327
final List<Double> truePositiveRates = throttlingThresholds.getTpr();
2428
final List<Double> thresholds = throttlingThresholds.getThresholds();
2529

2630
final int minSize = Math.min(truePositiveRates.size(), thresholds.size());
2731

2832
return IntStream.range(0, minSize)
29-
.filter(i -> truePositiveRates.get(i) >= targetTpr)
33+
.filter(i -> truePositiveRates.get(i) >= safeTargetTpr)
3034
.mapToObj(thresholds::get)
3135
.max(Comparator.naturalOrder())
3236
.orElse(0.0);

0 commit comments

Comments
 (0)