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

U0E-10990: Log error when a partial read of any DB Query. #932

Open
wants to merge 9 commits into
base: ci
Choose a base branch
from
2 changes: 2 additions & 0 deletions modules/pubmatic/openwrap/cache/gocache/adunit_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ package gocache
import (
"strings"

"github.com/golang/glog"
"github.com/prebid/openrtb/v20/openrtb2"
"github.com/prebid/prebid-server/v2/modules/pubmatic/openwrap/models/adunitconfig"
)

func (c *cache) populateCacheWithAdunitConfig(pubID int, profileID, displayVersion int) (err error) {
adunitConfig, err := c.db.GetAdunitConfig(profileID, displayVersion)
if err != nil {
glog.Errorf("[PartialQueryFailure] for adunitConfigQuery with err: %v", err)
pm-priyanka-bagade marked this conversation as resolved.
Show resolved Hide resolved
return err
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package gocache
import (
"fmt"

"github.com/golang/glog"
"github.com/prebid/prebid-server/v2/modules/pubmatic/openwrap/models"
)

Expand All @@ -13,6 +14,7 @@ func (c *cache) GetAppIntegrationPaths() (map[string]int, error) {
appIntegrationPathMap, err := c.db.GetAppIntegrationPaths()
if err != nil {
c.metricEngine.RecordDBQueryFailure(models.AppIntegrationPathMapQuery, "", "")
glog.Errorf("[PartialQueryFailure] for AppIntegrationPathMapQuery with err: %v", err)
pm-priyanka-bagade marked this conversation as resolved.
Show resolved Hide resolved
return appIntegrationPathMap, fmt.Errorf(errorAppIntegrationPathMapUpdate, err)
}
return appIntegrationPathMap, nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package gocache
import (
"fmt"

"github.com/golang/glog"
"github.com/prebid/prebid-server/v2/modules/pubmatic/openwrap/models"
)

Expand All @@ -13,6 +14,7 @@ func (c *cache) GetAppSubIntegrationPaths() (map[string]int, error) {
appSubIntegrationPathMap, err := c.db.GetAppSubIntegrationPaths()
if err != nil {
c.metricEngine.RecordDBQueryFailure(models.AppSubIntegrationPathMapQuery, "", "")
glog.Errorf("[PartialQueryFailure] for AppSubIntegrationPathMapQuery with err: %v", err)
return appSubIntegrationPathMap, fmt.Errorf(errorAppSubIntegrationPathMapUpdate, err)
}
return appSubIntegrationPathMap, nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package gocache
import (
"fmt"

"github.com/golang/glog"
"github.com/prebid/prebid-server/v2/modules/pubmatic/openwrap/models"
)

Expand All @@ -15,6 +16,7 @@ func (c *cache) GetFSCThresholdPerDSP() (map[int]int, error) {
fscThreshold, err := c.db.GetFSCThresholdPerDSP()
if err != nil {
c.metricEngine.RecordDBQueryFailure(models.AllDspFscPcntQuery, "", "")
glog.Errorf("[PartialQueryFailure] for AllDspFscPcntQuery with err: %v", err)
return fscThreshold, fmt.Errorf(errorFscDspMsg, err)
}
return fscThreshold, nil
Expand Down
2 changes: 2 additions & 0 deletions modules/pubmatic/openwrap/cache/gocache/partner_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"strconv"
"time"

"github.com/golang/glog"
"github.com/prebid/prebid-server/v2/modules/pubmatic/openwrap/models"
"github.com/prebid/prebid-server/v2/modules/pubmatic/openwrap/models/adunitconfig"
)
Expand Down Expand Up @@ -68,6 +69,7 @@ func (c *cache) getActivePartnerConfigAndPopulateWrapperMappings(pubID, profileI
partnerConfigMap, err := c.db.GetActivePartnerConfigurations(pubID, profileID, displayVersion)
if err != nil {
c.metricEngine.RecordDBQueryFailure(models.PartnerConfigQuery, strconv.Itoa(pubID), strconv.Itoa(profileID))
glog.Errorf("[PartialQueryFailure] for GetParterConfigQuery with err: %v", err)
return
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package gocache
import (
"fmt"

"github.com/golang/glog"
"github.com/prebid/prebid-server/v2/modules/pubmatic/openwrap/models"
)

Expand All @@ -13,6 +14,7 @@ func (c *cache) GetProfileTypePlatforms() (map[string]int, error) {
profileTypePlatformMap, err := c.db.GetProfileTypePlatforms()
if err != nil {
c.metricEngine.RecordDBQueryFailure(models.ProfileTypePlatformMapQuery, "", "")
glog.Errorf("[PartialQueryFailure] for ProfileTypePlatformMapQuery with err: %v", err)
return profileTypePlatformMap, fmt.Errorf(errorProfileTypePlatformMapUpdate, err)
}
return profileTypePlatformMap, nil
Expand Down
2 changes: 2 additions & 0 deletions modules/pubmatic/openwrap/cache/gocache/publisher_feature.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package gocache
import (
"fmt"

"github.com/golang/glog"
"github.com/prebid/prebid-server/v2/modules/pubmatic/openwrap/models"
)

Expand All @@ -13,6 +14,7 @@ func (c *cache) GetPublisherFeatureMap() (map[int]map[int]models.FeatureData, er
publisherFeatureMap, err := c.db.GetPublisherFeatureMap()
if err != nil {
c.metricEngine.RecordDBQueryFailure(models.PublisherFeatureMapQuery, "", "")
glog.Errorf("[PartialQueryFailure] for PublisherFeatureMapQuery with err: %v", err)
return publisherFeatureMap, fmt.Errorf(errorPubFeatureUpdate, err)
}
return publisherFeatureMap, nil
Expand Down
4 changes: 4 additions & 0 deletions modules/pubmatic/openwrap/cache/gocache/slot_mappings.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"strconv"
"strings"

"github.com/golang/glog"
"github.com/prebid/prebid-server/v2/modules/pubmatic/openwrap/models"
"github.com/prebid/prebid-server/v2/openrtb_ext"
)
Expand All @@ -23,6 +24,9 @@ func (c *cache) populateCacheWithPubSlotNameHash(pubID int) (err error) {
// PopulateCacheWithWrapperSlotMappings will get the SlotMappings from database and put them in cache.
func (c *cache) populateCacheWithWrapperSlotMappings(pubID int, partnerConfigMap map[int]map[string]string, profileID, displayVersion int) error {
partnerSlotMappingMap, err := c.db.GetWrapperSlotMappings(partnerConfigMap, profileID, displayVersion)
if err != nil {
glog.Errorf("[PartialQueryFailure] for WrapperSlotMappingsQuery/WrapperLiveVersionSlotMappings with err: %v", err)
}

//put a version level dummy entry in cache denoting mappings are present for this version
cacheKey := key(PUB_SLOT_INFO, pubID, profileID, displayVersion, 0)
Expand Down
2 changes: 2 additions & 0 deletions modules/pubmatic/openwrap/cache/gocache/vast_tags.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package gocache

import (
"github.com/golang/glog"
"github.com/prebid/prebid-server/v2/modules/pubmatic/openwrap/models"
)

Expand All @@ -11,6 +12,7 @@ func (c *cache) populatePublisherVASTTags(pubID int) error {
//get publisher level vast tag details from DB
publisherVASTTags, err := c.db.GetPublisherVASTTags(pubID)
if err != nil {
glog.Errorf("[PartialQueryFailure] for PublisherVASTTags with err: %v", err)
return err
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,10 @@ func (db *mySqlDB) GetAppIntegrationPaths() (map[string]int, error) {
}
appIntegrationPathMap[aipKey] = aipValue
}

if err = rows.Err(); err != nil {
return nil, err
}
pm-priyanka-bagade marked this conversation as resolved.
Show resolved Hide resolved

return appIntegrationPathMap, nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,10 @@ func (db *mySqlDB) GetAppSubIntegrationPaths() (map[string]int, error) {
}
appSubIntegrationPathMap[asipKey] = asipValue
}

if err = rows.Err(); err != nil {
pm-priyanka-bagade marked this conversation as resolved.
Show resolved Hide resolved
return nil, err
}

return appSubIntegrationPathMap, nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,10 @@ func (db *mySqlDB) GetFSCThresholdPerDSP() (map[int]int, error) {
}
fscDspThresholds[dspId] = pcnt
}

if err = rows.Err(); err != nil {
return nil, err
}

return fscDspThresholds, nil
}
7 changes: 6 additions & 1 deletion modules/pubmatic/openwrap/database/mysql/partner_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func (db *mySqlDB) getActivePartnerConfigurations(profileID, versionID int) (map

// NYC_TODO: ignore close error
if err = rows.Err(); err != nil {
glog.Errorf("partner config row scan failed for versionID %d", versionID)
return nil, err
}
return partnerConfigMap, nil
}
Expand All @@ -99,5 +99,10 @@ func (db *mySqlDB) getVersionIdAndProfileDetails(profileID, displayVersion, pubI
if err != nil {
return versionID, displayVersionIDFromDB, platform.String, profileType, err
}

if err = row.Err(); err != nil {
glog.Errorf("LiveVersionInnerQuery, DisplayVersionInnerQuery row scan failed for pubID %d", pubID)
}

return versionID, displayVersionIDFromDB, platform.String, profileType, nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,10 @@ func (db *mySqlDB) GetProfileTypePlatforms() (map[string]int, error) {
}
profileTypePlatformMap[ptpKey] = ptpValue
}

if err = rows.Err(); err != nil {
return nil, err
}

return profileTypePlatformMap, nil
}
5 changes: 5 additions & 0 deletions modules/pubmatic/openwrap/database/mysql/publisher_feature.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,10 @@ func (db *mySqlDB) GetPublisherFeatureMap() (map[int]map[int]models.FeatureData,
Value: value.String,
}
}

if err = rows.Err(); err != nil {
return nil, err
}

return publisherFeatureMap, nil
}
10 changes: 10 additions & 0 deletions modules/pubmatic/openwrap/database/mysql/slot_mapping.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"strings"
"time"

"github.com/golang/glog"
"github.com/prebid/prebid-server/v2/modules/pubmatic/openwrap/models"
)

Expand All @@ -34,6 +35,10 @@ func (db *mySqlDB) GetPublisherSlotNameHash(pubID int) (map[string]string, error
nameHashMap[name] = hash
}

if err = rows.Err(); err != nil {
glog.Errorf("SlotNameHash row scan failed for pubID %d", pubID)
}

//vastTagHookPublisherSlotName(nameHashMap, pubID)
return nameHashMap, nil
}
Expand Down Expand Up @@ -67,6 +72,11 @@ func (db *mySqlDB) GetWrapperSlotMappings(partnerConfigMap map[int]map[string]st
}

}

if err = rows.Err(); err != nil {
return nil, err
}

//vastTagHookPartnerSlotMapping(partnerSlotMappingMap, profileId, displayVersion)
return partnerSlotMappingMap, nil
}
Expand Down
5 changes: 5 additions & 0 deletions modules/pubmatic/openwrap/database/mysql/vasttags.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,10 @@ func (db *mySqlDB) GetPublisherVASTTags(pubID int) (models.PublisherVASTTags, er
vasttags[vastTag.ID] = &vastTag
}
}

if err = rows.Err(); err != nil {
return nil, err
}

return vasttags, nil
}
Loading