Skip to content

Commit 7de2100

Browse files
committed
Merge branch 'refs/heads/master' into module-storage-metrics
# Conflicts: # src/test/java/org/prebid/server/metric/MetricsTest.java
2 parents 75d85b2 + 0495b1e commit 7de2100

File tree

537 files changed

+28850
-4000
lines changed

Some content is hidden

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

537 files changed

+28850
-4000
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM amazoncorretto:21.0.6-al2023
1+
FROM amazoncorretto:21.0.8-al2023
22

33
WORKDIR /app/prebid-server
44

Dockerfile-modules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM amazoncorretto:21.0.6-al2023
1+
FROM amazoncorretto:21.0.8-al2023
22

33
WORKDIR /app/prebid-server
44

docs/config-app.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ For HTTP data source available next options:
349349
- `settings.http.rfc3986-compatible` - if equals to `true` the url will be build according to RFC 3986, `false` by default
350350

351351
For account processing rules available next options:
352-
- `settings.enforce-valid-account` - if equals to `true` then request without account id will be rejected with 401.
352+
- `settings.enforce-valid-account` - if equals to `true` then request without account id will be rejection with 401.
353353
- `settings.generate-storedrequest-bidrequest-id` - overrides `bidrequest.id` in amp or app stored request with generated UUID if true. Default value is false. This flag can be overridden by setting `bidrequest.id` as `{{UUID}}` placeholder directly in stored request.
354354

355355
It is possible to specify default account configuration values that will be assumed if account config have them

docs/metrics.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ Following metrics are collected and submitted if account is configured with `bas
9393
Following metrics are collected and submitted if account is configured with `detailed` verbosity:
9494
- `account.<account-id>.requests.type.(openrtb2-web,openrtb-app,amp,legacy)` - number of requests received from account with `<account-id>` broken down by type of incoming request
9595
- `account.<account-id>.debug_requests` - number of requests received from account with `<account-id>` broken down by type of incoming request (when debug mode is enabled)
96-
- `account.<account-id>.requests.rejected` - number of rejected requests caused by incorrect `accountId`
96+
- `account.<account-id>.requests.rejection` - number of rejection requests caused by incorrect `accountId`
9797
- `account.<account-id>.requests.disabled_bidder` - number of disabled bidders received within requests from account with `<account-id>`
9898
- `account.<account-id>.requests.unknown_bidder` - number of unknown bidder names received within requests from account with `<account-id>`
9999
- `account.<account-id>.adapter.<bidder-name>.request_time` - timer tracking how long did it take to make a request to `<bidder-name>` when incoming request was from `<account-id>`
@@ -140,7 +140,7 @@ Following metrics are collected and submitted if account is configured with `det
140140
- `analytics.<reporter-name>.(auction|amp|video|cookie_sync|event|setuid).ok` - number of succeeded processed event requests
141141
- `analytics.<reporter-name>.(auction|amp|video|cookie_sync|event|setuid).timeout` - number of event requests, failed with timeout cause
142142
- `analytics.<reporter-name>.(auction|amp|video|cookie_sync|event|setuid).err` - number of event requests, failed with errors
143-
- `analytics.<reporter-name>.(auction|amp|video|cookie_sync|event|setuid).badinput` - number of event requests, rejected with bad input cause
143+
- `analytics.<reporter-name>.(auction|amp|video|cookie_sync|event|setuid).badinput` - number of event requests, rejection with bad input cause
144144

145145
## Modules metrics
146146
- `modules.module.<module>.stage.<stage>.hook.<hook>.call` - number of times the hook is called

extra/bundle/pom.xml

Lines changed: 11 additions & 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.31.0-SNAPSHOT</version>
8+
<version>3.34.0-SNAPSHOT</version>
99
<relativePath>../../extra/pom.xml</relativePath>
1010
</parent>
1111

@@ -65,6 +65,16 @@
6565
<artifactId>wurfl-devicedetection</artifactId>
6666
<version>${project.version}</version>
6767
</dependency>
68+
<dependency>
69+
<groupId>org.prebid.server.hooks.modules</groupId>
70+
<artifactId>live-intent-omni-channel-identity</artifactId>
71+
<version>${project.version}</version>
72+
</dependency>
73+
<dependency>
74+
<groupId>org.prebid.server.hooks.modules</groupId>
75+
<artifactId>pb-rule-engine</artifactId>
76+
<version>${project.version}</version>
77+
</dependency>
6878
</dependencies>
6979

7080
<build>

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.31.0-SNAPSHOT</version>
8+
<version>3.34.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.31.0-SNAPSHOT</version>
8+
<version>3.34.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.31.0-SNAPSHOT</version>
7+
<version>3.34.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/config/GreenbidsRealTimeDataConfiguration.java

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import org.prebid.server.geolocation.CountryCodeMapper;
99
import org.prebid.server.hooks.modules.greenbids.real.time.data.core.FilterService;
1010
import org.prebid.server.hooks.modules.greenbids.real.time.data.core.GreenbidsInferenceDataService;
11-
import org.prebid.server.hooks.modules.greenbids.real.time.data.core.GreenbidsInvocationService;
1211
import org.prebid.server.hooks.modules.greenbids.real.time.data.core.ModelCache;
1312
import org.prebid.server.hooks.modules.greenbids.real.time.data.core.OnnxModelRunner;
1413
import org.prebid.server.hooks.modules.greenbids.real.time.data.core.OnnxModelRunnerFactory;
@@ -48,16 +47,14 @@ GreenbidsInferenceDataService greenbidsInferenceDataService(DatabaseReaderFactor
4847
GreenbidsRealTimeDataModule greenbidsRealTimeDataModule(
4948
FilterService filterService,
5049
OnnxModelRunnerWithThresholds onnxModelRunnerWithThresholds,
51-
GreenbidsInferenceDataService greenbidsInferenceDataService,
52-
GreenbidsInvocationService greenbidsInvocationService) {
50+
GreenbidsInferenceDataService greenbidsInferenceDataService) {
5351

5452
return new GreenbidsRealTimeDataModule(List.of(
5553
new GreenbidsRealTimeDataProcessedAuctionRequestHook(
5654
ObjectMapperProvider.mapper(),
5755
filterService,
5856
onnxModelRunnerWithThresholds,
59-
greenbidsInferenceDataService,
60-
greenbidsInvocationService)));
57+
greenbidsInferenceDataService)));
6158
}
6259

6360
@Bean
@@ -123,15 +120,7 @@ ThresholdCache thresholdCache(
123120
}
124121

125122
@Bean
126-
OnnxModelRunnerWithThresholds onnxModelRunnerWithThresholds(
127-
ModelCache modelCache,
128-
ThresholdCache thresholdCache) {
129-
123+
OnnxModelRunnerWithThresholds onnxModelRunnerWithThresholds(ModelCache modelCache, ThresholdCache thresholdCache) {
130124
return new OnnxModelRunnerWithThresholds(modelCache, thresholdCache);
131125
}
132-
133-
@Bean
134-
GreenbidsInvocationService greenbidsInvocationService() {
135-
return new GreenbidsInvocationService();
136-
}
137126
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
package org.prebid.server.hooks.modules.greenbids.real.time.data.core;
2+
3+
import com.fasterxml.jackson.databind.JsonNode;
4+
import com.iab.openrtb.request.BidRequest;
5+
import com.iab.openrtb.request.Imp;
6+
import org.apache.commons.lang3.ObjectUtils;
7+
import org.apache.commons.lang3.StringUtils;
8+
import org.prebid.server.analytics.reporter.greenbids.model.ExplorationResult;
9+
import org.prebid.server.analytics.reporter.greenbids.model.Ortb2ImpExtResult;
10+
import org.prebid.server.hooks.modules.greenbids.real.time.data.model.data.GreenbidsConfig;
11+
import org.prebid.server.hooks.modules.greenbids.real.time.data.model.result.AnalyticsResult;
12+
import org.prebid.server.hooks.modules.greenbids.real.time.data.model.result.GreenbidsInvocationResult;
13+
import org.prebid.server.hooks.v1.InvocationAction;
14+
15+
import java.util.Map;
16+
import java.util.Optional;
17+
import java.util.UUID;
18+
import java.util.stream.Collectors;
19+
20+
public class GreenbidsInvocationResultCreator {
21+
22+
private static final int RANGE_16_BIT_INTEGER_DIVISION_BASIS = 0x10000;
23+
private static final double DEFAULT_EXPLORATION_RATE = 1.0;
24+
25+
private GreenbidsInvocationResultCreator() {
26+
27+
}
28+
29+
public static GreenbidsInvocationResult create(GreenbidsConfig greenbidsConfig,
30+
BidRequest bidRequest,
31+
Map<String, Map<String, Boolean>> impsBiddersFilterMap) {
32+
33+
final String greenbidsId = UUID.randomUUID().toString();
34+
final boolean isExploration = isExploration(greenbidsConfig, greenbidsId);
35+
36+
final boolean allRejected = bidRequest.getImp().stream()
37+
.noneMatch(imp -> impsBiddersFilterMap.get(imp.getId()).values().stream().anyMatch(isKept -> isKept));
38+
39+
final InvocationAction invocationAction = isExploration
40+
? InvocationAction.no_action
41+
: allRejected
42+
? InvocationAction.reject
43+
: InvocationAction.update;
44+
45+
final Map<String, Ortb2ImpExtResult> ort2ImpExtResultMap = createOrtb2ImpExtForImps(
46+
bidRequest, impsBiddersFilterMap, greenbidsId, isExploration);
47+
final AnalyticsResult analyticsResult = AnalyticsResult.of("success", ort2ImpExtResultMap);
48+
return GreenbidsInvocationResult.of(invocationAction, analyticsResult);
49+
}
50+
51+
private static boolean isExploration(GreenbidsConfig greenbidsConfig, String greenbidsId) {
52+
final double explorationRate = ObjectUtils.defaultIfNull(
53+
greenbidsConfig.getExplorationRate(),
54+
DEFAULT_EXPLORATION_RATE);
55+
final int hashInt = Integer.parseInt(greenbidsId.substring(greenbidsId.length() - 4), 16);
56+
return hashInt < explorationRate * RANGE_16_BIT_INTEGER_DIVISION_BASIS;
57+
}
58+
59+
private static Map<String, Ortb2ImpExtResult> createOrtb2ImpExtForImps(
60+
BidRequest bidRequest,
61+
Map<String, Map<String, Boolean>> impsBiddersFilterMap,
62+
String greenbidsId,
63+
boolean isExploration) {
64+
65+
return bidRequest.getImp().stream()
66+
.collect(Collectors.toMap(
67+
Imp::getId,
68+
imp -> createOrtb2ImpExt(imp, impsBiddersFilterMap, greenbidsId, isExploration)));
69+
}
70+
71+
private static Ortb2ImpExtResult createOrtb2ImpExt(Imp imp,
72+
Map<String, Map<String, Boolean>> impsBiddersFilterMap,
73+
String greenbidsId,
74+
boolean isExploration) {
75+
76+
final String tid = Optional.ofNullable(imp)
77+
.map(Imp::getExt)
78+
.map(impExt -> impExt.get("tid"))
79+
.map(JsonNode::asText)
80+
.orElse(StringUtils.EMPTY);
81+
final Map<String, Boolean> impBiddersFilterMap = impsBiddersFilterMap.get(imp.getId());
82+
final ExplorationResult explorationResult = ExplorationResult.of(
83+
greenbidsId, impBiddersFilterMap, isExploration);
84+
return Ortb2ImpExtResult.of(explorationResult, tid);
85+
}
86+
}

0 commit comments

Comments
 (0)