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

UOE-11371: Wakanda Data is not logged if logger is disabled using publisher feature. #942

Open
wants to merge 2 commits into
base: ci
Choose a base branch
from
Open
Changes from all commits
Commits
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
47 changes: 24 additions & 23 deletions analytics/pubmatic/pubmatic.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package pubmatic

import (
"net/http"
"runtime/debug"
"sync"

Expand Down Expand Up @@ -55,34 +56,34 @@ func (ow HTTPLogger) LogAuctionObject(ao *analytics.AuctionObject) {
return
}

if rCtx.LoggerDisabled {
// logger disabled explicitly for publisher,profile request
return
}

var orignalMaxBidResponse *openrtb2.BidResponse
if rCtx.Endpoint == models.EndpointAppLovinMax {
orignalMaxBidResponse = new(openrtb2.BidResponse)
*orignalMaxBidResponse = *ao.Response
}
var loggerURL string
var headers http.Header
Copy link
Collaborator

Choose a reason for hiding this comment

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

Move var headers http.Header inside the if block.

if !rCtx.LoggerDisabled {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you add a UT for following scenarios?

  1. Logger is Disabled and Wakanda is enabled for AppLovin Endpoint.
  2. Logger is Disabled and Wakanda is enabled for Some other endpoint Request.

var orignalMaxBidResponse *openrtb2.BidResponse
if rCtx.Endpoint == models.EndpointAppLovinMax {
orignalMaxBidResponse = new(openrtb2.BidResponse)
*orignalMaxBidResponse = *ao.Response
}

err := RestoreBidResponse(rCtx, *ao)
if err != nil {
glog.Error("Failed to restore bid response for pub:[%d], profile:[%d], version:[%d], err:[%s].", rCtx.PubID, rCtx.ProfileID, rCtx.VersionID, err.Error())
}
err := RestoreBidResponse(rCtx, *ao)
if err != nil {
glog.Error("Failed to restore bid response for pub:[%d], profile:[%d], version:[%d], err:[%s].", rCtx.PubID, rCtx.ProfileID, rCtx.VersionID, err.Error())
}

loggerURL, headers := GetLogAuctionObjectAsURL(*ao, rCtx, false, false)
if loggerURL == "" {
glog.Errorf("Failed to prepare the owlogger for pub:[%d], profile:[%d], version:[%d].",
rCtx.PubID, rCtx.ProfileID, rCtx.VersionID)
return
}
loggerURL, headers = GetLogAuctionObjectAsURL(*ao, rCtx, false, false)
if loggerURL == "" {
glog.Errorf("Failed to prepare the owlogger for pub:[%d], profile:[%d], version:[%d].",
rCtx.PubID, rCtx.ProfileID, rCtx.VersionID)
return
}

go send(rCtx, loggerURL, headers, mhttp.NewMultiHttpContext())
go send(rCtx, loggerURL, headers, mhttp.NewMultiHttpContext())

if rCtx.Endpoint == models.EndpointAppLovinMax {
ao.Response = orignalMaxBidResponse
if rCtx.Endpoint == models.EndpointAppLovinMax {
ao.Response = orignalMaxBidResponse
}
}

setWakandaObject(rCtx, ao, loggerURL)
}

Expand Down
Loading