Skip to main content

Bring traffic shaping to your own cloud

Project description

🪡 Greenbids Tailor

Bring traffic shaping to your own cloud!

Greenbids logo

GNU AGPL v3 License

🍱 Integration

Sequence Diagram

Following the interaction diagram provided by the OpenRTB API Specification (version 2.5) (§2) here is an example of where the Greenbids Tailor product must be called.

sequenceDiagram
    participant Publisher
    activate Publisher

    box rgba(128, 128, 128, 0.33) Partner Network
        participant SSP as RTB Exchange
        participant GB as Greenbids Tailor
    end

    Publisher ->>+ SSP: 0. Ad Request

    rect rgba(30, 183, 136, 0.66)
    SSP ->>+ GB: PUT / @[Fabric, ...]
    GB -->>- SSP: 200 @[Fabric, ...]
    end

    loop for each request where fabric.prediction.shouldSend
        SSP ->>+ Bidder : 1. Bid Request
        alt 200
        Bidder -->> SSP: Bid Response
        else 204
        Bidder -->>- SSP: No Response
        end
    end

    opt fabric.prediction.<br>isExploration
        rect rgba(30, 183, 136, 0.66)
            SSP -)+ GB: POST / @[Fabric, ...]
            GB -->>- SSP: 200
        end
    end
    GB --) greenbids.ai: telemetry

    note over Publisher,SSP: Continue auction process
    deactivate SSP
    deactivate Publisher

Example

Here is a Python-like pseudocode example of integration.

def handleAdRequest(adRequest):
  # Call the Greenbids Tailor PUT endpoint to filter the list of possible bidders
  # This is a local call (localhost or local network) to ensure low latency
  fabrics = requests.put("http://tailor:8000", json=[
    {
      "featureMap": {
        "bidder": bidder.name,
        "device": adRequest.get("device", "unknown"),
        "userId": adRequest.get("user_id", "unknown"),
        "secretIngredient": "our own secret ingredient",
        "greatAnswer": 42,
      }
    }
    for bidder in BIDDER_LIST
  ]).json()

  # Do your regular calls here to send a bid requests to the selected bidders
  for fabric in fabrics:
    if not fabric["prediction"]["shouldSend"]:
        # Skip any bidder that as too few response probability
        continue

    # Create a bid request and send it to the bidder
    rsp = requests.post(bidder.url, json={...})

    # Store the outcome in the fabric
    fabric["groundTruth"]["hasResponse"] = (rsp.status_code != 204)

  # Call the Greenbids Tailor POST endpoint for exploration
  if fabrics[0]["prediction"]["isExploration"]:
    # You may use a fire-and-forget mechanism
    requests.post("http://tailor:8000", json=fabrics)

  # Continue the auction process
  ...

Routes

See API documentation online.

🚀 Deployment

Depending on your current stack, find the best way to deploy this service.

🐍 Executable

pip install greenbids-tailor
greenbids-tailor

We advise you to create a virtual environment to avoid any dependency mismatch on your system.

🐳 Docker

docker run -P -d --name greenbids-tailor ghcr.io/greenbids/tailor:latest
docker port greenbids-tailor

☸ Helm

helm upgrade --install --create-namespace --namespace greenbids tailor oci://ghcr.io/greenbids/charts/tailor

You have to authenticate your Kubernetes cluster against GitHub container registry, and pass the name of the secret through --set 'imagePullSecrets[0].name=<your-secret-name>'.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

greenbids_tailor-0.1.2-py3-none-any.whl (25.6 kB view details)

Uploaded Python 3

File details

Details for the file greenbids_tailor-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for greenbids_tailor-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1a2a8e2a7c5fdbe10ce0c0a1893cea258fa0401ff8b784c9465a65802b2faa62
MD5 590c64ac7967bc722f97cc6410435c20
BLAKE2b-256 5985dc49924e72904b474990d41c8a70ed9ca569174dc2233cd85b69396cb443

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page