Documentation ¶
Index ¶
- Constants
- func AssertEqualModulesData(t *testing.T, expectedData, actualData json.RawMessage)
- func EnrichExtBidResponse(ext json.RawMessage, stageOutcomes []StageOutcome, ...) (json.RawMessage, []error, error)
- func GetModulesJSON(stageOutcomes []StageOutcome, bidRequest *openrtb2.BidRequest, ...) (json.RawMessage, []error, error)
- func NewHookExecutor(builder hooks.ExecutionPlanBuilder, endpoint string, me metrics.MetricsEngine) *hookExecutor
- type Action
- type EmptyHookExecutor
- func (executor EmptyHookExecutor) ExecuteAllProcessedBidResponsesStage(_ map[openrtb_ext.BidderName]*entities.PbsOrtbSeatBid)
- func (executor EmptyHookExecutor) ExecuteAuctionResponseStage(_ *openrtb2.BidResponse)
- func (executor EmptyHookExecutor) ExecuteBidderRequestStage(_ *openrtb_ext.RequestWrapper, bidder string) *RejectError
- func (executor EmptyHookExecutor) ExecuteEntrypointStage(_ *http.Request, body []byte) ([]byte, *RejectError)
- func (executor EmptyHookExecutor) ExecuteProcessedAuctionStage(_ *openrtb_ext.RequestWrapper) error
- func (executor EmptyHookExecutor) ExecuteRawAuctionStage(body []byte) ([]byte, *RejectError)
- func (executor EmptyHookExecutor) ExecuteRawBidderResponseStage(_ *adapters.BidderResponse, _ string) *RejectError
- func (executor EmptyHookExecutor) GetOutcomes() []StageOutcome
- func (executor EmptyHookExecutor) SetAccount(_ *config.Account)
- func (executor EmptyHookExecutor) SetActivityControl(_ privacy.ActivityControl)
- type ExecutionTime
- type FailureError
- type GroupOutcome
- type HookID
- type HookOutcome
- type HookStageExecutor
- type Messages
- type ModulesOutcome
- type RejectError
- type Stage
- type StageExecutor
- type StageOutcome
- type Status
- type TimeoutError
- type TraceOutcome
Constants ¶
const ( EndpointAuction = "/openrtb2/auction" EndpointAmp = "/openrtb2/amp" )
Variables ¶
This section is empty.
Functions ¶
func AssertEqualModulesData ¶
func AssertEqualModulesData(t *testing.T, expectedData, actualData json.RawMessage)
AssertEqualModulesData is the test helper function which asserts that expected modules data fully corresponds the actual modules data. Dynamic data for execution time is calculated from actual modules data.
func EnrichExtBidResponse ¶
func EnrichExtBidResponse( ext json.RawMessage, stageOutcomes []StageOutcome, bidRequest *openrtb2.BidRequest, account *config.Account, ) (json.RawMessage, []error, error)
EnrichExtBidResponse adds debug and trace information returned from executing hooks to the ext argument. In response the outcome is visible under the key response.ext.prebid.modules.
Debug information is added only if the debug mode is enabled by request and allowed by account (if provided). The details of the trace output depends on the value in the bidRequest.ext.prebid.trace field. Warnings returned if bidRequest contains unexpected types for debug fields controlling debug output.
func GetModulesJSON ¶
func GetModulesJSON( stageOutcomes []StageOutcome, bidRequest *openrtb2.BidRequest, account *config.Account, ) (json.RawMessage, []error, error)
GetModulesJSON returns debug and trace information produced from executing hooks. Debug information is returned only if the debug mode is enabled by request and allowed by account (if provided). The details of the trace output depends on the value in the bidRequest.ext.prebid.trace field. Warnings returned if bidRequest contains unexpected types for debug fields controlling debug output.
func NewHookExecutor ¶
func NewHookExecutor(builder hooks.ExecutionPlanBuilder, endpoint string, me metrics.MetricsEngine) *hookExecutor
Types ¶
type Action ¶
type Action string
Action indicates the type of taken behaviour after the successful hook execution.
type EmptyHookExecutor ¶
type EmptyHookExecutor struct{}
func (EmptyHookExecutor) ExecuteAllProcessedBidResponsesStage ¶
func (executor EmptyHookExecutor) ExecuteAllProcessedBidResponsesStage(_ map[openrtb_ext.BidderName]*entities.PbsOrtbSeatBid)
func (EmptyHookExecutor) ExecuteAuctionResponseStage ¶
func (executor EmptyHookExecutor) ExecuteAuctionResponseStage(_ *openrtb2.BidResponse)
func (EmptyHookExecutor) ExecuteBidderRequestStage ¶
func (executor EmptyHookExecutor) ExecuteBidderRequestStage(_ *openrtb_ext.RequestWrapper, bidder string) *RejectError
func (EmptyHookExecutor) ExecuteEntrypointStage ¶
func (executor EmptyHookExecutor) ExecuteEntrypointStage(_ *http.Request, body []byte) ([]byte, *RejectError)
func (EmptyHookExecutor) ExecuteProcessedAuctionStage ¶
func (executor EmptyHookExecutor) ExecuteProcessedAuctionStage(_ *openrtb_ext.RequestWrapper) error
func (EmptyHookExecutor) ExecuteRawAuctionStage ¶
func (executor EmptyHookExecutor) ExecuteRawAuctionStage(body []byte) ([]byte, *RejectError)
func (EmptyHookExecutor) ExecuteRawBidderResponseStage ¶
func (executor EmptyHookExecutor) ExecuteRawBidderResponseStage(_ *adapters.BidderResponse, _ string) *RejectError
func (EmptyHookExecutor) GetOutcomes ¶
func (executor EmptyHookExecutor) GetOutcomes() []StageOutcome
func (EmptyHookExecutor) SetAccount ¶
func (executor EmptyHookExecutor) SetAccount(_ *config.Account)
func (EmptyHookExecutor) SetActivityControl ¶
func (executor EmptyHookExecutor) SetActivityControl(_ privacy.ActivityControl)
type ExecutionTime ¶
type FailureError ¶
type FailureError struct {
Message string
}
FailureError indicates expected error occurred during hook execution on the module-side. A moduleFailed metric will be sent in such case.
func NewFailure ¶
func NewFailure(format string, a ...any) FailureError
func (FailureError) Error ¶
func (e FailureError) Error() string
type GroupOutcome ¶
type GroupOutcome struct { // ExecutionTime is set to the longest ExecutionTime of its children. ExecutionTime InvocationResults []HookOutcome `json:"invocation_results"` }
GroupOutcome represents the result of executing specific group of hooks.
type HookID ¶
type HookID struct { ModuleCode string `json:"module_code"` HookImplCode string `json:"hook_impl_code"` }
HookID points to the specific hook defined by the hook execution plan.
type HookOutcome ¶
type HookOutcome struct { // ExecutionTime is the execution time of a specific hook without applying its result. ExecutionTime AnalyticsTags hookanalytics.Analytics `json:"analytics_tags"` HookID HookID `json:"hook_id"` Status Status `json:"status"` Action Action `json:"action"` Message string `json:"message"` // arbitrary string value returned from hook execution DebugMessages []string `json:"debug_messages,omitempty"` Errors []string `json:"-"` Warnings []string `json:"-"` }
HookOutcome represents the result of executing specific hook.
type HookStageExecutor ¶
type HookStageExecutor interface { StageExecutor SetAccount(account *config.Account) SetActivityControl(activityControl privacy.ActivityControl) GetOutcomes() []StageOutcome }
type ModulesOutcome ¶
type ModulesOutcome struct { Errors Messages `json:"errors,omitempty"` Warnings Messages `json:"warnings,omitempty"` Trace *TraceOutcome `json:"trace,omitempty"` }
ModulesOutcome represents result of hooks execution ready to be added to BidResponse.
Errors and Warnings hold the error and warning messages returned from executing individual hooks.
type RejectError ¶
RejectError indicates stage rejection requested by specific hook. Implements errortypes.Coder interface for compatibility only, so as not to be recognized as a fatal error
func CastRejectErr ¶
func CastRejectErr(err error) (*RejectError, bool)
func FindFirstRejectOrNil ¶
func FindFirstRejectOrNil(errors []error) *RejectError
func (RejectError) Code ¶
func (e RejectError) Code() int
func (RejectError) Error ¶
func (e RejectError) Error() string
func (RejectError) Severity ¶
func (e RejectError) Severity() errortypes.Severity
type Stage ¶
type Stage struct { // ExecutionTime is set to the longest ExecutionTime of its children. ExecutionTime Stage string `json:"stage"` Outcomes []StageOutcome `json:"outcomes"` }
Stage holds the result of executing hooks at specific stage. May contain multiple StageOutcome results for stages executed multiple times (ex. for each bidder-request/response stages).
type StageExecutor ¶
type StageExecutor interface { ExecuteEntrypointStage(req *http.Request, body []byte) ([]byte, *RejectError) ExecuteRawAuctionStage(body []byte) ([]byte, *RejectError) ExecuteProcessedAuctionStage(req *openrtb_ext.RequestWrapper) error ExecuteBidderRequestStage(req *openrtb_ext.RequestWrapper, bidder string) *RejectError ExecuteRawBidderResponseStage(response *adapters.BidderResponse, bidder string) *RejectError ExecuteAllProcessedBidResponsesStage(adapterBids map[openrtb_ext.BidderName]*entities.PbsOrtbSeatBid) ExecuteAuctionResponseStage(response *openrtb2.BidResponse) }
type StageOutcome ¶
type StageOutcome struct { // ExecutionTime is the sum of ExecutionTime of all its groups ExecutionTime // An Entity specifies the type of object that was processed during the execution of the stage. Entity entity `json:"entity"` Groups []GroupOutcome `json:"groups"` Stage string `json:"-"` }
StageOutcome represents the result of executing specific stage.
type Status ¶
type Status string
Status indicates the result of hook execution.
const ( StatusSuccess Status = "success" // successful hook execution StatusTimeout Status = "timeout" // hook was not completed in the allotted time StatusFailure Status = "failure" // expected module-side failure occurred during hook execution StatusExecutionFailure Status = "execution_failure" // unexpected failure occurred during hook execution )
type TimeoutError ¶
type TimeoutError struct{}
TimeoutError indicates exceeding of the max execution time allotted for hook.
func (TimeoutError) Error ¶
func (e TimeoutError) Error() string
type TraceOutcome ¶
type TraceOutcome struct { // ExecutionTime is the sum of ExecutionTime of all stages. ExecutionTime Stages []Stage `json:"stages"` }
TraceOutcome holds the result of executing hooks at all stages.