exchange

package
v2.12.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 18, 2024 License: Apache-2.0 Imports: 265 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DebugOverrideHeader string = "x-pbs-debug-override"
)
View Source
const (
	Gzip string = "GZIP"
)

Possible values of compression types Prebid Server can support for bidder compression

View Source
const ImpIdReqBody = "Stored bid response for impression id: "
View Source
const MaxKeyLength = 20

Variables

This section is empty.

Functions

func ExtractReqExtBidderParamsMap

func ExtractReqExtBidderParamsMap(bidRequest *openrtb2.BidRequest) (map[string]json.RawMessage, error)

func GetActiveBidders

func GetActiveBidders(infos config.BidderInfos) map[string]openrtb_ext.BidderName

GetActiveBidders returns a map of all active bidder names.

func GetDisabledBidderWarningMessages

func GetDisabledBidderWarningMessages(infos config.BidderInfos) map[string]string

func GetPriceBucket

func GetPriceBucket(bid openrtb2.Bid, targetingData targetData) string

GetPriceBucket is the externally facing function for computing CPM buckets

func GetValidBidders

func GetValidBidders(aliases map[string]string) map[string]struct{}

func IsDebugOverrideEnabled

func IsDebugOverrideEnabled(debugHeader, configOverrideToken string) bool

func WrapJSONInData

func WrapJSONInData(data []byte) []byte

Types

type AdaptedBidder

type AdaptedBidder interface {
	// contains filtered or unexported methods
}

AdaptedBidder defines the contract needed to participate in an Auction within an Exchange.

This interface exists to help segregate core auction logic.

Any logic which can be done _within a single Seat_ goes inside one of these. Any logic which _requires responses from all Seats_ goes inside the Exchange.

This interface differs from adapters.Bidder to help minimize code duplication across the adapters.Bidder implementations.

func AdaptBidder

func AdaptBidder(bidder adapters.Bidder, client *http.Client, cfg *config.Configuration, me metrics.MetricsEngine, name openrtb_ext.BidderName, debugInfo *config.DebugInfo, endpointCompression string) AdaptedBidder

AdaptBidder converts an adapters.Bidder into an exchange.AdaptedBidder.

The name refers to the "Adapter" architecture pattern, and should not be confused with a Prebid "Adapter" (which is being phased out and replaced by Bidder for OpenRTB auctions)

type AuctionRequest

type AuctionRequest struct {
	BidRequestWrapper          *openrtb_ext.RequestWrapper
	ResolvedBidRequest         json.RawMessage
	Account                    config.Account
	UserSyncs                  IdFetcher
	RequestType                metrics.RequestType
	StartTime                  time.Time
	Warnings                   []error
	GlobalPrivacyControlHeader string
	ImpExtInfoMap              map[string]ImpExtInfo
	TCF2Config                 gdpr.TCF2ConfigReader
	Activities                 privacy.ActivityControl

	// LegacyLabels is included here for temporary compatibility with cleanOpenRTBRequests
	// in HoldAuction until we get to factoring it away. Do not use for anything new.
	LegacyLabels   metrics.Labels
	FirstPartyData map[openrtb_ext.BidderName]*firstpartydata.ResolvedFirstPartyData
	// map of imp id to stored response
	StoredAuctionResponses stored_responses.ImpsWithBidResponses
	// map of imp id to bidder to stored response
	StoredBidResponses      stored_responses.ImpBidderStoredResp
	BidderImpReplaceImpID   stored_responses.BidderImpReplaceImpID
	PubID                   string
	HookExecutor            hookexecution.StageExecutor
	QueryParams             url.Values
	BidderResponseStartTime time.Time
	TmaxAdjustments         *TmaxAdjustmentsPreprocessed
}

AuctionRequest holds the bid request for the auction and all other information needed to process that request

type AuctionResponse

type AuctionResponse struct {
	*openrtb2.BidResponse
	ExtBidResponse *openrtb_ext.ExtBidResponse
}

AuctionResponse contains OpenRTB Bid Response object and its extension (un-marshalled) object

func (*AuctionResponse) GetSeatNonBid

func (ar *AuctionResponse) GetSeatNonBid() []openrtb_ext.SeatNonBid

GetSeatNonBid returns array of seat non-bid if present. nil otherwise

type BidIDGenerator

type BidIDGenerator interface {
	New(bidder string) (string, error)
	Enabled() bool
}

type BidderRequest

type BidderRequest struct {
	BidRequest            *openrtb2.BidRequest
	BidderName            openrtb_ext.BidderName
	BidderCoreName        openrtb_ext.BidderName
	BidderLabels          metrics.AdapterLabels
	BidderStoredResponses map[string]json.RawMessage
	IsRequestAlias        bool
	ImpReplaceImpId       map[string]bool
}

BidderRequest holds the bidder specific request and all other information needed to process that bidder request.

type DebugData

type DebugData struct {
	Request  string
	Headers  string
	Response string
}

type DebugLog

type DebugLog struct {
	Enabled       bool
	CacheType     prebid_cache_client.PayloadType
	Data          DebugData
	TTL           int64
	CacheKey      string
	CacheString   string
	Regexp        *regexp.Regexp
	DebugOverride bool
	//little optimization, it stores value of debugLog.Enabled || debugLog.DebugOverride
	DebugEnabledOrOverridden bool
}

func (*DebugLog) BuildCacheString

func (d *DebugLog) BuildCacheString()

func (*DebugLog) PutDebugLogError

func (d *DebugLog) PutDebugLogError(cache prebid_cache_client.Client, timeout int, errors []error) error

type Exchange

type Exchange interface {
	// HoldAuction executes an OpenRTB v2.5 Auction.
	HoldAuction(ctx context.Context, r *AuctionRequest, debugLog *DebugLog) (*AuctionResponse, error)
}

Exchange runs Auctions. Implementations must be threadsafe, and will be shared across many goroutines.

func NewExchange

func NewExchange(adapters map[openrtb_ext.BidderName]AdaptedBidder, cache prebid_cache_client.Client, cfg *config.Configuration, syncersByBidder map[string]usersync.Syncer, metricsEngine metrics.MetricsEngine, infos config.BidderInfos, gdprPermsBuilder gdpr.PermissionsBuilder, currencyConverter *currency.RateConverter, categoriesFetcher stored_requests.CategoryFetcher, adsCertSigner adscert.Signer, macroReplacer macros.Replacer, priceFloorFetcher floors.FloorFetcher) Exchange

type IdFetcher

type IdFetcher interface {
	GetUID(key string) (uid string, exists bool, notExpired bool)
	HasAnyLiveSyncs() bool
}

IdFetcher can find the user's ID for a specific Bidder.

type ImpExtInfo

type ImpExtInfo struct {
	EchoVideoAttrs bool
	StoredImp      []byte
	Passthrough    json.RawMessage
}

type NonBidReason

type NonBidReason int

SeatNonBid list the reasons why bid was not resulted in positive bid reason could be either No bid, Error, Request rejection or Response rejection Reference: https://github.com/InteractiveAdvertisingBureau/openrtb/blob/master/extensions/community_extensions/seat-non-bid.md

const (
	NoBidUnknownError                      NonBidReason = 0 // No Bid - General
	ResponseRejectedGeneral                NonBidReason = 300
	ResponseRejectedCategoryMappingInvalid NonBidReason = 303 // Response Rejected - Category Mapping Invalid
	ResponseRejectedCreativeSizeNotAllowed NonBidReason = 351 // Response Rejected - Invalid Creative (Size Not Allowed)
	ResponseRejectedCreativeNotSecure      NonBidReason = 352 // Response Rejected - Invalid Creative (Not Secure)
)

func (NonBidReason) Ptr

func (n NonBidReason) Ptr() *NonBidReason

Ptr returns pointer to own value.

func (*NonBidReason) Val

func (n *NonBidReason) Val() NonBidReason

Val safely dereferences pointer, returning default value (NoBidUnknownError) for nil.

type TmaxAdjustmentsPreprocessed

type TmaxAdjustmentsPreprocessed struct {
	BidderNetworkLatencyBuffer     uint
	PBSResponsePreparationDuration uint
	BidderResponseDurationMin      uint

	IsEnforced bool
}

func ProcessTMaxAdjustments

func ProcessTMaxAdjustments(adjustmentsConfig config.TmaxAdjustments) *TmaxAdjustmentsPreprocessed

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL