Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions modules/pubmatic/openwrap/auctionresponsehook.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"time"

"github.com/buger/jsonparser"
"github.com/golang/glog"
"github.com/prebid/openrtb/v20/openrtb2"
"github.com/prebid/prebid-server/v2/hooks/hookanalytics"
"github.com/prebid/prebid-server/v2/hooks/hookstage"
Expand Down Expand Up @@ -82,6 +83,7 @@ func (m OpenWrap) handleAuctionResponseHook(
result.Errors = append(result.Errors, errs[i].Error())
}
result.NbrCode = int(nbr.InternalError)
glog.Errorln(models.ErrInAuctionResponseHook, result.Errors, result.NbrCode)
}
}

Expand Down
24 changes: 21 additions & 3 deletions modules/pubmatic/openwrap/beforevalidationhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,11 @@ func (m OpenWrap) handleBeforeValidationHook(
if err != nil {
result.NbrCode = int(nbr.InvalidRequestExt)
result.Errors = append(result.Errors, "failed to get request ext: "+err.Error())
glog.Errorln(models.ErrInBeforeValidationHook, result.Errors, result.NbrCode)
return result, nil
}
rCtx.NewReqExt = requestExt
glog.Infoln("New Request ext: %s", rCtx.NewReqExt)
Comment thread
pm-priyanka-bagade marked this conversation as resolved.
rCtx.CustomDimensions = customdimensions.GetCustomDimensions(requestExt.Prebid.BidderParams)
rCtx.ReturnAllBidStatus = requestExt.Prebid.ReturnAllBidStatus
m.setAnanlyticsFlags(&rCtx)
Expand All @@ -141,7 +143,8 @@ func (m OpenWrap) handleBeforeValidationHook(
if len(rCtx.ResponseFormat) > 0 {
if rCtx.ResponseFormat != models.ResponseFormatJSON && rCtx.ResponseFormat != models.ResponseFormatRedirect {
result.NbrCode = int(nbr.InvalidResponseFormat)
result.Errors = append(result.Errors, "Invalid response format, must be 'json' or 'redirect'")
result.Errors = append(result.Errors, models.ErrInvalidRespFormat)
glog.Errorln(models.ErrInBeforeValidationHook, result.Errors, result.NbrCode)
return result, nil
}
}
Expand All @@ -154,14 +157,16 @@ func (m OpenWrap) handleBeforeValidationHook(
rCtx.RedirectURL = strings.TrimSpace(rCtx.RedirectURL)
if rCtx.ResponseFormat == models.ResponseFormatRedirect && !isValidURL(rCtx.RedirectURL) {
result.NbrCode = int(nbr.InvalidRedirectURL)
result.Errors = append(result.Errors, "Invalid redirect URL")
result.Errors = append(result.Errors, models.ErrInvalidRedirectURL)
glog.Errorln(models.ErrInBeforeValidationHook, result.Errors, result.NbrCode)
return result, nil
}
}

if rCtx.ResponseFormat == models.ResponseFormatRedirect && len(rCtx.RedirectURL) == 0 {
result.NbrCode = int(nbr.MissingOWRedirectURL)
result.Errors = append(result.Errors, "owRedirectURL is missing")
result.Errors = append(result.Errors, models.ErrMissingRedirectURL)
glog.Errorln(models.ErrInBeforeValidationHook, result.Errors, result.NbrCode)
return result, nil
}
}
Expand Down Expand Up @@ -196,6 +201,7 @@ func (m OpenWrap) handleBeforeValidationHook(
rCtx.ABTestConfigApplied = 1
rCtx.PartnerConfigMap = newPartnerConfigMap
result.Warnings = append(result.Warnings, "update the rCtx.PartnerConfigMap with ABTest data")
glog.Warningln("ABTestProcessing failed to update the rCtx.PartnerConfigMap with %s", result.Warnings)
}

//set the profile MetaData for logging and tracking
Expand Down Expand Up @@ -225,6 +231,7 @@ func (m OpenWrap) handleBeforeValidationHook(
result.NbrCode = int(nbr.AllPartnerThrottled)
result.Errors = append(result.Errors, "All adapters throttled")
rCtx.ImpBidCtx = getDefaultImpBidCtx(*payload.BidRequest) // for wrapper logger sz
glog.Errorln(models.ErrInBeforeValidationHook, result.Errors, result.NbrCode)
return result, nil
}

Expand All @@ -236,6 +243,7 @@ func (m OpenWrap) handleBeforeValidationHook(
result.NbrCode = int(nbr.AllPartnersFiltered)
result.Errors = append(result.Errors, "All partners filtered")
rCtx.ImpBidCtx = getDefaultImpBidCtx(*payload.BidRequest) // for wrapper logger sz
glog.Errorln(models.ErrInBeforeValidationHook, result.Errors, result.NbrCode)
return result, err
}

Expand All @@ -244,6 +252,7 @@ func (m OpenWrap) handleBeforeValidationHook(
result.NbrCode = int(nbr.InvalidPriceGranularityConfig)
result.Errors = append(result.Errors, "failed to price granularity details: "+err.Error())
rCtx.ImpBidCtx = getDefaultImpBidCtx(*payload.BidRequest) // for wrapper logger sz
glog.Errorln(models.ErrInBeforeValidationHook, result.Errors, result.NbrCode)
return result, nil
}

Expand Down Expand Up @@ -284,6 +293,7 @@ func (m OpenWrap) handleBeforeValidationHook(
result.NbrCode = int(nbr.InvalidVideoRequest)
result.Errors = append(result.Errors, err.Error())
rCtx.ImpBidCtx = getDefaultImpBidCtx(*payload.BidRequest) // for wrapper logger sz
glog.Errorln(models.ErrInBeforeValidationHook, result.Errors, result.NbrCode)
return result, nil
}
}
Expand All @@ -301,6 +311,7 @@ func (m OpenWrap) handleBeforeValidationHook(
err = errors.New("failed to parse imp.ext: " + imp.ID)
result.Errors = append(result.Errors, err.Error())
rCtx.ImpBidCtx = map[string]models.ImpCtx{} // do not create "s" object in owlogger
glog.Errorln(models.ErrInBeforeValidationHook, result.Errors, result.NbrCode)
return result, err
}
}
Expand All @@ -312,6 +323,7 @@ func (m OpenWrap) handleBeforeValidationHook(
err = errors.New("tagid missing for imp: " + imp.ID)
result.Errors = append(result.Errors, err.Error())
rCtx.ImpBidCtx = map[string]models.ImpCtx{} // do not create "s" object in owlogger
glog.Errorln(models.ErrInBeforeValidationHook, result.Errors, result.NbrCode)
return result, err
}

Expand Down Expand Up @@ -401,6 +413,7 @@ func (m OpenWrap) handleBeforeValidationHook(
result.NbrCode = int(nbr.InvalidAdpodConfig)
result.Errors = append(result.Errors, "failed to get adpod configurations for "+imp.ID+" reason: "+err.Error())
rCtx.ImpBidCtx = getDefaultImpBidCtx(*payload.BidRequest)
glog.Errorln(models.ErrInBeforeValidationHook, result.Errors, result.NbrCode)
return result, nil
}

Expand All @@ -416,6 +429,7 @@ func (m OpenWrap) handleBeforeValidationHook(
result.NbrCode = int(nbr.InvalidAdpodConfig)
result.Errors = append(result.Errors, "invalid adpod configurations for "+imp.ID+" reason: "+err.Error())
rCtx.ImpBidCtx = getDefaultImpBidCtx(*payload.BidRequest)
glog.Errorln(models.ErrInBeforeValidationHook, result.Errors, result.NbrCode)
return result, nil
}

Expand All @@ -424,6 +438,7 @@ func (m OpenWrap) handleBeforeValidationHook(
result.NbrCode = int(nbr.InvalidAdpodConfig)
result.Errors = append(result.Errors, "failed to get adpod configurations for "+imp.ID+" reason: "+err.Error())
rCtx.ImpBidCtx = getDefaultImpBidCtx(*payload.BidRequest)
glog.Errorln(models.ErrInBeforeValidationHook, result.Errors, result.NbrCode)
return result, nil
}

Expand All @@ -432,6 +447,7 @@ func (m OpenWrap) handleBeforeValidationHook(
result.NbrCode = int(nbr.InvalidAdpodConfig)
result.Errors = append(result.Errors, "invalid adpod configurations for "+imp.ID+" reason: "+err.Error())
rCtx.ImpBidCtx = getDefaultImpBidCtx(*payload.BidRequest)
glog.Errorln(models.ErrInBeforeValidationHook, result.Errors, result.NbrCode)
return result, nil
}

Expand Down Expand Up @@ -616,6 +632,7 @@ func (m OpenWrap) handleBeforeValidationHook(
err = errors.New("all slots disabled")
}
result.Errors = append(result.Errors, err.Error())
glog.Errorln(models.ErrInBeforeValidationHook, result.Errors, result.NbrCode)
return result, nil
}

Expand All @@ -627,6 +644,7 @@ func (m OpenWrap) handleBeforeValidationHook(
err = errors.New("server side partner not found")
}
result.Errors = append(result.Errors, err.Error())
glog.Errorln(models.ErrInBeforeValidationHook, result.Errors, result.NbrCode)
return result, nil
}

Expand Down
9 changes: 7 additions & 2 deletions modules/pubmatic/openwrap/entrypointhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ func (m OpenWrap) handleEntrypointHook(
}

originalRequestBody := payload.Body
glog.Info("Request body: %s", originalRequestBody)

if endpoint == models.EndpointAppLovinMax {
rCtx.MetricsEngine = m.metricEngine
Expand All @@ -93,12 +94,14 @@ func (m OpenWrap) handleEntrypointHook(
if err != nil {
result.NbrCode = int(nbr.InvalidRequestWrapperExtension)
result.Errors = append(result.Errors, err.Error())
glog.Errorln(models.ErrInEntryPointHook, result.Errors, result.NbrCode)
return result, err
}

if requestExtWrapper.ProfileId <= 0 {
result.NbrCode = int(nbr.InvalidProfileID)
result.Errors = append(result.Errors, "ErrMissingProfileID")
result.Errors = append(result.Errors, models.ErrMissingProfileID)
glog.Errorln(models.ErrInEntryPointHook, result.Errors, result.NbrCode)
return result, err
}

Expand Down Expand Up @@ -170,13 +173,15 @@ func (m OpenWrap) handleEntrypointHook(
if len(errs) > 0 {
result.NbrCode = int(nbr.InvalidPublisherID)
result.Errors = append(result.Errors, errs[0].Error())
glog.Errorln(models.ErrInEntryPointHook, result.Errors, result.NbrCode)
return result, errs[0]
}

rCtx.PubID, err = strconv.Atoi(pubIdStr)
if err != nil {
result.NbrCode = int(nbr.InvalidPublisherID)
result.Errors = append(result.Errors, "ErrInvalidPublisherID")
result.Errors = append(result.Errors, models.ErrInvalidPublisherID)
glog.Errorln(models.ErrInEntryPointHook, result.Errors, result.NbrCode)
return result, fmt.Errorf("invalid publisher id : %v", err)
}
rCtx.PubIDStr = pubIdStr
Expand Down
17 changes: 15 additions & 2 deletions modules/pubmatic/openwrap/models/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,19 @@ const (

const (
// ErrDBQueryFailed reponse error
ErrDBQueryFailed = `"[DBError] query:[%s] pubid:[%v] profileid:[%v] error:[%s]"`
EmptyPartnerConfig = `"[EmptyPartnerConfig] pubid:[%v] profileid:[%v] version:[%v]"`
ErrDBQueryFailed = `"[DBError] query:[%s] pubid:[%v] profileid:[%v] error:[%s]"`
EmptyPartnerConfig = `"[EmptyPartnerConfig] pubid:[%v] profileid:[%v] version:[%v]"`
ErrInBeforeValidationHook = `"[ErrInBeforeValidationHook] Error:[%v] with nbr:[%v]"`
ErrInEntryPointHook = `"[ErrInEntryPointHook] Error:[%v] with nbr:[%v]"`
ErrInAuctionResponseHook = `"[ErrInAuctionResponseHook] Error:[%v] with nbr:[%v]"`
)

const (
// ErrSSHBRequest sshb request error
ErrSSHBRequest = "sshb request error"
ErrMissingProfileID = "missing profile id"
ErrInvalidPublisherID = "invalid publisher id"
ErrInvalidRespFormat = "Invalid response format, must be 'json' or 'redirect'"
ErrInvalidRedirectURL = "Invalid redirect URL"
ErrMissingRedirectURL = "owRedirectURL is missing"
)