Skip to content

pbs rules engine module#6044

Open
bretg wants to merge 3 commits into
masterfrom
pbs-rules-engine
Open

pbs rules engine module#6044
bretg wants to merge 3 commits into
masterfrom
pbs-rules-engine

Conversation

@bretg
Copy link
Copy Markdown
Contributor

@bretg bretg commented May 22, 2025

🏷 Type of documentation

  • new bid adapter
  • update bid adapter
  • new feature
  • text edit only (wording, typos)
  • bugfix (code examples)
  • new examples

Documentation for the PBS Rules Engine module. See prebid/prebid-server#2541

@netlify
Copy link
Copy Markdown

netlify Bot commented May 22, 2025

Deploy Preview for prebid-docs-preview ready!

Name Link
🔨 Latest commit 9fda8fc
🔍 Latest deploy log https://app.netlify.com/projects/prebid-docs-preview/deploys/68628b977fd16700086b05e8
😎 Deploy Preview https://deploy-preview-6044--prebid-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@bretg bretg marked this pull request as draft May 22, 2025 14:57
@bretg bretg marked this pull request as ready for review June 30, 2025 13:05
@ChrisHuie ChrisHuie self-requested a review July 2, 2025 20:06

- Runs only at the Processed-Auction stage.
- Only delivers functions for including and excluding bidders.
- Does not necessarily reload config periodically like the Floors feature, making integration with a backend machine learning system more challenging.
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Go can reload config periodically assuming the host is somehow taking the machine learning system data and using it to update the account with new rules and the account fetcher is configured to be periodically fetched. Is this an example of how you envision it integrating with a backend machine learning system?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The Floors feature takes a URL and polls it periodically for updates. i.e. there's no work for the Host Company to update data.

How about to make this clear we say something like "Unlike the Floors feature, the rules module does not fetch data on an external URL. To update the rules, the Host Company needs to merge updated data into the account system."

Comment on lines +59 to +60
"hooks": {
"modules": {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I thought the hooks.enabled flag needs to be set:

"hooks": {
    "enabled": true

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@And1sS - is this the same for PBS-Java?

{
"hooks": {
"modules": {
"pb-rules-engine": {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This should be modules.vendor.module:

"modules": {
    "prebid": {
        "rules-engine": {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@And1sS - same for PBS-J?

"modules": {
"pb-rules-engine": {
"enabled": true,
"timestamp": "20250314 00:00:00",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This is not currently implemented in Go but I think we should leave it in the docs and we will support it. Right now Go is hashing the fetched config and comparing it against a cached hash to determine if there is a change but we will add timestamp support.

Comment thread prebid-server/pbs-modules/rules-engine.md
"results": [{
"function": "excludeBidders",
"args": [{
"bidders": [],
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

As mentioned earlier, Go is considering it an error when bidders is empty. Couldn't you just omit this set of conditions in which case the default would be executed? I guess perhaps this has value in case you want to specify defaults but then not apply those defaults in certain instances like this. What do you think?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Right - the default might be to remove bidderA, and one of the leaves says not to remove anything.

}
```

And here's how these scenarios would play out in various runtime conditions:
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

"And here's how these scenarios would play out in various runtime conditions given the following request:"

Then we need to add the request here with the two imps as that is missing.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The test request in the PRD is quite large. How about we make a copy of a test JSON file available, link to it, and then note that it's just a template for these test requests?

Comment thread prebid-server/pbs-modules/rules-engine.md
We recommend placing the execution plan at the host level so all accounts have the module enabled.

```json5
"execution-plan": {
Copy link
Copy Markdown

@bsardo bsardo Sep 19, 2025

Choose a reason for hiding this comment

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

Is this called host-execution-plan in Java? It is host_execution_plan in Go.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

"groups": [{
"timeout": 10,
"hook-sequence": [{
"module-code": "rules-engine",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Isn't this supposed to be of the format vendor.module_name in which case "prebid.rules-engine"?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@bsardo bsardo self-assigned this Sep 19, 2025
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.

3 participants