-
Notifications
You must be signed in to change notification settings - Fork 183
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: Add account level config for modules RTD, analytics #3596
base: master
Are you sure you want to change the base?
Greenbids: Add account level config for modules RTD, analytics #3596
Conversation
private Partner parseAccountConfig(AuctionContext auctionContext) { | ||
final Map<String, ObjectNode> modules = Optional.ofNullable(auctionContext) | ||
.map(AuctionContext::getAccount) | ||
.map(Account::getHooks) | ||
.map(AccountHooksConfiguration::getModules) | ||
.orElse(null); | ||
} | ||
|
||
private boolean isNotEmptyObjectNode(JsonNode analytics) { | ||
return analytics != null && analytics.isObject() && !analytics.isEmpty(); | ||
Partner partner = null; | ||
if (modules != null && modules.containsKey("greenbids")) { | ||
final ObjectNode moduleConfig = modules.get("greenbids"); | ||
partner = toPartner(moduleConfig); | ||
} | ||
|
||
return partner; |
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.
you can skip this parsing, and just call toPartner(invocationContext.accountConfig())
and you'll get what you need (of course some null checks and json parsing exception should be handled)
also if the Partner is considered to be a representation of the account config, I suggest rename it to the Config or GreenbidsConfig (something like that)
@@ -11,6 +11,9 @@ | |||
@Value(staticConstructor = "of") | |||
public class Partner { | |||
|
|||
@JsonProperty(required = true) | |||
Boolean enabled; |
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.
not sure you need this particular flag, because it's possible to enable/disable the module using execution plan or hooks.admin.module-execution properties on the account or host-level config and the core skips execution of the module for you
} | ||
|
||
return greenbidsPrebidExt; | ||
} |
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.
private GreenbidsPrebidExt parseAccountConfig(Account account) {
return Optional.ofNullable(account)
.map(Account::getAnalytics)
.map(AccountAnalyticsConfig::getModules)
.map(analyticsModules -> analyticsModules.get(name()))
.map(this::toGreenbidsPrebidExt)
.orElse(null);
}
🔧 Type of changes
✨ What's the context?
As discussed with @bretg and @jbogp we need to add extraction of modules params from account level config for both RTD module and analytics reporter. At the same time if the params are defined in
BidRequestExt
it should take precedent before account level config. This makes modules integration more publisher friendly🧠 Rationale behind the change
account/id
identifies account for specific publisher -> so if we define a config for a specific account it means it should correspond to the unique publisher id = pbuid.Setup of
default-account-config
for Greenbids example inprebid-config-with-module.yaml
should look like thisThe modules can extract fields of Account class from AuctionContext at hook call (not on spring boot)
Then depending on the calling module we get analytics or RTD
Map[String, ObjectNode] modules
and parse it from json.🔎 New Bid Adapter Checklist
🧪 Test plan
I have introduced a specific test case in Greenbids analytics reporter test to fallback to account level config if bid request ext config is not defined:
shouldReceiveValidResponseAndFallbackToAccountLevelConfigWhenPartnerNotActivatedInBidRequest
For RTD module have modified the existing test case when partner not activated on bid request ext -> then fallback to account level config and proceed with the filtering
callShouldFilterBiddersAndFallbackToAccountLevelConfigWhenPartnerNotActivatedInBidRequest
🏎 Quality check