Skip to content
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

Extending the Real Time Data Module #5519

Merged
merged 34 commits into from
Aug 19, 2020
Merged

Extending the Real Time Data Module #5519

merged 34 commits into from
Aug 19, 2020

Conversation

omerDotan
Copy link
Contributor

Real time data module according to -
#4610

browsi sub module for real time data,
new hook bidsBackCallback,
fix for config unsubscribe
configure submodule on submodules.json
browsi sub module for real time data,
new hook bidsBackCallback,
fix for config unsubscribe
configure submodule on submodules.json
# Conflicts:
#	modules/browsiRtdProvider.js
# Conflicts:
#	modules/browsiRtdProvider.js
#	modules/rtdModule/index.js
modules/rtdModule/index.js Outdated Show resolved Hide resolved
/**
* @property
* @summary delay auction for this sub module
* @name ModuleConfig#waitForIt
Copy link
Collaborator

Choose a reason for hiding this comment

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

would renaming waitForIt to isAsync express the intention more clearly ?

Copy link
Contributor Author

@omerDotan omerDotan Aug 2, 2020

Choose a reason for hiding this comment

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

all are async, so it might be confusing. please see comment on the second conversation

const callbackExpected = subModules.length;
let dataReceived = [];
export function getProviderData(adUnits, callback) {
const mustWaitSubModulesLength = subModules.filter(sm => sm.config && sm.config.waitForIt).length;
Copy link
Collaborator

Choose a reason for hiding this comment

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

would asyncSubmodulesCount be a more expressive var name ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

all submodules are async
the wait for is actually a way to say what submodules are less important - meaning we prefer not to delay the auction any more for them

I did change the names a bit, let me know what you think

Copy link
Collaborator

Choose a reason for hiding this comment

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

I understand now thank you so much for the clarification! I think "topPriority" would be a good term; it might be easier for future readers

export function getProviderData(adUnits, callback) {
const mustWaitSubModulesLength = subModules.filter(sm => sm.config && sm.config.waitForIt).length;
let callbackExpected = mustWaitSubModulesLength || subModules.length;
const mustHaveModules = mustWaitSubModulesLength > 0;
Copy link
Collaborator

Choose a reason for hiding this comment

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

how about isAsync or mustWait as var name alternatives ? At first I didn't understand what mustHaveModules meant

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed the names a bit and added comments on the function, hope it makes things more clear

@karimMourra
Copy link
Collaborator

@omerBrowsi an integration test failed because array.find is not supported. This is fixed in 34b9f9b

Copy link
Collaborator

@jsnellbaker jsnellbaker left a comment

Choose a reason for hiding this comment

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

I think on the whole this looks okay. I did have a questions/concern on one part. Please see in-line comments below.

Thanks for putting this together.

let subModulesByOrder = [];
_dataProviders.forEach(provider => {
const sm = subModules.find(s => s.name === provider.name);
const initResponse = sm && sm.init && sm.init(provider, gdprDataHandler.getConsentData(), uspDataHandler.getConsentData()) !== 'failure';
Copy link
Collaborator

Choose a reason for hiding this comment

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

To clarify on the GDPR and USP data, are we sure that in the sequence of things that this data would be available by the time the submodule's init functions are called?

This initSubModules function is loaded as part of the overall rtdModule's init(), which in turn is loaded as the file is loaded.

But the consent information is obtained once the requestBids call chain starts, which should be after this code here has already executed. So could there be a scenario here where these consent params in the sm.init wouldn't have the real data? Or am I misreading something?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, you are correct
I added a hook so it will run before 'makeBidRequests', if you think of a better solution please let me know

@lgtm-com
Copy link

lgtm-com bot commented Aug 2, 2020

This pull request introduces 1 alert when merging 735e8e9 into 477fe0c - view on LGTM.com

new alerts:

  • 1 for Expression has no effect

@karimMourra
Copy link
Collaborator

Hi @omerBrowsi and @jsnellbaker is there an ETA for when this branch will be merged ? It's currently a blocker for #5537

Copy link
Contributor

@pm-harshad-mane pm-harshad-mane left a comment

Choose a reason for hiding this comment

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

Can we separate the test cases for RTD Module and BrowsiViewability(RTD Sub-module)?

@Asafsham
Copy link
Collaborator

Hey @robertrmartinez, would you be able to get to this PR? tools PMC really wants to push it asap.

@bretg bretg removed the request for review from robertrmartinez August 19, 2020 18:36
@bretg
Copy link
Collaborator

bretg commented Aug 19, 2020

We already have two reviewers, so taking Bobby off as a required reviewer. @Asafsham - we're going to a document at some point soon: a 'how to write an RTD module' guide similar to https://docs.prebid.org/dev-docs/integrate-with-the-prebid-analytics-api.html

But I'm not going to call that a blocker. So if @pm-harshad-mane is willing to push his unit test splitting request to a future PR, this can be merged.

Copy link
Contributor

@pm-harshad-mane pm-harshad-mane left a comment

Choose a reason for hiding this comment

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

As discussed with @bretg , unit test cases will be implemented in a separate PR.
@omerBrowsi please add unit-test cases soon :-)

Copy link
Collaborator

@bretg bretg left a comment

Choose a reason for hiding this comment

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

I'd like for this to work like the User ID sub-modules: when someone builds the 'browsiRtdProvider', the RTD core is automatically added. Am going to assume that's the case as I see this in https://github.com/prebid/Prebid.js/blob/master/modules/.submodules.json

src/targeting.js Show resolved Hide resolved
@bretg bretg merged commit 23af840 into prebid:master Aug 19, 2020
@Asafsham
Copy link
Collaborator

@bretg @pm-harshad-mane We are working on the Docs, should be ready be Monday.

@omerDotan omerDotan mentioned this pull request Aug 23, 2020
1 task
@omerDotan
Copy link
Contributor Author

@bretg I opened pull request for a bug related to this
#5651
Can we have it approved and merged before release?

BrightMountainMediaInc pushed a commit to BrightMountainMediaInc/Prebid.js that referenced this pull request Sep 14, 2020
* real time data module,
browsi sub module for real time data,
new hook bidsBackCallback,
fix for config unsubscribe

* change timeout&primary ad server only to auctionDelay
update docs

* support multiple providers

* change promise to callbacks
configure submodule on submodules.json

* bug fixes

* use Prebid ajax

* tests fix

* browsi real time data provider improvements

* real time data module,
browsi sub module for real time data,
new hook bidsBackCallback,
fix for config unsubscribe

* change timeout&primary ad server only to auctionDelay
update docs

* support multiple providers

* change promise to callbacks
configure submodule on submodules.json

* bug fixes

* use Prebid ajax

* tests fix

* browsi real time data provider improvements

* RTD module extend prebid#4610

* add hook for submodule init
variables naming
BrightMountainMediaInc added a commit to BrightMountainMediaInc/Prebid.js that referenced this pull request Sep 14, 2020
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.

7 participants