Skip to content

Port Kueez: New Adapter #3930

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
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

kim-ng93
Copy link
Contributor

@kim-ng93 kim-ng93 commented Apr 23, 2025

🔧 Type of changes

  • new bid adapter
  • bid adapter update
  • new feature
  • new analytics adapter
  • new module
  • module update
  • bugfix
  • documentation
  • configuration
  • dependency update
  • tech debt (test coverage, refactorings, etc.)

✨ What's the context?

What's the context for the changes?
Port Kueez adapter from Go

🧠 Rationale behind the change

Why did you choose to make these changes? Were there any trade-offs you had to consider?

🔎 New Bid Adapter Checklist

  • verify email contact works
  • NO fully dynamic hostnames
  • geographic host parameters are NOT required
  • direct use of HTTP is prohibited - implement an existing Bidder interface that will do all the job
  • if the ORTB is just forwarded to the endpoint, use the generic adapter - define the new adapter as the alias of the generic adapter
  • cover an adapter configuration with an integration test

🧪 Test plan

How do you know the changes are safe to ship to production?

🏎 Quality check

  • Are your changes following our code style guidelines?
  • Are there any breaking changes in your code?
  • Does your test coverage exceed 90%?
  • Are there any erroneous console logs, debuggers or leftover code in your changes?

@kim-ng93 kim-ng93 self-assigned this Apr 23, 2025
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a new bid adapter for Kueez by porting the existing Go implementation to Java. Key changes include:

  • Implementation of the KueezBidder and its corresponding Spring configuration.
  • Addition of unit and integration tests to cover the adapter’s functionality.
  • Inclusion of a new YAML configuration file for Kueez adapter settings.

Reviewed Changes

Copilot reviewed 6 out of 12 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/test/java/org/prebid/server/it/KueezTest.java Integration test for bidding auction flow using Kueez adapter
src/test/java/org/prebid/server/bidder/kueezrtb/KueezBidderTest.java Unit tests verifying HTTP requests, header configuration, error handling, and bid type processing
src/main/resources/bidder-config/kueezrtb.yaml Configuration file for the Kueez adapter endpoints and usersync settings
src/main/java/org/prebid/server/spring/config/bidder/KueezConfiguration.java Spring configuration class binding YAML properties and creating bidder dependencies
src/main/java/org/prebid/server/proto/openrtb/ext/request/kueezrtb/KueezImpExt.java POJO for mapping bidder-specific Imp extension with JSON property 'cId'
src/main/java/org/prebid/server/bidder/kueezrtb/KueezBidder.java Implementation of the Kueez bid adapter handling HTTP requests and bid response processing
Files not reviewed (6)
  • src/main/resources/static/bidder-params/kueezrtb.json: Language not supported
  • src/test/resources/org/prebid/server/it/openrtb2/kueezrtb/test-auction-kueezrtb-request.json: Language not supported
  • src/test/resources/org/prebid/server/it/openrtb2/kueezrtb/test-auction-kueezrtb-response.json: Language not supported
  • src/test/resources/org/prebid/server/it/openrtb2/kueezrtb/test-kueezrtb-bid-request.json: Language not supported
  • src/test/resources/org/prebid/server/it/openrtb2/kueezrtb/test-kueezrtb-bid-response.json: Language not supported
  • src/test/resources/org/prebid/server/it/test-application.properties: Language not supported

Comment on lines 64 to 65
throw new PreBidException(e.getMessage());
}
Copy link
Preview

Copilot AI Apr 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider enhancing the error message by adding contextual information (e.g. indicating that the error occurred while parsing the Imp extension) to aid future debugging efforts.

Suggested change
throw new PreBidException(e.getMessage());
}
throw new PreBidException("Failed to parse Imp extension: " + e.getMessage());

Copilot uses AI. Check for mistakes.

@kim-ng93 kim-ng93 linked an issue Apr 23, 2025 that may be closed by this pull request
"required": [
"cId"
]
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Golang version of this schema https://github.com/prebid/prebid-server/blob/0b91679fe610a50f898daaf3feb2a33440a33b26/static/bidder-params/kueezrtb.json#L17 restricts additional properties, where is the actual version of the schema?

Comment on lines 110 to 120
private static BidType getMediaTypeForBid(Bid bid) {
final Integer mType = bid.getMtype();
if (mType == null) {
throw new PreBidException("Missing MType for bid: " + bid.getId());
}
return switch (mType) {
case 1 -> BidType.banner;
case 2 -> BidType.video;
default -> throw new PreBidException("Could not define bid type for imp: " + bid.getImpid());
};
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

    private static BidType getBidType(Integer mType) {
        return switch (mType) {
            case 1 -> BidType.banner;
            case 2 -> BidType.video;
            case null, default -> throw new PreBidException("Could not define bid type for imp: " + bid.getImpid());
        };
    }

import java.util.List;
import java.util.Objects;

public class KueezBidder implements Bidder<BidRequest> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's better to make this file and any other related start with KuezzRtb

Comment on lines 153 to 172
@Test
public void makeBidsShouldReturnErrorWhenImpTypeIsNotSupported() throws JsonProcessingException {
// given
final Bid bannerBid = Bid.builder().id("bidId1").impid("id1").mtype(1).build();
final Bid bidWithoutMtype = Bid.builder().id("bidId2").impid("id2").mtype(null).build();
final Bid audioBid = Bid.builder().id("bidId3").impid("id3").mtype(3).build();
final Bid nativeBid = Bid.builder().id("bidId4").impid("id4").mtype(4).build();

final BidderCall<BidRequest> httpCall = givenHttpCall(
givenBidResponse(bannerBid, bidWithoutMtype, audioBid, nativeBid));

// when
final Result<List<BidderBid>> result = target.makeBids(httpCall, null);
// then
assertThat(result.getErrors()).containsExactlyInAnyOrder(
badServerResponse("Missing MType for bid: bidId2"),
badServerResponse("Could not define bid type for imp: id3"),
badServerResponse("Could not define bid type for imp: id4"));
assertThat(result.getValue()).containsOnly(BidderBid.of(bannerBid, banner, "USD"));
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please split this test into separate ones based on mtype

Comment on lines 583 to 584
adapters.kueezrtb.enabled=true
adapters.kueezrtb.endpoint=http://localhost:8090/kueezrtb-exchange/
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please follow an alphabetical order here

}

@Test
public void makeBidsShouldReturnBidsWithTypesSuccessfully() throws JsonProcessingException {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please split this one as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Port PR from PBS-Go: New Adapter: Kueez
4 participants