Skip to content

Commit

Permalink
Merge branch 'ci' of github.com:PubMatic-OpenWrap/prebid-server into …
Browse files Browse the repository at this point in the history
…prebid_v2.1.0
  • Loading branch information
Pubmatic-Supriya-Patil committed Feb 21, 2024
2 parents b5e9905 + 0ae5992 commit 17efdb2
Show file tree
Hide file tree
Showing 19 changed files with 894 additions and 187 deletions.
10 changes: 5 additions & 5 deletions analytics/pubmatic/logger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3568,11 +3568,11 @@ func TestGetLogAuctionObjectAsURL(t *testing.T) {
rCtx: &models.RequestCtx{
PubID: 5890,
DeviceCtx: models.DeviceCtx{
Ext: &models.ExtDevice{
ExtDevice: openrtb_ext.ExtDevice{
ATTS: ptrutil.ToPtr(openrtb_ext.IOSAppTrackingStatusRestricted),
},
},
Ext: func() *models.ExtDevice {
extDevice := models.ExtDevice{}
extDevice.UnmarshalJSON([]byte(`{"atts":1}`))
return &extDevice
}(),
},
},
logInfo: true,
Expand Down
8 changes: 4 additions & 4 deletions analytics/pubmatic/record.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ type record struct {

// Device struct for storing device information
type Device struct {
Platform models.DevicePlatform `json:"plt,omitempty"`
IFAType *models.DeviceIFAType `json:"ifty,omitempty"` //OTT-416, adding device.ext.ifa_type
ATTS *openrtb_ext.IOSAppTrackingStatus `json:"atts,omitempty"` //device.ext.atts
Platform models.DevicePlatform `json:"plt,omitempty"`
IFAType *models.DeviceIFAType `json:"ifty,omitempty"` //OTT-416, adding device.ext.ifa_type
ATTS *float64 `json:"atts,omitempty"` //device.ext.atts
}

/*
Expand Down Expand Up @@ -199,7 +199,7 @@ func (wlog *WloggerRecord) logDeviceObject(dvc *models.DeviceCtx) {
wlog.Device.Platform = dvc.Platform
wlog.Device.IFAType = dvc.IFATypeID
if dvc.Ext != nil {
wlog.record.Device.ATTS = dvc.Ext.ATTS
wlog.record.Device.ATTS, _ = dvc.Ext.GetAtts()
}
}

Expand Down
16 changes: 7 additions & 9 deletions analytics/pubmatic/record_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -415,9 +415,7 @@ func TestLogDeviceObject(t *testing.T) {
dvc: &models.DeviceCtx{
Platform: models.DevicePlatformDesktop,
IFATypeID: ptrutil.ToPtr(models.DeviceIFATypeID[models.DeviceIFATypeDPID]),
Ext: &models.ExtDevice{
ExtDevice: openrtb_ext.ExtDevice{},
},
Ext: &models.ExtDevice{},
},
},
want: Device{
Expand All @@ -431,17 +429,17 @@ func TestLogDeviceObject(t *testing.T) {
dvc: &models.DeviceCtx{
Platform: models.DevicePlatformDesktop,
IFATypeID: ptrutil.ToPtr(models.DeviceIFATypeID[models.DeviceIFATypeDPID]),
Ext: &models.ExtDevice{
ExtDevice: openrtb_ext.ExtDevice{
ATTS: ptrutil.ToPtr(openrtb_ext.IOSAppTrackingStatusNotDetermined),
},
},
Ext: func() *models.ExtDevice {
extDevice := models.ExtDevice{}
extDevice.UnmarshalJSON([]byte(`{"atts":0}`))
return &extDevice
}(),
},
},
want: Device{
Platform: models.DevicePlatformDesktop,
IFAType: ptrutil.ToPtr(models.DeviceIFATypeID[models.DeviceIFATypeDPID]),
ATTS: ptrutil.ToPtr(openrtb_ext.IOSAppTrackingStatusNotDetermined),
ATTS: ptrutil.ToPtr(float64(openrtb_ext.IOSAppTrackingStatusNotDetermined)),
},
},
}
Expand Down
4 changes: 4 additions & 0 deletions modules/pubmatic/openwrap/beforevalidationhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ func (m OpenWrap) handleBeforeValidationHook(
err = errors.New("failed to get profile data: received empty data")
}
result.Errors = append(result.Errors, err.Error())
rCtx.ImpBidCtx = getDefaultImpBidCtx(*payload.BidRequest) // for wrapper logger sz
m.metricEngine.RecordPublisherInvalidProfileRequests(rCtx.Endpoint, rCtx.PubIDStr, rCtx.ProfileIDStr)
m.metricEngine.RecordPublisherInvalidProfileImpressions(rCtx.PubIDStr, rCtx.ProfileIDStr, len(payload.BidRequest.Imp))
return result, err
Expand All @@ -128,6 +129,7 @@ func (m OpenWrap) handleBeforeValidationHook(
result.NbrCode = nbr.InvalidPlatform
err = errors.New("failed to get platform data")
result.Errors = append(result.Errors, err.Error())
rCtx.ImpBidCtx = getDefaultImpBidCtx(*payload.BidRequest) // for wrapper logger sz
m.metricEngine.RecordPublisherInvalidProfileRequests(rCtx.Endpoint, rCtx.PubIDStr, rCtx.ProfileIDStr)
m.metricEngine.RecordPublisherInvalidProfileImpressions(rCtx.PubIDStr, rCtx.ProfileIDStr, len(payload.BidRequest.Imp))
return result, err
Expand Down Expand Up @@ -195,6 +197,7 @@ func (m OpenWrap) handleBeforeValidationHook(
result.NbrCode = nbr.InternalError
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
return result, err
}
}
Expand All @@ -205,6 +208,7 @@ func (m OpenWrap) handleBeforeValidationHook(
result.NbrCode = nbr.InvalidImpressionTagID
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
return result, err
}

Expand Down
Loading

0 comments on commit 17efdb2

Please sign in to comment.