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

OTT-806 :: Adpod Support (CTV) #532

Merged
merged 130 commits into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from 80 commits
Commits
Show all changes
130 commits
Select commit Hold shift + click to select a range
7a59edc
OTT-1105 :: Added functionality to read adpod configs
pm-nikhil-vaidya Jun 27, 2023
1da03b5
Added impression generation algorithms
pm-nikhil-vaidya Jul 17, 2023
1e23d3e
support for adpod exclusion and auction logic
pm-nikhil-vaidya Aug 4, 2023
e761f58
fix import issues
pm-nikhil-vaidya Aug 4, 2023
deaa6eb
Merge branch 'ci' into OTT-806-Adpod-2
pm-nikhil-vaidya Aug 4, 2023
e8b42c6
support to parse GET calls
pm-nikhil-vaidya Aug 12, 2023
38108a4
Merge branch 'ci' into OTT-806-Adpod-2
pm-nikhil-vaidya Aug 12, 2023
b7c47ac
Added Response handling for each endpoint
pm-nikhil-vaidya Aug 19, 2023
e3f3607
Added json response handling
pm-nikhil-vaidya Aug 21, 2023
e310f5d
support for redirect url in json GET endpoint
pm-nikhil-vaidya Aug 21, 2023
e83baca
Modified middleware implementation
pm-nikhil-vaidya Aug 31, 2023
fa50487
Modified the app and device implementation
pm-nikhil-vaidya Sep 1, 2023
4989eb9
Handle writting headers in final response
pm-nikhil-vaidya Sep 4, 2023
bde0505
Fixed panic due to devicetype
pm-nikhil-vaidya Sep 4, 2023
be04815
fixed seat non bid appending in response
pm-nikhil-vaidya Sep 4, 2023
5d78ece
fixed panics
pm-nikhil-vaidya Sep 5, 2023
4cbbde9
Merge branch 'ci' into OTT-806-Adpod-2
pm-nikhil-vaidya Sep 5, 2023
d7cc10b
added recovery when middleware panics
pm-nikhil-vaidya Sep 12, 2023
7d1b27a
Merge branch 'ci' into OTT-806-Adpod-2
pm-nikhil-vaidya Sep 13, 2023
e79521d
added enabled flag in Ow module config
pm-nikhil-vaidya Sep 14, 2023
c6cc36b
Minor changes
pm-nikhil-vaidya Sep 25, 2023
265520f
Added error logger and updated pointers in middleware
pm-nikhil-vaidya Sep 25, 2023
8474eaf
Fixed redirect issue when debug is enabled
pm-nikhil-vaidya Sep 26, 2023
43f99b5
Added debug targetting in the response
pm-nikhil-vaidya Oct 3, 2023
25d26de
Moved targetting into debug mode
pm-nikhil-vaidya Oct 11, 2023
69c8589
Merge branch 'ci' into OTT-806-Adpod-2
pm-nikhil-vaidya Oct 16, 2023
bfb2a86
Modified Winning bid structure
pm-nikhil-vaidya Oct 16, 2023
7ad45df
Fixed import statement
pm-nikhil-vaidya Oct 16, 2023
4fee51f
Moved cache to hooks from middleware
pm-nikhil-vaidya Oct 27, 2023
e982a6c
Merge branch 'ci' into OTT-806-Adpod-2
pm-nikhil-vaidya Oct 27, 2023
e90ec6f
Added request wrapper to modify impressions
pm-nikhil-vaidya Oct 27, 2023
151ecac
removed unmarshalling of bid id
pm-nikhil-vaidya Oct 28, 2023
b7b8c88
fix: ctv ortb endpoint responsing with combined bid in case of normal…
pm-nikhil-vaidya Nov 2, 2023
279eb32
Modified json get endpoint behaviour
pm-nikhil-vaidya Nov 6, 2023
c611d96
Modified error messages
pm-nikhil-vaidya Nov 6, 2023
9ffc0c7
Addressed code review comments
pm-nikhil-vaidya Nov 20, 2023
70742db
Merge branch 'ci' into OTT-806-Adpod-2
pm-nikhil-vaidya Nov 21, 2023
ffd5bca
fixed job failure issues
pm-nikhil-vaidya Nov 21, 2023
cf0e768
Moved caching for json in middleware
pm-nikhil-vaidya Nov 21, 2023
b91d9ef
Code refactoring
pm-nikhil-vaidya Nov 24, 2023
e5baa0b
Include brand category and support deals changes added
pm-nikhil-vaidya Nov 24, 2023
0fa6317
Modified the package name
pm-nikhil-vaidya Nov 24, 2023
a27c2af
Added vast package
pm-nikhil-vaidya Nov 24, 2023
30b55b3
Modified the error message
pm-nikhil-vaidya Nov 24, 2023
623567e
Fixed json error response
pm-nikhil-vaidya Nov 24, 2023
fbfbb1f
Moved get method ORTB convertion to middleware
pm-nikhil-vaidya Nov 27, 2023
680a0a2
Added metrics for monitoring
pm-nikhil-vaidya Nov 27, 2023
0065f2e
Modified error responses
pm-nikhil-vaidya Nov 29, 2023
0cb7bcc
fixed metrics panic
pm-nikhil-vaidya Nov 29, 2023
e79866b
Fixed invalid commits
pm-nikhil-vaidya Nov 29, 2023
919c590
Merge branch 'ci' into OTT-806-Adpod-2
pm-nikhil-vaidya Nov 30, 2023
36843cf
Add error message when debug is enabled
pm-nikhil-vaidya Nov 30, 2023
ae1f68d
Fixed error message in header for vast
pm-nikhil-vaidya Dec 5, 2023
4636404
Fixed error responses scenarios
pm-nikhil-vaidya Dec 6, 2023
26f428f
Revert "Fixed error responses scenarios"
pm-nikhil-vaidya Dec 6, 2023
59032ca
Changed vast error response
pm-nikhil-vaidya Dec 7, 2023
d8b1dca
Fixed pubId and slot disabled related issues
pm-nikhil-vaidya Dec 14, 2023
16e4a84
Fixed issues when request is empty and some code review comments addr…
pm-nikhil-vaidya Dec 19, 2023
2c8549d
Fixed vast bidder and json targetting issues
pm-nikhil-vaidya Dec 20, 2023
cf740bb
Fixed tracker and vast biddder issues
pm-nikhil-vaidya Dec 21, 2023
69f9d9f
Fixed Vast bidder kgpv and aprc
pm-nikhil-vaidya Jan 3, 2024
41181e9
Fixed default bids for vast bidders
pm-nikhil-vaidya Jan 3, 2024
2e33956
Added key val changes
pm-nikhil-vaidya Jan 9, 2024
360acea
Merge branch 'ci' into OTT-806-Adpod-2
pm-nikhil-vaidya Jan 10, 2024
fb7e946
Fixed KeyVal data type mismatch
pm-nikhil-vaidya Jan 10, 2024
5ede943
Add schain code in OW module (#689)
Ankit-Pinge Jan 11, 2024
70dc65f
Fixed failing unit test cases
pm-nikhil-vaidya Jan 15, 2024
b17e5a6
Removed v suffix from adsize
pm-nikhil-vaidya Jan 16, 2024
1aeed93
fixed cat_dur and enforcement not getting passed
pm-nikhil-vaidya Jan 19, 2024
d84c5a5
Merge branch 'ci' into OTT-806-Adpod-2
pm-nikhil-vaidya Jan 19, 2024
ee4efda
Fixed redirect issue
pm-nikhil-vaidya Jan 23, 2024
488471a
Fixed rediect when provided through UI
pm-nikhil-vaidya Jan 24, 2024
42f9557
Merge remote-tracking branch 'origin/ci' into OTT-806-Adpod-2
pm-nikhil-vaidya Jan 24, 2024
5daf8c8
Removed adpod extension from request
pm-nikhil-vaidya Jan 25, 2024
161212c
fixed adpod extension and deal tier when support deals is false
pm-nikhil-vaidya Jan 25, 2024
934148a
Fixed targetting key for dealtier
pm-nikhil-vaidya Jan 29, 2024
ce67cac
OTT-1585: Dur is missing in logger for test request. (#701)
Pubmatic-Dhruv-Sonone Feb 6, 2024
abd55c1
OTT-1559: Transparency object is not getting passed in prebid modules…
Pubmatic-Dhruv-Sonone Feb 8, 2024
b172edd
Fixing OTT-1585
Pubmatic-Dhruv-Sonone Feb 8, 2024
00291d7
Fixed returnAllbid status scenario
pm-nikhil-vaidya Feb 8, 2024
ba6ab55
Fixed impression id issue
pm-nikhil-vaidya Feb 9, 2024
689aeb5
Fixed wiid not passing for pubmatic alias
pm-nikhil-vaidya Feb 12, 2024
644e772
Merge branch 'ci' into OTT-806-Adpod-2
pm-nikhil-vaidya Feb 12, 2024
ee43bc6
Merge branch 'ci' into OTT-806-Adpod-2
pm-nikhil-vaidya Feb 12, 2024
6b883cc
Fixed unit test cases
pm-nikhil-vaidya Feb 13, 2024
568ee35
Addressed review comments
pm-nikhil-vaidya Feb 14, 2024
53a02ef
Adding changes for Inline HB - Redirect for POST (#709)
Pubmatic-Dhruv-Sonone Feb 14, 2024
78cada0
Set correct duration for adpod bids
Pubmatic-Dhruv-Sonone Feb 14, 2024
06af960
OTT-1631:: Vast bidders call according to durations
pm-nikhil-vaidya Feb 15, 2024
4c3ab16
Fixing unit test
Pubmatic-Dhruv-Sonone Feb 15, 2024
2827def
fixed videoAdDuration for ctv test requests
pm-nikhil-vaidya Feb 19, 2024
146b247
Added panic metrics in prebid core
pm-nikhil-vaidya Feb 22, 2024
02ab20b
Merge branch 'ci' into OTT-806-Adpod-2
pm-nikhil-vaidya Feb 23, 2024
f39d25d
Logger.Dur for Non Adpod when req.test=1
Pubmatic-Dhruv-Sonone Feb 27, 2024
65f2e00
GetWrapperExt fix
Pubmatic-Dhruv-Sonone Feb 27, 2024
67172c6
Merge branch 'ci' into OTT-806-Adpod-2
pm-nikhil-vaidya Feb 28, 2024
42daafa
OTT-1654: Impression are getting formed for inline hb when nothing is…
Pubmatic-Dhruv-Sonone Feb 28, 2024
dfc622f
Fixed Unit test cases
pm-nikhil-vaidya Feb 29, 2024
90fbc6a
fixed nbr getting set to 502 for adpod bids
pm-nikhil-vaidya Feb 29, 2024
85b72c6
OTT-1655: Dur missing in Logger
Pubmatic-Dhruv-Sonone Mar 1, 2024
c80df91
OTT-1658
Pubmatic-Dhruv-Sonone Mar 5, 2024
d7444da
OTT-1654: Fix
Pubmatic-Dhruv-Sonone Mar 7, 2024
7628dbd
OTT-1669: NBR is wrong for missing publisher in get call
Pubmatic-Dhruv-Sonone Mar 7, 2024
fcfb7fb
Added metrics for bad request in middleware
pm-nikhil-vaidya Mar 8, 2024
597b588
Logged category irrespective of endpoint
pm-nikhil-vaidya Mar 8, 2024
ec74cdf
OTT-1670: ifa_type is not getting passed to resolved request when req…
Pubmatic-Dhruv-Sonone Mar 8, 2024
eb46f56
Fixing UT
Pubmatic-Dhruv-Sonone Mar 11, 2024
f4d8cdd
Changing NBR for invalid impression extension
Pubmatic-Dhruv-Sonone Mar 12, 2024
d6e3aea
Removing ifa_type and session_id from device ext in case of invalid type
Pubmatic-Dhruv-Sonone Mar 13, 2024
1d8ff0a
Added targetting keys only for json endpoint
pm-nikhil-vaidya Mar 13, 2024
31426ca
Fix for wrong dur in logger
Pubmatic-Dhruv-Sonone Mar 14, 2024
281efe0
Added test cases and fixed slot size for video impressions
pm-nikhil-vaidya Mar 15, 2024
50a76ad
Fixing panic for in-app endpoint
Pubmatic-Dhruv-Sonone Mar 18, 2024
5ebb0c0
Merge branch 'ci' into OTT-806-Adpod-2
pm-nikhil-vaidya May 27, 2024
caab7ea
Merge branch 'ci' into OTT-806-Adpod-2
pm-nikhil-vaidya May 27, 2024
4763e18
Fixed failing unit test cases
pm-nikhil-vaidya May 28, 2024
6d7fdbf
Fixed imports
pm-nikhil-vaidya May 31, 2024
fcef463
Added IsAdpodRequest flag back
pm-nikhil-vaidya Jun 3, 2024
83cd46a
Merge branch 'ci' into OTT-806-Adpod-2
pm-nikhil-vaidya Jun 6, 2024
66e95bc
Merge branch 'ci' into OTT-806-Adpod-2
pm-nikhil-vaidya Jun 14, 2024
a15aa26
Fixed non-empty seatbids in inapp case
pm-nikhil-vaidya Jun 20, 2024
ec894fb
Merge branch 'ci' into OTT-806-Adpod-2
pm-nikhil-vaidya Jun 24, 2024
630ea30
Fixed failing test cases
pm-nikhil-vaidya Jun 24, 2024
1ff3482
Fixed dur in tracker when slot type is native
pm-nikhil-vaidya Jun 25, 2024
6339b51
Merge branch 'ci' into OTT-806-Adpod-2
pm-nikhil-vaidya Jun 25, 2024
e6da4da
Fixed panic when key val is not provided
pm-nikhil-vaidya Jun 27, 2024
d486e2d
Duration only added when bid mtype is video
pm-nikhil-vaidya Jun 27, 2024
026af9d
Instead of Mtype used bidext.Prebid.Type to identify bid type
pm-nikhil-vaidya Jun 27, 2024
28b99b2
OTT-1886: Drop the EID object if the ID value is empty, to avoid bad …
Pubmatic-Supriya-Patil Jul 1, 2024
6707407
Merge branch 'ci' into OTT-806-Adpod-2
pm-nikhil-vaidya Jul 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 44 additions & 15 deletions analytics/pubmatic/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"github.com/prebid/openrtb/v19/openrtb3"
"github.com/prebid/prebid-server/analytics"
"github.com/prebid/prebid-server/hooks/hookexecution"
"github.com/prebid/prebid-server/modules/pubmatic/openwrap"
"github.com/prebid/prebid-server/modules/pubmatic/openwrap/customdimensions"
"github.com/prebid/prebid-server/modules/pubmatic/openwrap/models"
"github.com/prebid/prebid-server/modules/pubmatic/openwrap/utils"
Expand Down Expand Up @@ -86,20 +85,16 @@ func GetLogAuctionObjectAsURL(ao analytics.AuctionObject, rCtx *models.RequestCt

// parent bidder could in one of the above and we need them by prebid's bidderCode and not seat(could be alias)
slots := make([]SlotRecord, 0)
for _, imp := range ao.RequestWrapper.Imp {
impCtx, ok := rCtx.ImpBidCtx[imp.ID]
if !ok {
continue
}
for impId, impCtx := range rCtx.ImpBidCtx {
reward := 0
if impCtx.IsRewardInventory != nil {
reward = int(*impCtx.IsRewardInventory)
}

// to keep existing response intact
partnerData := make([]PartnerRecord, 0)
if ipr[imp.ID] != nil {
partnerData = ipr[imp.ID]
if ipr[impId] != nil {
partnerData = ipr[impId]
}

slots = append(slots, SlotRecord{
Expand All @@ -109,7 +104,7 @@ func GetLogAuctionObjectAsURL(ao analytics.AuctionObject, rCtx *models.RequestCt
Adunit: impCtx.AdUnitName,
PartnerData: partnerData,
RewardedInventory: int(reward),
// AdPodSlot: getAdPodSlot(imp, responseMap.AdPodBidsExt),
AdPodSlot: getAdPodSlot(impCtx.AdpodConfig),
})
}

Expand Down Expand Up @@ -191,6 +186,23 @@ func GetRequestCtx(hookExecutionOutcome []hookexecution.StageOutcome) *models.Re
return nil
}

func getAdPodSlot(adPodConfig *models.AdPod) *AdPodSlot {
if adPodConfig == nil {
return nil
}

adPodSlot := AdPodSlot{
MinAds: adPodConfig.MinAds,
MaxAds: adPodConfig.MaxAds,
MinDuration: adPodConfig.MinDuration,
MaxDuration: adPodConfig.MaxDuration,
AdvertiserExclusionPercent: *adPodConfig.AdvertiserExclusionPercent,
IABCategoryExclusionPercent: *adPodConfig.IABCategoryExclusionPercent,
}

return &adPodSlot
pm-nikhil-vaidya marked this conversation as resolved.
Show resolved Hide resolved
}

func convertNonBidToBidWrapper(nonBid *openrtb_ext.NonBid) (bid bidWrapper) {
bid.Bid = &openrtb2.Bid{
Price: nonBid.Ext.Prebid.Bid.Price,
Expand Down Expand Up @@ -228,7 +240,7 @@ func convertNonBidToBidWrapper(nonBid *openrtb_ext.NonBid) (bid bidWrapper) {
}
// the 'nbr' field will be lost due to json.Marshal hence do not set it inside bid.Ext
// set the 'nbr' code at bid level, while forming partner-records we give high priority to bid.nbr over bid.ext.nbr
bid.Nbr = openwrap.GetNonBidStatusCodePtr(openrtb3.NonBidStatusCode(nonBid.StatusCode))
bid.Nbr = models.GetNonBidStatusCodePtr(openrtb3.NonBidStatusCode(nonBid.StatusCode))
return bid
}

Expand Down Expand Up @@ -301,7 +313,12 @@ func getPartnerRecordsByImp(ao analytics.AuctionObject, rCtx *models.RequestCtx)
}

for _, bid := range bids {
impCtx, ok := rCtx.ImpBidCtx[bid.ImpID]
var sequence int
impId := bid.ImpID
if rCtx.IsCTVRequest {
impId, sequence = models.GetImpressionID(impId)
}
impCtx, ok := rCtx.ImpBidCtx[impId]
if !ok {
continue
}
Expand Down Expand Up @@ -355,7 +372,7 @@ func getPartnerRecordsByImp(ao analytics.AuctionObject, rCtx *models.RequestCtx)
kgpv = tracker.Tracker.PartnerInfo.KGPV
kgpsv = tracker.Tracker.LoggerData.KGPSV
if kgpv == "" || kgpsv == "" {
kgpv, kgpsv = models.GetKGPSV(*bid.Bid, bidderMeta, adFormat, impCtx.TagID, impCtx.Div, rCtx.Source)
kgpv, kgpsv = models.GetKGPSV(*bid.Bid, &bidExt, bidderMeta, adFormat, impCtx.TagID, impCtx.Div, rCtx.Source)
}

price := bid.Price
Expand All @@ -368,7 +385,7 @@ func getPartnerRecordsByImp(ao analytics.AuctionObject, rCtx *models.RequestCtx)
}

if seat == models.BidderPubMatic {
pmMkt[bid.ImpID] = pubmaticMarketplaceMeta{
pmMkt[impId] = pubmaticMarketplaceMeta{
PubmaticKGP: kgp,
PubmaticKGPV: kgpv,
PubmaticKGPSV: kgpsv,
Expand Down Expand Up @@ -427,7 +444,7 @@ func getPartnerRecordsByImp(ao analytics.AuctionObject, rCtx *models.RequestCtx)
}

// WinningBids contains map of imp.id against bid.id+::+uuid
if b, ok := rCtx.WinningBids[bid.ImpID]; ok && b.ID == bidIDForLookup {
if rCtx.WinningBids.IsWinningBid(impId, bidIDForLookup) {
pr.WinningBidStaus = 1
}

Expand Down Expand Up @@ -466,7 +483,19 @@ func getPartnerRecordsByImp(ao analytics.AuctionObject, rCtx *models.RequestCtx)
}
}

ipr[bid.ImpID] = append(ipr[bid.ImpID], pr)
// Adpod parameters
if impCtx.AdpodConfig != nil {
pr.AdPodSequenceNumber = &sequence

if len(bid.Cat) > 0 {
pr.Cat = append(pr.Cat, bid.Cat...)
}

aprc := int(impCtx.BidIDToAPRC[bidIDForLookup])
pr.NoBidReason = &aprc
}

ipr[impId] = append(ipr[impId], pr)
}
}

Expand Down
Loading