Documentation
¶
Index ¶
- Constants
- Variables
- func ABTestProcessing(rctx models.RequestCtx) (map[int]map[string]string, bool)
- func AppendTest(key string) string
- func ApplyOWSDKFormatLevelAdAttributes(imp *openrtb2.Imp, impCtx models.ImpCtx, deviceOS string) error
- func ApplyTestConfig(rctx models.RequestCtx) bool
- func Builder(rawCfg json.RawMessage, deps moduledeps.ModuleDeps) (interface{}, error)
- func CheckABTestEnabled(rctx models.RequestCtx) bool
- func CheckWinningBidId(bidId string, wbidIds []string) bool
- func CreateOWSDKExtension(wireIDs []int) map[string]any
- func ExtractCTAOverlayFromVASTFastXML(adm string) (json.RawMessage, bool)
- func GetAdapterThrottleMap(partnerConfigMap map[int]map[string]string, ...) (map[string]struct{}, bool)
- func GetEndpoint(path, source string, agent string) string
- func GetHostName() string
- func GetInt(val interface{}) int
- func GetIntArray(val interface{}) []int
- func GetOpenWrapPrometheusServer(cfg *config.Configuration, gatherer *prometheus.Registry, server *http.Server) *http.Server
- func GetRequestIP(body []byte, request *http.Request) string
- func GetRequestUserAgent(body []byte, request *http.Request) string
- func GetRequestWrapper(payload hookstage.EntrypointPayload, ...) (models.RequestExtWrapper, error)
- func GetSupportedAdAttributeWireIDs(os OS, sdkVersion string, adFormat AdFormat) []int
- func GetTargettingForAdpod(bid openrtb2.Bid, partnerConfig map[string]string, impCtx models.ImpCtx, ...) map[string]string
- func GetTargettingForDebug(rctx models.RequestCtx, bidID, tagID string, bidCtx models.BidCtx) map[string]string
- func Handler(w http.ResponseWriter, r *http.Request)
- func IsAlias(bidder string) (string, bool)
- func IsVideoBidEligibleForCTAOverlay(bidExt *models.BidExt, ctaOverlayRequested bool, displayManagerVer string) bool
- func MergeSignalFormatLevelOWSDK(imp *openrtb2.Imp, signalRequest *openrtb2.BidRequest, sdkVersion string) error
- func PrometheusHandler(reg prometheus.Gatherer, timeDur time.Duration, endpoint string) http.Handler
- func RecordPublisherPartnerNoCookieStats(rctx models.RequestCtx)
- func ThrottleAdapter(partnerConfig map[string]string) bool
- func TrimRightByte(s string, b byte) string
- func UpdateImpProtocols(impProtocols []adcom1.MediaCreativeSubtype) []adcom1.MediaCreativeSubtype
- func UpdateTestConfig(rctx models.RequestCtx) map[int]map[string]string
- func UpdateUserExtWithValidValues(user *openrtb2.User)
- func ValidateEIDs(eids []openrtb2.EID) []openrtb2.EID
- type AdFormat
- type FeatureConfig
- type OS
- type OpenWrap
- func (ow OpenWrap) GetCache() cache.Cache
- func (ow OpenWrap) GetConfig() config.Config
- func (ow *OpenWrap) GetFeature() publisherfeature.Feature
- func (ow OpenWrap) GetMetricEngine() metrics.MetricsEngine
- func (m OpenWrap) HandleAllProcessedBidResponsesHook(ctx context.Context, miCtx hookstage.ModuleInvocationContext, ...) (hookstage.HookResult[hookstage.AllProcessedBidResponsesPayload], error)
- func (m OpenWrap) HandleAuctionResponseHook(ctx context.Context, miCtx hookstage.ModuleInvocationContext, ...) (hookstage.HookResult[hookstage.AuctionResponsePayload], error)
- func (m OpenWrap) HandleBeforeValidationHook(ctx context.Context, miCtx hookstage.ModuleInvocationContext, ...) (hookstage.HookResult[hookstage.BeforeValidationRequestPayload], error)
- func (m OpenWrap) HandleEntrypointHook(ctx context.Context, miCtx hookstage.ModuleInvocationContext, ...) (hookstage.HookResult[hookstage.EntrypointPayload], error)
- func (m OpenWrap) HandleProcessedAuctionHook(ctx context.Context, moduleCtx hookstage.ModuleInvocationContext, ...) (hookstage.HookResult[hookstage.ProcessedAuctionRequestPayload], error)
- func (m OpenWrap) HandleRawBidderResponseHook(_ context.Context, miCtx hookstage.ModuleInvocationContext, ...) (hookstage.HookResult[hookstage.RawBidderResponsePayload], error)
- func (ow *OpenWrap) SetCache(c cache.Cache)
- func (ow *OpenWrap) SetConfig(c config.Config)
- func (ow *OpenWrap) SetMetricEngine(m metrics.MetricsEngine)
- func (m OpenWrap) Shutdown() error
- type SupplyChainConfig
Constants ¶
const ( AdAttrWireEngageToClose = 1 AdAttrWireTrueDoubleEndCard = 2 AdAttrWireCTAOverlay = 3 AdAttrWireMRAIDAppStatus = 4 AdAttrWireCountdownOverlay = 5 AdAttrWireFrcClkBrowser = 6 )
Wire IDs for ext.owsdk.adattributes (numeric; product spec).
const ( MRECWidth = 300 MRECHeight = 250 // Server injects format-level ext.owsdk.adattributes only for displaymanagerver in [4.1.0, 5.3.0]. // SDK 5.4.0+ sends format-level owsdk in signal; OpenWrap merges from signal instead. OWSDKServerAdAttributesMinSDKVersion = "4.1.0" OWSDKServerAdAttributesMaxSDKVersion = "5.3.0" // SDK 5.4.0+ includes format-level ext.owsdk (e.g. adattributes) in decoded signal banner/video ext. OWSDKSignalFormatLevelMinSDKVersion = "5.4.0" )
const ( OpenWrapAuction = "/pbs/openrtb2/auction" OpenWrapV25 = "/openrtb/2.5" OpenWrapV25Video = "/openrtb/2.5/video" OpenWrapOpenRTBVideo = "/video/openrtb" OpenWrapVAST = "/video/vast" OpenWrapJSON = "/video/json" OpenWrapAmp = "/amp" )
const (
CACHE_EXPIRY_ROUTINE_RUN_INTERVAL = 1 * time.Minute
)
Variables ¶
var GetRandomNumberBelow100 = func() int { return rand.Intn(99) }
var GetRandomNumberIn1To100 = func() int { return rand.Intn(100) + 1 }
Functions ¶
func ABTestProcessing ¶
ABTestProcessing function checks if test config should be applied and change the partner config accordingly
func ApplyOWSDKFormatLevelAdAttributes ¶
func ApplyOWSDKFormatLevelAdAttributes(imp *openrtb2.Imp, impCtx models.ImpCtx, deviceOS string) error
ApplyOWSDKFormatLevelAdAttributes sets imp.banner|video ext.owsdk.adattributes from unifiedFeatureMatrix for displaymanagerver 4.1.0–5.3.0 only. imp.native is skipped.
func ApplyTestConfig ¶
func ApplyTestConfig(rctx models.RequestCtx) bool
ApplyTestConfig checks if test config should be applied
func Builder ¶
func Builder(rawCfg json.RawMessage, deps moduledeps.ModuleDeps) (interface{}, error)
init openwrap module and its dependecies like config, cache, db connection, bidder cfg, etc.
func CheckABTestEnabled ¶
func CheckABTestEnabled(rctx models.RequestCtx) bool
CheckABTestEnabled checks whether a given request is AB test enabled or not
func CheckWinningBidId ¶
func CreateOWSDKExtension ¶
CreateOWSDKExtension builds ext.owsdk with sorted, deduplicated, positive adattribute wire IDs.
func ExtractCTAOverlayFromVASTFastXML ¶
func ExtractCTAOverlayFromVASTFastXML(adm string) (json.RawMessage, bool)
ExtractCTAOverlayFromVASTFastXML parses adm with the FastXML handler and returns ctaoverlay as json.RawMessage for direct injection (e.g. into bid.ext.owsdk.ctaoverlay). It creates the handler, calls Parse(adm), then getCTAOverlayFromFastXMLHandler(h).
func GetAdapterThrottleMap ¶
func GetAdapterThrottleMap(partnerConfigMap map[int]map[string]string, adapterThrottleMap map[string]struct{}) (map[string]struct{}, bool)
GetAdapterThrottleMap creates a map of adapters that should be throttled and returns whether all partners are throttled.
func GetEndpoint ¶
func GetHostName ¶
func GetHostName() string
getHostName Generates server name from node and pod name in K8S environment
func GetIntArray ¶
func GetIntArray(val interface{}) []int
GetIntArray converts interface to int array if it is compatible
func GetOpenWrapPrometheusServer ¶
func GetOpenWrapPrometheusServer(cfg *config.Configuration, gatherer *prometheus.Registry, server *http.Server) *http.Server
func GetRequestWrapper ¶
func GetRequestWrapper(payload hookstage.EntrypointPayload, result hookstage.HookResult[hookstage.EntrypointPayload], endpoint string) (models.RequestExtWrapper, error)
func GetSupportedAdAttributeWireIDs ¶
GetSupportedAdAttributeWireIDs returns the supported ext.owsdk.adattributes wire IDs for the given OS, SDK version, and ad format.
Callers are expected to pass a trimmed and validated SDK version (currently supported range: [4.1.0, 5.3.0]).
func GetTargettingForAdpod ¶
func GetTargettingForDebug ¶
func IsVideoBidEligibleForCTAOverlay ¶
func IsVideoBidEligibleForCTAOverlay(bidExt *models.BidExt, ctaOverlayRequested bool, displayManagerVer string) bool
IsVideoBidEligibleForCTAOverlay returns true when we should parse adm and inject bid.ext.owsdk.ctaoverlay.
func MergeSignalFormatLevelOWSDK ¶
func MergeSignalFormatLevelOWSDK(imp *openrtb2.Imp, signalRequest *openrtb2.BidRequest, sdkVersion string) error
MergeSignalFormatLevelOWSDK copies format-level ext.owsdk from decoded SDK signal onto the request imp when displaymanagerver >= 5.4.0. v25 requests already carry format-level owsdk on the imp and do not use signal. For SDK < 5.4.0 this is a no-op (server injection handles 4.1.0–5.3.0).
func PrometheusHandler ¶
func RecordPublisherPartnerNoCookieStats ¶
func RecordPublisherPartnerNoCookieStats(rctx models.RequestCtx)
RecordPublisherPartnerNoCookieStats parse request cookies and records the stats if cookie is not found for partner
func ThrottleAdapter ¶
ThrottleAdapter this function returns bool value for whether a adapter should be throttled or not
func TrimRightByte ¶
func UpdateImpProtocols ¶
func UpdateImpProtocols(impProtocols []adcom1.MediaCreativeSubtype) []adcom1.MediaCreativeSubtype
func UpdateTestConfig ¶
func UpdateTestConfig(rctx models.RequestCtx) map[int]map[string]string
UpdateTestConfig returns the updated partnerconfig according to the test type
Types ¶
type AdFormat ¶
type AdFormat string
AdFormat is a matrix row key: OS + SDK range + slot-specific logical format (Approach 2 request spec).
const ( AdFormatInterstitialDisplay AdFormat = "interstitial_display" // instl=1 && banner — banner.ext AdFormatInterstitialVideo AdFormat = "interstitial_video" // instl=1 && video — video.ext AdFormatRewardedVideo AdFormat = "rewarded_video" // reward=1 && video — video.ext AdFormatMRECDisplay AdFormat = "mrec_display" // instl=0, banner, MREC size — banner.ext AdFormatMRECVideo AdFormat = "mrec_video" // instl=0, video, MREC size — video.ext AdFormatBannerDisplay AdFormat = "banner_display" // instl=0, banner, non-MREC — banner.ext )
func DetermineAdFormatForBanner ¶
DetermineAdFormatForBanner maps imp.banner to a matrix row (Approach 2 request spec):
- Interstitial display: instl == 1 && imp.banner != nil (effective)
- MREC display: instl == 0 or absent && imp.banner != nil (effective) && isMRECSize()
- Banner display: instl == 0 or absent && imp.banner != nil (effective) && !isMRECSize()
func DetermineAdFormatForVideo ¶
DetermineAdFormatForVideo maps imp.video to a matrix row (Approach 2 request spec):
- Rewarded video: reward == 1 && imp.video != nil (effective)
- Interstitial video: instl == 1 && imp.video != nil (effective)
- MREC video: isMRECVideo (instl == 0 or absent && imp.video != nil && imp.video is 300×250)
type FeatureConfig ¶
type FeatureConfig struct {
OS OS
MinVersion string
MaxVersion string
AdFormat AdFormat
WireIDs []int
}
FeatureConfig defines supported ext.owsdk adattribute wire IDs for OS, SDK version, and ad format. MinVersion and MaxVersion are inclusive; MaxVersion empty means no upper bound (min only). 5.1.0–5.3.0 bands use sdk510–sdk530 range rows.
type OS ¶
type OS string
OS represents the operating system
func DetermineOS ¶
DetermineOS determines the OS based on device information
type OpenWrap ¶
type OpenWrap struct {
// contains filtered or unexported fields
}
func (*OpenWrap) GetFeature ¶
func (ow *OpenWrap) GetFeature() publisherfeature.Feature
GetFeature Temporary function to expose feature to SSHB
func (OpenWrap) GetMetricEngine ¶
func (ow OpenWrap) GetMetricEngine() metrics.MetricsEngine
GetMetricEngine Temporary function to expose mertics to SSHB
func (OpenWrap) HandleAllProcessedBidResponsesHook ¶
func (m OpenWrap) HandleAllProcessedBidResponsesHook( ctx context.Context, miCtx hookstage.ModuleInvocationContext, payload hookstage.AllProcessedBidResponsesPayload, ) (hookstage.HookResult[hookstage.AllProcessedBidResponsesPayload], error)
func (OpenWrap) HandleAuctionResponseHook ¶
func (m OpenWrap) HandleAuctionResponseHook( ctx context.Context, miCtx hookstage.ModuleInvocationContext, payload hookstage.AuctionResponsePayload, ) (hookstage.HookResult[hookstage.AuctionResponsePayload], error)
func (OpenWrap) HandleBeforeValidationHook ¶
func (m OpenWrap) HandleBeforeValidationHook( ctx context.Context, miCtx hookstage.ModuleInvocationContext, payload hookstage.BeforeValidationRequestPayload, ) (hookstage.HookResult[hookstage.BeforeValidationRequestPayload], error)
changes to init the request ctx with profile and request details
func (OpenWrap) HandleEntrypointHook ¶
func (m OpenWrap) HandleEntrypointHook( ctx context.Context, miCtx hookstage.ModuleInvocationContext, payload hookstage.EntrypointPayload, ) (hookstage.HookResult[hookstage.EntrypointPayload], error)
temporary openwrap changes to support non-pbs apis like openrtb/2.5, openrtb/amp, etc temporary openwrap changes to support non-ortb fields like request.ext.wrapper
func (OpenWrap) HandleProcessedAuctionHook ¶
func (m OpenWrap) HandleProcessedAuctionHook( ctx context.Context, moduleCtx hookstage.ModuleInvocationContext, payload hookstage.ProcessedAuctionRequestPayload, ) (hookstage.HookResult[hookstage.ProcessedAuctionRequestPayload], error)
func (OpenWrap) HandleRawBidderResponseHook ¶
func (m OpenWrap) HandleRawBidderResponseHook( _ context.Context, miCtx hookstage.ModuleInvocationContext, payload hookstage.RawBidderResponsePayload, ) (hookstage.HookResult[hookstage.RawBidderResponsePayload], error)
HandleRawBidderResponseHook fetches rCtx and check for vast unwrapper flag to enable/disable vast unwrapping feature
func (*OpenWrap) SetMetricEngine ¶
func (ow *OpenWrap) SetMetricEngine(m metrics.MetricsEngine)
GetMetricEngine Temporary function to expose mertics to SSHB
type SupplyChainConfig ¶
type SupplyChainConfig struct {
Validation string `json:"validation"`
SupplyChain *openrtb2.SupplyChain `json:"config"`
}
SupplyChainConfig reads profile level supply chain object from database
Source Files
¶
- abtest.go
- adapterthrottle.go
- adattributes.go
- allprocessedbidresponsehook.go
- applovinmax.go
- aps.go
- auctionresponsehook.go
- beforevalidationhook.go
- bidders.go
- brandcategory.go
- contenttransperencyobject.go
- country_filtering.go
- defaultbids.go
- device.go
- entrypointhook.go
- floors.go
- geo.go
- hook_raw_bidder_response.go
- logger.go
- marketplace.go
- matchedimpression.go
- module.go
- module_context.go
- nonbids.go
- openwrap.go
- openwrap_sshb.go
- price_granularity.go
- processedauctionhook.go
- profiledata.go
- prometheus_handler.go
- schain.go
- server.go
- targeting.go
- traffic_shapping.go
- util.go
- vastctaoverlay.go
Directories
¶
| Path | Synopsis |
|---|---|
|
mock
Package mock_cache is a generated GoMock package.
|
Package mock_cache is a generated GoMock package. |
|
mock
Package mock_database is a generated GoMock package.
|
Package mock_database is a generated GoMock package. |
|
mock_driver
Package mock_driver is a generated GoMock package.
|
Package mock_driver is a generated GoMock package. |
|
endpoints
|
|
|
Package geodb provides an interface for performing IP-to-geography lookups using a GeoIP database
|
Package geodb provides an interface for performing IP-to-geography lookups using a GeoIP database |
|
mock
Package mock_geodb is a generated GoMock package.
|
Package mock_geodb is a generated GoMock package. |
|
netacuity
Package netacuity offers methods for initializing a GeoIP database client and to perform the ip-to-geo lookup functionality.
|
Package netacuity offers methods for initializing a GeoIP database client and to perform the ip-to-geo lookup functionality. |
|
mock
Package mock_metrics is a generated GoMock package.
|
Package mock_metrics is a generated GoMock package. |
|
stats/mock
Package mock_stats is a generated GoMock package.
|
Package mock_stats is a generated GoMock package. |
|
middleware
|
|
|
mock
Package mock_profilemetadata is a generated GoMock package.
|
Package mock_profilemetadata is a generated GoMock package. |
|
Package tbf provides functionalities related to the Tracking-Beacon-First (TBF) feature.
|
Package tbf provides functionalities related to the Tracking-Beacon-First (TBF) feature. |
|
mock
Package mock_publisherfeature is a generated GoMock package.
|
Package mock_publisherfeature is a generated GoMock package. |
|
sdk
|
|
|
mock
Package mock_wakanda is a generated GoMock package.
|
Package mock_wakanda is a generated GoMock package. |