Skip to content
Open
3 changes: 2 additions & 1 deletion .github/workflows/cross-repo-issue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ jobs:
github.event.pull_request.merged
env:
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
PR_TITLE: ${{ github.event.pull_request.title }}
run: |
echo -e "A PR was merged over on PBS-Java\n\n- [https://github.com/prebid/prebid-server-java/pull/${{github.event.number}}](https://github.com/prebid/prebid-server-java/pull/${{github.event.number}})\n- timestamp: ${{ github.event.pull_request.merged_at}}" > msg
export msg=$(cat msg)
gh issue create --repo prebid/prebid-server --title "Port PR from PBS-Java: ${{ github.event.pull_request.title }}" \
gh issue create --repo prebid/prebid-server --title "Port PR from PBS-Java: $PR_TITLE" \
--body "$msg" \
--label auto
8 changes: 3 additions & 5 deletions .github/workflows/pr-java-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,9 @@ jobs:

- name: Publish JUnit Report
uses: mikepenz/action-junit-report@v5
if: always()
with:
report_paths: '**/target/surefire-reports/TEST-*.xml'
check_name: 'JUnit Test Report'
include_passed: true
comment: true
report_paths: '**/target/surefire-reports/TEST-*.xml'
fail_on_failure: true
updateComment: true
token: ${{ secrets.GITHUB_TOKEN }}
annotate_only: true
2 changes: 1 addition & 1 deletion extra/bundle/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.prebid</groupId>
<artifactId>prebid-server-aggregator</artifactId>
<version>3.37.0-SNAPSHOT</version>
<version>3.38.0-SNAPSHOT</version>
<relativePath>../../extra/pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion extra/modules/confiant-ad-quality/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.prebid.server.hooks.modules</groupId>
<artifactId>all-modules</artifactId>
<version>3.37.0-SNAPSHOT</version>
<version>3.38.0-SNAPSHOT</version>
</parent>

<artifactId>confiant-ad-quality</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion extra/modules/fiftyone-devicedetection/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.prebid.server.hooks.modules</groupId>
<artifactId>all-modules</artifactId>
<version>3.37.0-SNAPSHOT</version>
<version>3.38.0-SNAPSHOT</version>
</parent>

<artifactId>fiftyone-devicedetection</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion extra/modules/greenbids-real-time-data/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.prebid.server.hooks.modules</groupId>
<artifactId>all-modules</artifactId>
<version>3.37.0-SNAPSHOT</version>
<version>3.38.0-SNAPSHOT</version>
</parent>

<artifactId>greenbids-real-time-data</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion extra/modules/live-intent-omni-channel-identity/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.prebid.server.hooks.modules</groupId>
<artifactId>all-modules</artifactId>
<version>3.37.0-SNAPSHOT</version>
<version>3.38.0-SNAPSHOT</version>
</parent>

<artifactId>live-intent-omni-channel-identity</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion extra/modules/optable-targeting/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.prebid.server.hooks.modules</groupId>
<artifactId>all-modules</artifactId>
<version>3.37.0-SNAPSHOT</version>
<version>3.38.0-SNAPSHOT</version>
</parent>

<artifactId>optable-targeting</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion extra/modules/ortb2-blocking/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.prebid.server.hooks.modules</groupId>
<artifactId>all-modules</artifactId>
<version>3.37.0-SNAPSHOT</version>
<version>3.38.0-SNAPSHOT</version>
</parent>

<artifactId>ortb2-blocking</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion extra/modules/pb-request-correction/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.prebid.server.hooks.modules</groupId>
<artifactId>all-modules</artifactId>
<version>3.37.0-SNAPSHOT</version>
<version>3.38.0-SNAPSHOT</version>
</parent>

<artifactId>pb-request-correction</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion extra/modules/pb-response-correction/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.prebid.server.hooks.modules</groupId>
<artifactId>all-modules</artifactId>
<version>3.37.0-SNAPSHOT</version>
<version>3.38.0-SNAPSHOT</version>
</parent>

<artifactId>pb-response-correction</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion extra/modules/pb-richmedia-filter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.prebid.server.hooks.modules</groupId>
<artifactId>all-modules</artifactId>
<version>3.37.0-SNAPSHOT</version>
<version>3.38.0-SNAPSHOT</version>
</parent>

<artifactId>pb-richmedia-filter</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion extra/modules/pb-rule-engine/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.prebid.server.hooks.modules</groupId>
<artifactId>all-modules</artifactId>
<version>3.37.0-SNAPSHOT</version>
<version>3.38.0-SNAPSHOT</version>
</parent>

<artifactId>pb-rule-engine</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion extra/modules/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.prebid</groupId>
<artifactId>prebid-server-aggregator</artifactId>
<version>3.37.0-SNAPSHOT</version>
<version>3.38.0-SNAPSHOT</version>
<relativePath>../../extra/pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion extra/modules/wurfl-devicedetection/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.prebid.server.hooks.modules</groupId>
<artifactId>all-modules</artifactId>
<version>3.37.0-SNAPSHOT</version>
<version>3.38.0-SNAPSHOT</version>
</parent>

<artifactId>wurfl-devicedetection</artifactId>
Expand Down
5 changes: 3 additions & 2 deletions extra/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>org.prebid</groupId>
<artifactId>prebid-server-aggregator</artifactId>
<version>3.37.0-SNAPSHOT</version>
<version>3.38.0-SNAPSHOT</version>
<packaging>pom</packaging>

<scm>
Expand Down Expand Up @@ -47,7 +47,8 @@
<json-schema-validator.version>1.5.6</json-schema-validator.version>
<jsonpatch.version>1.13</jsonpatch.version>
<psl.version>2.2.0</psl.version>
<metrics-influxdb.version>1.3.4</metrics-influxdb.version>
<!-- DO NOT BUMP: versions 1.3.* do not work with flushing counter metrics -->
<metrics-influxdb.version>1.2.3</metrics-influxdb.version>
<vertx.prometheus.version>0.16.0</vertx.prometheus.version>
<iabtcf.version>2.0.10</iabtcf.version>
<gpp-encoder.version>3.2.4</gpp-encoder.version>
Expand Down
13 changes: 12 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.prebid</groupId>
<artifactId>prebid-server-aggregator</artifactId>
<version>3.37.0-SNAPSHOT</version>
<version>3.38.0-SNAPSHOT</version>
<relativePath>extra/pom.xml</relativePath>
</parent>

Expand Down Expand Up @@ -345,11 +345,22 @@
<artifactId>postgresql</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>influxdb</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mock-server</groupId>
<artifactId>mockserver-client-java</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.influxdb</groupId>
<artifactId>influxdb-java</artifactId>
<version>2.23</version> <!-- works well with iZettle 1.1.1 and later -->
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ class AccountAuctionConfig {
BidAdjustment bidAdjustments
BidRounding bidRounding
Integer impressionLimit
@JsonProperty("secondarybidders")
List<BidderName> secondaryBidders

@JsonProperty("price_granularity")
PriceGranularityType priceGranularitySnakeCase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ enum ErrorType {
OPENX("openx"),
AMX("amx"),
AMX_UPPER_CASE("AMX"),
OPENX_ALIAS("openxalias"),

@JsonValue
final String value
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package org.prebid.server.functional.model.response.influx

class InfluxResponse {

List<InfluxResult> results
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package org.prebid.server.functional.model.response.influx

import com.fasterxml.jackson.annotation.JsonProperty

class InfluxResult {

@JsonProperty("statement_id")
Integer statementId
List<Series> series
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package org.prebid.server.functional.model.response.influx

class Series {

String name
Tags tags
List<String> columns
List<List<String>> values
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package org.prebid.server.functional.model.response.influx

class Tags {

String measurement
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import org.prebid.server.functional.model.response.cookiesync.CookieSyncResponse
import org.prebid.server.functional.model.response.cookiesync.RawCookieSyncResponse
import org.prebid.server.functional.model.response.currencyrates.CurrencyRatesResponse
import org.prebid.server.functional.model.response.getuids.GetuidResponse
import org.prebid.server.functional.model.response.influx.InfluxResponse
import org.prebid.server.functional.model.response.infobidders.BidderInfoResponse
import org.prebid.server.functional.model.response.setuid.SetuidResponse
import org.prebid.server.functional.model.response.status.StatusResponse
Expand All @@ -42,6 +43,8 @@ import java.time.format.DateTimeFormatter

import static io.restassured.RestAssured.given
import static java.time.ZoneOffset.UTC
import static org.prebid.server.functional.testcontainers.Dependencies.influxdbContainer


class PrebidServerService implements ObjectMapperWrapper {

Expand All @@ -59,10 +62,12 @@ class PrebidServerService implements ObjectMapperWrapper {
static final String HTTP_INTERACTION_ENDPOINT = "/logging/httpinteraction"
static final String COLLECTED_METRICS_ENDPOINT = "/collected-metrics"
static final String PROMETHEUS_METRICS_ENDPOINT = "/metrics"
static final String INFLUX_DB_ENDPOINT = "/query"
static final String UIDS_COOKIE_NAME = "uids"

private final PrebidServerContainer pbsContainer
private final RequestSpecification requestSpecification
private final RequestSpecification influxRequestSpecification
private final RequestSpecification adminRequestSpecification
private final RequestSpecification prometheusRequestSpecification

Expand All @@ -75,6 +80,8 @@ class PrebidServerService implements ObjectMapperWrapper {
this.pbsContainer = pbsContainer
requestSpecification = new RequestSpecBuilder().setBaseUri(pbsContainer.rootUri)
.build()
influxRequestSpecification = new RequestSpecBuilder().setBaseUri(pbsContainer.influxUri)
.build()
adminRequestSpecification = buildAndGetRequestSpecification(pbsContainer.adminRootUri, authenticationScheme)
prometheusRequestSpecification = buildAndGetRequestSpecification(pbsContainer.prometheusRootUri, authenticationScheme)
}
Expand Down Expand Up @@ -290,6 +297,16 @@ class PrebidServerService implements ObjectMapperWrapper {
decode(response.asString(), new TypeReference<Map<String, Number>>() {})
}

Map<String, Number> sendInfluxMetricsRequest() {
def response = given(influxRequestSpecification)
.queryParams(["db": influxdbContainer.getDatabase(),
"q" : "SELECT COUNT(count) FROM /.*/ WHERE count >= 1 GROUP BY \"measurement\""])
.get(INFLUX_DB_ENDPOINT)

checkResponseStatusCode(response)
collectInToMap(decode(response.getBody().asString(), InfluxResponse))
}

String sendPrometheusMetricsRequest() {
def response = given(prometheusRequestSpecification).get(PROMETHEUS_METRICS_ENDPOINT)

Expand Down Expand Up @@ -431,6 +448,15 @@ class PrebidServerService implements ObjectMapperWrapper {
}
}

Boolean isContainMetricByValue(String value) {
try {
PBSUtils.waitUntil({ sendInfluxMetricsRequest()[value] != null })
true
} catch (IllegalStateException ignored) {
false
}
}

private String getPbsLogsByValue(String value) {
pbsContainer.logs.split("\n").find { it.contains(value) }
}
Expand All @@ -454,4 +480,10 @@ class PrebidServerService implements ObjectMapperWrapper {
.setAuth(authScheme)
.build()
}

private static Map<String, Number> collectInToMap(InfluxResponse responseBody) {
responseBody?.results?.first()?.series?.collectEntries {
[(it.name): it.values?.first()?.getAt(1) as Integer]
} ?: [:]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package org.prebid.server.functional.testcontainers

import org.prebid.server.functional.testcontainers.container.NetworkServiceContainer
import org.prebid.server.functional.util.SystemProperties
import org.testcontainers.containers.InfluxDBContainer
import org.testcontainers.containers.MySQLContainer
import org.testcontainers.containers.Network
import org.testcontainers.containers.localstack.LocalStackContainer
Expand Down Expand Up @@ -34,6 +35,13 @@ class Dependencies {
.withInitScript("org/prebid/server/functional/db_psql_schema.sql")
.withNetwork(network)

static final InfluxDBContainer influxdbContainer = new InfluxDBContainer<>(DockerImageName.parse("influxdb:1.8.10"))
.withUsername("prebid")
.withPassword("prebid")
.withAuthEnabled(false)
.withDatabase("prebid")
.withNetwork(network)

static final NetworkServiceContainer networkServiceContainer = new NetworkServiceContainer(MOCKSERVER_VERSION)
.withNetwork(network)

Expand All @@ -44,13 +52,13 @@ class Dependencies {
localStackContainer = new LocalStackContainer(DockerImageName.parse("localstack/localstack:s3-latest"))
.withNetwork(network)
.withServices(S3)
Startables.deepStart([networkServiceContainer, mysqlContainer, localStackContainer]).join()
Startables.deepStart([networkServiceContainer, mysqlContainer, localStackContainer, influxdbContainer]).join()
}
}

static void stop() {
if (IS_LAUNCH_CONTAINERS) {
[networkServiceContainer, mysqlContainer, localStackContainer].parallelStream()
[networkServiceContainer, mysqlContainer, localStackContainer, influxdbContainer].parallelStream()
.forEach({ it.stop() })
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.prebid.server.functional.testcontainers

import org.testcontainers.containers.InfluxDBContainer
import org.testcontainers.containers.MySQLContainer
import org.testcontainers.containers.PostgreSQLContainer

Expand Down Expand Up @@ -100,7 +101,6 @@ LIMIT 1
"settings.database.idle-connection-timeout": "300"
].asImmutable()
}

static Map<String, String> getPostgreSqlConfig(PostgreSQLContainer postgres = Dependencies.postgresqlContainer) {
["settings.database.type" : "postgres",
"settings.database.host" : postgres.getNetworkAliases().get(0),
Expand Down Expand Up @@ -145,7 +145,7 @@ LIMIT 1
"currency-converter.external-rates.refresh-period-ms" : "900000"]
}

static Map<String,String> getTargetingConfig() {
static Map<String, String> getTargetingConfig() {
["settings.targeting.truncate-attr-chars": '255']
}

Expand Down
Loading