metrics

package
v2.32.0-3 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	XMLParserLabelFastXML = "fastxml"
	XMLParserLabelETree   = "etree"
)
View Source
const PublisherUnknown = "unknown"

PublisherUnknown : Default value for Labels.PubID

Variables

This section is empty.

Functions

This section is empty.

Types

type AdapterBid

type AdapterBid string

AdapterBid : Whether or not the adapter returned bids

const (
	AdapterBidPresent AdapterBid = "bid"
	AdapterBidNone    AdapterBid = "nobid"
)

Adapter bid response status.

func AdapterBids

func AdapterBids() []AdapterBid

type AdapterError

type AdapterError string

AdapterError : Errors which may have occurred during the adapter's execution

const (
	AdapterErrorBadInput            AdapterError = "badinput"
	AdapterErrorBadServerResponse   AdapterError = "badserverresponse"
	AdapterErrorTimeout             AdapterError = "timeout"
	AdapterErrorFailedToRequestBids AdapterError = "failedtorequestbid"
	AdapterErrorValidation          AdapterError = "validation"
	AdapterErrorTmaxTimeout         AdapterError = "tmaxtimeout"
	AdapterErrorUnknown             AdapterError = "unknown_error"
)

Adapter execution status

func AdapterErrors

func AdapterErrors() []AdapterError

type AdapterLabels

type AdapterLabels struct {
	Source        DemandSource
	RType         RequestType
	Adapter       openrtb_ext.BidderName
	PubID         string // exchange specific ID, so we cannot compile in values
	CookieFlag    CookieFlag
	AdapterBids   AdapterBid
	AdapterErrors map[AdapterError]struct{}
}

AdapterLabels defines the labels that can be attached to the adapter metrics.

type AdapterMetrics

type AdapterMetrics struct {
	NoCookieMeter      metrics.Meter
	ErrorMeters        map[AdapterError]metrics.Meter
	NoBidMeter         metrics.Meter
	GotBidsMeter       metrics.Meter
	RequestTimer       metrics.Timer
	PriceHistogram     metrics.Histogram
	BidsReceivedMeter  metrics.Meter
	PanicMeter         metrics.Meter
	MarkupMetrics      map[openrtb_ext.BidType]*MarkupDeliveryMetrics
	ConnCreated        metrics.Counter
	ConnReused         metrics.Counter
	ConnWaitTime       metrics.Timer
	BuyerUIDScrubbed   metrics.Meter
	GDPRRequestBlocked metrics.Meter

	BidValidationCreativeSizeErrorMeter metrics.Meter
	BidValidationCreativeSizeWarnMeter  metrics.Meter

	BidValidationSecureMarkupErrorMeter metrics.Meter
	BidValidationSecureMarkupWarnMeter  metrics.Meter
	TLSHandshakeTimer                   metrics.Timer
}

AdapterMetrics houses the metrics for a particular adapter

type CacheResult

type CacheResult string

CacheResult : Cache hit/miss

const (
	// CacheHit represents a cache hit i.e the key was found in cache
	CacheHit CacheResult = "hit"
	// CacheMiss represents a cache miss i.e that key wasn't found in cache
	// and had to be fetched from the backend
	CacheMiss CacheResult = "miss"
)

func CacheResults

func CacheResults() []CacheResult

CacheResults returns possible cache results i.e. cache hit or miss

type CookieFlag

type CookieFlag string

CookieFlag : User ID cookie exists flag

const (
	CookieFlagYes     CookieFlag = "exists"
	CookieFlagNo      CookieFlag = "no"
	CookieFlagUnknown CookieFlag = "unknown"
)

Cookie flag

func CookieTypes

func CookieTypes() []CookieFlag

type CookieSyncStatus

type CookieSyncStatus string

CookieSyncStatus is a status code resulting from a call to the /cookie_sync endpoint.

const (
	CookieSyncOK                     CookieSyncStatus = "ok"
	CookieSyncBadRequest             CookieSyncStatus = "bad_request"
	CookieSyncOptOut                 CookieSyncStatus = "opt_out"
	CookieSyncGDPRHostCookieBlocked  CookieSyncStatus = "gdpr_blocked_host_cookie"
	CookieSyncAccountBlocked         CookieSyncStatus = "acct_blocked"
	CookieSyncAccountConfigMalformed CookieSyncStatus = "acct_config_malformed"
	CookieSyncAccountInvalid         CookieSyncStatus = "acct_invalid"
)

func CookieSyncStatuses

func CookieSyncStatuses() []CookieSyncStatus

CookieSyncStatuses returns possible cookie sync statuses.

type DemandSource

type DemandSource string

DemandSource : Demand source enumeration

const (
	DemandWeb     DemandSource = "web"
	DemandApp     DemandSource = "app"
	DemandDOOH    DemandSource = "dooh"
	DemandUnknown DemandSource = "unknown"
)

The demand sources

func DemandTypes

func DemandTypes() []DemandSource

type ImpLabels

type ImpLabels struct {
	BannerImps bool
	VideoImps  bool
	AudioImps  bool
	NativeImps bool
}

ImpLabels defines metric labels describing the impression type.

type ImpMediaType

type ImpMediaType string

ImpMediaType : Media type described in the "imp" JSON object TODO is this still needed?

const (
	ImpTypeBanner ImpMediaType = "banner"
	ImpTypeVideo  ImpMediaType = "video"
	ImpTypeAudio  ImpMediaType = "audio"
	ImpTypeNative ImpMediaType = "native"
)

The media types described in the "imp" json objects

func ImpTypes

func ImpTypes() []ImpMediaType

type Labels

type Labels struct {
	Source        DemandSource
	RType         RequestType
	PubID         string // exchange specific ID, so we cannot compile in values
	CookieFlag    CookieFlag
	RequestStatus RequestStatus
}

Labels defines the labels that can be attached to the metrics.

type MarkupDeliveryMetrics

type MarkupDeliveryMetrics struct {
	AdmMeter  metrics.Meter
	NurlMeter metrics.Meter
}

type Metrics

type Metrics struct {
	MetricsRegistry                metrics.Registry
	ConnectionCounter              metrics.Counter
	TMaxTimeoutCounter             metrics.Counter
	ConnectionAcceptErrorMeter     metrics.Meter
	ConnectionCloseErrorMeter      metrics.Meter
	ImpMeter                       metrics.Meter
	AppRequestMeter                metrics.Meter
	NoCookieMeter                  metrics.Meter
	DebugRequestMeter              metrics.Meter
	RequestTimer                   metrics.Timer
	RequestsQueueTimer             map[RequestType]map[bool]metrics.Timer
	PrebidCacheRequestTimerSuccess metrics.Timer
	PrebidCacheRequestTimerError   metrics.Timer
	StoredDataFetchTimer           map[StoredDataType]map[StoredDataFetchType]metrics.Timer
	StoredDataErrorMeter           map[StoredDataType]map[StoredDataError]metrics.Meter
	StoredReqCacheMeter            map[CacheResult]metrics.Meter
	StoredImpCacheMeter            map[CacheResult]metrics.Meter
	AccountCacheMeter              map[CacheResult]metrics.Meter
	DNSLookupTimer                 metrics.Timer
	TLSHandshakeTimer              metrics.Timer
	BidderServerResponseTimer      metrics.Timer
	StoredResponsesMeter           metrics.Meter

	// Metrics for OpenRTB requests specifically
	RequestStatuses        map[RequestType]map[RequestStatus]metrics.Meter
	AmpNoCookieMeter       metrics.Meter
	CookieSyncMeter        metrics.Meter
	CookieSyncStatusMeter  map[CookieSyncStatus]metrics.Meter
	SyncerRequestsMeter    map[string]map[SyncerCookieSyncStatus]metrics.Meter
	SetUidMeter            metrics.Meter
	SetUidStatusMeter      map[SetUidStatus]metrics.Meter
	SyncerSetsMeter        map[string]map[SyncerSetUidStatus]metrics.Meter
	FloorRejectedBidsMeter map[openrtb_ext.BidderName]metrics.Meter

	// Media types found in the "imp" JSON object
	ImpsTypeBanner metrics.Meter
	ImpsTypeVideo  metrics.Meter
	ImpsTypeAudio  metrics.Meter
	ImpsTypeNative metrics.Meter

	// Notification timeout metrics
	TimeoutNotificationSuccess metrics.Meter
	TimeoutNotificationFailure metrics.Meter

	// TCF adaption metrics
	PrivacyCCPARequest       metrics.Meter
	PrivacyCCPARequestOptOut metrics.Meter
	PrivacyCOPPARequest      metrics.Meter
	PrivacyLMTRequest        metrics.Meter
	PrivacyTCFRequestVersion map[TCFVersionValue]metrics.Meter

	AdapterMetrics map[string]*AdapterMetrics

	// Will hold boolean values to help us disable metric collection if needed
	MetricsDisabled config.DisabledMetrics

	// AdsCert metrics
	AdsCertRequestsSuccess metrics.Meter
	AdsCertRequestsFailure metrics.Meter

	// Module metrics
	ModuleMetrics map[string]map[string]*ModuleMetrics

	OverheadTimer map[OverheadType]metrics.Timer
	// contains filtered or unexported fields
}

func NewBlankMetrics

func NewBlankMetrics(registry metrics.Registry, exchanges []string, disabledMetrics config.DisabledMetrics, moduleStageNames map[string][]string) *Metrics

NewBlankMetrics creates a new Metrics object with all blank metrics object. This may also be useful for testing routines to ensure that no metrics are written anywhere.

This will be useful when removing endpoints, we can just run will the blank metrics function rather than loading metrics that never get filled. This will also eventually let us configure metrics, such as setting a limited set of metrics for a production instance, and then expanding again when we need more debugging.

func NewMetrics

func NewMetrics(registry metrics.Registry, exchanges []openrtb_ext.BidderName, disableAccountMetrics config.DisabledMetrics, syncerKeys []string, moduleStageNames map[string][]string) *Metrics

NewMetrics creates a new Metrics object with needed metrics defined. In time we may develop to the point where Metrics contains all the metrics we might want to record, and then we build the actual metrics object to contain only the metrics we are interested in. This would allow for debug mode metrics. The code would allways try to record the metrics, but effectively noop if we are using a blank meter/timer.

func (*Metrics) RecordAccountCacheResult

func (me *Metrics) RecordAccountCacheResult(cacheResult CacheResult, inc int)

RecordAccountCacheResult implements a part of the MetricsEngine interface. Records the cache hits and misses when looking up accounts.

func (*Metrics) RecordAdapterBidReceived

func (me *Metrics) RecordAdapterBidReceived(labels AdapterLabels, bidType openrtb_ext.BidType, hasAdm bool)

RecordAdapterBidReceived implements a part of the MetricsEngine interface. This tracks how many bids from each Bidder use `adm` vs. `nurl.

func (*Metrics) RecordAdapterBuyerUIDScrubbed

func (me *Metrics) RecordAdapterBuyerUIDScrubbed(adapterName openrtb_ext.BidderName)

func (*Metrics) RecordAdapterConnections

func (me *Metrics) RecordAdapterConnections(adapterName openrtb_ext.BidderName,
	connWasReused bool,
	connWaitTime time.Duration)

Keeps track of created and reused connections to adapter bidders and the time from the connection request, to the connection creation, or reuse from the pool across all engines

func (*Metrics) RecordAdapterDuplicateBidID

func (me *Metrics) RecordAdapterDuplicateBidID(adaptor string, collisions int)

RecordAdapterDuplicateBidID as noop

func (*Metrics) RecordAdapterGDPRRequestBlocked

func (me *Metrics) RecordAdapterGDPRRequestBlocked(adapterName openrtb_ext.BidderName)

func (*Metrics) RecordAdapterPanic

func (me *Metrics) RecordAdapterPanic(labels AdapterLabels)

RecordAdapterPanic implements a part of the MetricsEngine interface

func (*Metrics) RecordAdapterPrice

func (me *Metrics) RecordAdapterPrice(labels AdapterLabels, cpm float64)

RecordAdapterPrice implements a part of the MetricsEngine interface. Generates a histogram of winning bid prices

func (*Metrics) RecordAdapterRequest

func (me *Metrics) RecordAdapterRequest(labels AdapterLabels)

RecordAdapterRequest implements a part of the MetricsEngine interface

func (*Metrics) RecordAdapterTime

func (me *Metrics) RecordAdapterTime(labels AdapterLabels, length time.Duration)

RecordAdapterTime implements a part of the MetricsEngine interface. Records the adapter response time

func (*Metrics) RecordAdapterVideoBidDuration

func (me *Metrics) RecordAdapterVideoBidDuration(labels AdapterLabels, videoBidDuration int)

RecordAdapterVideoBidDuration as a noop

func (*Metrics) RecordAdsCertReq

func (me *Metrics) RecordAdsCertReq(success bool)

func (*Metrics) RecordAdsCertSignTime

func (me *Metrics) RecordAdsCertSignTime(adsCertSignTime time.Duration)

func (*Metrics) RecordBadRequest

func (me *Metrics) RecordBadRequest(endpoint string, pubId string, nbr *openrtb3.NoBidReason)

RecordBadRequest as a noop

func (*Metrics) RecordBidValidationCreativeSizeError

func (me *Metrics) RecordBidValidationCreativeSizeError(adapter openrtb_ext.BidderName, pubID string)

func (*Metrics) RecordBidValidationCreativeSizeWarn

func (me *Metrics) RecordBidValidationCreativeSizeWarn(adapter openrtb_ext.BidderName, pubID string)

func (*Metrics) RecordBidValidationSecureMarkupError

func (me *Metrics) RecordBidValidationSecureMarkupError(adapter openrtb_ext.BidderName, pubID string)

func (*Metrics) RecordBidValidationSecureMarkupWarn

func (me *Metrics) RecordBidValidationSecureMarkupWarn(adapter openrtb_ext.BidderName, pubID string)

func (*Metrics) RecordBidderServerResponseTime

func (me *Metrics) RecordBidderServerResponseTime(bidderServerResponseTime time.Duration)

func (*Metrics) RecordBids

func (me *Metrics) RecordBids(pubid, profileid, biddder, deal string)

RecordBids as a noop

func (*Metrics) RecordConnectionAccept

func (me *Metrics) RecordConnectionAccept(success bool)

func (*Metrics) RecordConnectionClose

func (me *Metrics) RecordConnectionClose(success bool)

func (*Metrics) RecordCookieSync

func (me *Metrics) RecordCookieSync(status CookieSyncStatus)

RecordCookieSync implements a part of the MetricsEngine interface. Records a cookie sync request

func (*Metrics) RecordDNSTime

func (me *Metrics) RecordDNSTime(dnsLookupTime time.Duration)

func (*Metrics) RecordDebugRequest

func (me *Metrics) RecordDebugRequest(debugEnabled bool, pubID string)

func (*Metrics) RecordFloorStatus

func (me *Metrics) RecordFloorStatus(pubId, source, code string)

RecordFloorStatus implements a part of the MetricsEngine interface. Records dynamic fetch failure

func (*Metrics) RecordFloorsRequestForAccount

func (me *Metrics) RecordFloorsRequestForAccount(pubId string)

func (*Metrics) RecordImps

func (me *Metrics) RecordImps(labels ImpLabels)

func (*Metrics) RecordModuleCalled

func (me *Metrics) RecordModuleCalled(labels ModuleLabels, duration time.Duration)

func (*Metrics) RecordModuleExecutionError

func (me *Metrics) RecordModuleExecutionError(labels ModuleLabels)

func (*Metrics) RecordModuleFailed

func (me *Metrics) RecordModuleFailed(labels ModuleLabels)

func (*Metrics) RecordModuleSuccessNooped

func (me *Metrics) RecordModuleSuccessNooped(labels ModuleLabels)

func (*Metrics) RecordModuleSuccessRejected

func (me *Metrics) RecordModuleSuccessRejected(labels ModuleLabels)

func (*Metrics) RecordModuleSuccessUpdated

func (me *Metrics) RecordModuleSuccessUpdated(labels ModuleLabels)

func (*Metrics) RecordModuleTimeout

func (me *Metrics) RecordModuleTimeout(labels ModuleLabels)

func (*Metrics) RecordOverheadTime

func (me *Metrics) RecordOverheadTime(overhead OverheadType, length time.Duration)

RecordOverheadTime implements a part of the MetricsEngine interface. Records the adapter overhead time

func (*Metrics) RecordPanic

func (me *Metrics) RecordPanic(hostname, method string)

RecordPanic as a noop

func (*Metrics) RecordPodCombGenTime

func (me *Metrics) RecordPodCombGenTime(labels PodLabels, elapsedTime time.Duration)

RecordPodCombGenTime as a noop

func (*Metrics) RecordPodCompititveExclusionTime

func (me *Metrics) RecordPodCompititveExclusionTime(labels PodLabels, elapsedTime time.Duration)

RecordPodCompititveExclusionTime as a noop

func (*Metrics) RecordPodImpGenTime

func (me *Metrics) RecordPodImpGenTime(labels PodLabels, startTime time.Time)

RecordPodImpGenTime as a noop

func (*Metrics) RecordPrebidCacheRequestTime

func (me *Metrics) RecordPrebidCacheRequestTime(success bool, length time.Duration)

RecordPrebidCacheRequestTime implements a part of the MetricsEngine interface. Records the amount of time taken to store the auction result in Prebid Cache.

func (*Metrics) RecordRejectedBids

func (me *Metrics) RecordRejectedBids(pubid, biddder, code string)

RecordAdapterVideoBidDuration as a noop

func (*Metrics) RecordRejectedBidsForAccount

func (me *Metrics) RecordRejectedBidsForAccount(pubId string)

func (*Metrics) RecordRejectedBidsForBidder

func (me *Metrics) RecordRejectedBidsForBidder(bidder openrtb_ext.BidderName)

RecordRejectedBidsForBidder implements a part of the MetricsEngine interface. Records rejected bids from bidder

func (*Metrics) RecordRequest

func (me *Metrics) RecordRequest(labels Labels)

RecordRequest implements a part of the MetricsEngine interface

func (*Metrics) RecordRequestHavingDuplicateBidID

func (me *Metrics) RecordRequestHavingDuplicateBidID()

RecordRequestHavingDuplicateBidID as noop

func (*Metrics) RecordRequestPrivacy

func (me *Metrics) RecordRequestPrivacy(privacy PrivacyLabels)

func (*Metrics) RecordRequestQueueTime

func (me *Metrics) RecordRequestQueueTime(success bool, requestType RequestType, length time.Duration)

func (*Metrics) RecordRequestTime

func (me *Metrics) RecordRequestTime(labels Labels, length time.Duration)

RecordRequestTime implements a part of the MetricsEngine interface. The calling code is responsible for determining the call duration.

func (*Metrics) RecordSetUid

func (me *Metrics) RecordSetUid(status SetUidStatus)

RecordSetUid implements a part of the MetricsEngine interface. Records a set uid sync request

func (*Metrics) RecordStoredDataError

func (me *Metrics) RecordStoredDataError(labels StoredDataLabels)

RecordStoredDataError implements a part of the MetricsEngine interface

func (*Metrics) RecordStoredDataFetchTime

func (me *Metrics) RecordStoredDataFetchTime(labels StoredDataLabels, length time.Duration)

RecordStoredDataFetchTime implements a part of the MetricsEngine interface

func (*Metrics) RecordStoredImpCacheResult

func (me *Metrics) RecordStoredImpCacheResult(cacheResult CacheResult, inc int)

RecordStoredImpCacheResult implements a part of the MetricsEngine interface. Records the cache hits and misses when looking up stored impressions.

func (*Metrics) RecordStoredReqCacheResult

func (me *Metrics) RecordStoredReqCacheResult(cacheResult CacheResult, inc int)

RecordStoredReqCacheResult implements a part of the MetricsEngine interface. Records the cache hits and misses when looking up stored requests

func (*Metrics) RecordStoredResponse

func (me *Metrics) RecordStoredResponse(pubId string)

func (*Metrics) RecordSyncerRequest

func (me *Metrics) RecordSyncerRequest(key string, status SyncerCookieSyncStatus)

RecordSyncerRequest implements a part of the MetricsEngine interface. Records a cookie sync syncer request and status

func (*Metrics) RecordSyncerSet

func (me *Metrics) RecordSyncerSet(key string, status SyncerSetUidStatus)

RecordSyncerSet implements a part of the MetricsEngine interface. Records a set uid sync request and status

func (*Metrics) RecordTLSHandshakeTime

func (me *Metrics) RecordTLSHandshakeTime(adapterName openrtb_ext.BidderName, tlsHandshakeTime time.Duration)

func (*Metrics) RecordTMaxTimeout

func (m *Metrics) RecordTMaxTimeout()

func (*Metrics) RecordTimeoutNotice

func (me *Metrics) RecordTimeoutNotice(success bool)

func (*Metrics) RecordVASTTagType

func (me *Metrics) RecordVASTTagType(biddder, vastTag string)

RecordVASTTagType as a noop

func (*Metrics) RecordVastVersion

func (me *Metrics) RecordVastVersion(biddder, vastVersion string)

RecordVastVersion as a noop

func (*Metrics) RecordXMLParserResponseMismatch

func (me *Metrics) RecordXMLParserResponseMismatch(method string, isMismatch bool)

RecordXMLParserResponseMismatch as a noop

func (*Metrics) RecordXMLParserResponseTime

func (me *Metrics) RecordXMLParserResponseTime(parser string, method string, respTime time.Duration)

RecordXMLParserResponseTime records execution time for multiple parsers

type MetricsEngine

type MetricsEngine interface {
	OWMetricsEngine
	RecordConnectionAccept(success bool)
	RecordTMaxTimeout()
	RecordConnectionClose(success bool)
	RecordRequest(labels Labels)                           // ignores adapter. only statusOk and statusErr fom status
	RecordImps(labels ImpLabels)                           // RecordImps across openRTB2 engines that support the 'Native' Imp Type
	RecordRequestTime(labels Labels, length time.Duration) // ignores adapter. only statusOk and statusErr fom status
	RecordOverheadTime(overHead OverheadType, length time.Duration)
	RecordAdapterRequest(labels AdapterLabels)
	RecordAdapterConnections(adapterName openrtb_ext.BidderName, connWasReused bool, connWaitTime time.Duration)
	RecordDNSTime(dnsLookupTime time.Duration)
	RecordTLSHandshakeTime(adapterName openrtb_ext.BidderName, tlsHandshakeTime time.Duration)
	RecordBidderServerResponseTime(bidderServerResponseTime time.Duration)
	RecordAdapterPanic(labels AdapterLabels)
	RecordAdapterBidReceived(labels AdapterLabels, bidType openrtb_ext.BidType, hasAdm bool)
	RecordAdapterPrice(labels AdapterLabels, cpm float64)
	RecordAdapterTime(labels AdapterLabels, length time.Duration)
	RecordCookieSync(status CookieSyncStatus)
	RecordSyncerRequest(key string, status SyncerCookieSyncStatus)
	RecordSetUid(status SetUidStatus)
	RecordSyncerSet(key string, status SyncerSetUidStatus)
	RecordRejectedBidsForBidder(bidder openrtb_ext.BidderName)
	RecordRejectedBidsForAccount(pubId string)
	RecordFloorsRequestForAccount(pubId string)
	RecordStoredReqCacheResult(cacheResult CacheResult, inc int)
	RecordStoredImpCacheResult(cacheResult CacheResult, inc int)
	RecordAccountCacheResult(cacheResult CacheResult, inc int)
	RecordStoredDataFetchTime(labels StoredDataLabels, length time.Duration)
	RecordStoredDataError(labels StoredDataLabels)
	RecordPrebidCacheRequestTime(success bool, length time.Duration)
	RecordRequestQueueTime(success bool, requestType RequestType, length time.Duration)
	RecordTimeoutNotice(success bool)
	RecordRequestPrivacy(privacy PrivacyLabels)
	RecordAdapterBuyerUIDScrubbed(adapterName openrtb_ext.BidderName)
	RecordAdapterGDPRRequestBlocked(adapterName openrtb_ext.BidderName)
	RecordDebugRequest(debugEnabled bool, pubId string)
	RecordStoredResponse(pubId string)
	RecordAdsCertReq(success bool)
	RecordAdsCertSignTime(adsCertSignTime time.Duration)
	RecordBidValidationCreativeSizeError(adapter openrtb_ext.BidderName, account string)
	RecordBidValidationCreativeSizeWarn(adapter openrtb_ext.BidderName, account string)
	RecordBidValidationSecureMarkupError(adapter openrtb_ext.BidderName, account string)
	RecordBidValidationSecureMarkupWarn(adapter openrtb_ext.BidderName, account string)
	RecordModuleCalled(labels ModuleLabels, duration time.Duration)
	RecordModuleFailed(labels ModuleLabels)
	RecordModuleSuccessNooped(labels ModuleLabels)
	RecordModuleSuccessUpdated(labels ModuleLabels)
	RecordModuleSuccessRejected(labels ModuleLabels)
	RecordModuleExecutionError(labels ModuleLabels)
	RecordModuleTimeout(labels ModuleLabels)

	// RecordAdapterDuplicateBidID captures the  bid.ID collisions when adaptor
	// gives the bid response with multiple bids containing  same bid.ID
	RecordAdapterDuplicateBidID(adaptor string, collisions int)

	// RecordRequestHavingDuplicateBidID keeps track off how many request got bid.id collision
	// detected
	RecordRequestHavingDuplicateBidID()

	// RecordPodImpGenTime records number of impressions generated and time taken
	// by underneath algorithm to generate them
	// labels accept name of the algorithm and no of impressions generated
	// startTime indicates the time at which algorithm started
	// This function will take care of computing the elpased time
	RecordPodImpGenTime(labels PodLabels, startTime time.Time)

	// RecordPodCombGenTime records number of combinations generated and time taken
	// by underneath algorithm to generate them
	// labels accept name of the algorithm and no of combinations generated
	// elapsedTime indicates the time taken by combination generator to compute all requested combinations
	// This function will take care of computing the elpased time
	RecordPodCombGenTime(labels PodLabels, elapsedTime time.Duration)

	// RecordPodCompititveExclusionTime records time take by competitive exclusion
	// to compute the final Ad pod Response.
	// labels accept name of the algorithm and no of combinations evaluated, total bids
	// elapsedTime indicates the time taken by competitive exclusion to form final ad pod response using combinations and exclusion algorithm
	// This function will take care of computing the elpased time
	RecordPodCompititveExclusionTime(labels PodLabels, elapsedTime time.Duration)

	//RecordAdapterVideoBidDuration records actual ad duration returned by the bidder
	RecordAdapterVideoBidDuration(labels AdapterLabels, videoBidDuration int)

	//RecordFloorStatus records the floor validation status labeled by pubid, source and reason code
	RecordFloorStatus(pubId, source, code string)

	//RecordRejectedBids records the rejected bids labeled by pubid, bidder and reason code
	RecordRejectedBids(pubid, bidder, code string)
}

MetricsEngine is a generic interface to record PBS metrics into the desired backend The first three metrics function fire off once per incoming request, so total metrics will equal the total number of incoming requests. The remaining 5 fire off per outgoing request to a bidder adapter, so will record a number of hits per incoming request. The two groups should be consistent within themselves, but comparing numbers between groups is generally not useful.

type MetricsEngineMock

type MetricsEngineMock struct {
	mock.Mock
}

MetricsEngineMock is mock for the MetricsEngine interface

func (*MetricsEngineMock) RecordAccountCacheResult

func (me *MetricsEngineMock) RecordAccountCacheResult(cacheResult CacheResult, inc int)

RecordAccountCacheResult mock

func (*MetricsEngineMock) RecordAdapterBidReceived

func (me *MetricsEngineMock) RecordAdapterBidReceived(labels AdapterLabels, bidType openrtb_ext.BidType, hasAdm bool)

RecordAdapterBidReceived mock

func (*MetricsEngineMock) RecordAdapterBuyerUIDScrubbed

func (me *MetricsEngineMock) RecordAdapterBuyerUIDScrubbed(adapterName openrtb_ext.BidderName)

RecordAdapterBuyerUIDScrubbed mock

func (*MetricsEngineMock) RecordAdapterConnections

func (me *MetricsEngineMock) RecordAdapterConnections(bidderName openrtb_ext.BidderName, connWasReused bool, connWaitTime time.Duration)

RecordAdapterConnections mock

func (*MetricsEngineMock) RecordAdapterDuplicateBidID

func (me *MetricsEngineMock) RecordAdapterDuplicateBidID(adaptor string, collisions int)

RecordAdapterDuplicateBidID mock

func (*MetricsEngineMock) RecordAdapterGDPRRequestBlocked

func (me *MetricsEngineMock) RecordAdapterGDPRRequestBlocked(adapterName openrtb_ext.BidderName)

RecordAdapterGDPRRequestBlocked mock

func (*MetricsEngineMock) RecordAdapterPanic

func (me *MetricsEngineMock) RecordAdapterPanic(labels AdapterLabels)

RecordAdapterPanic mock

func (*MetricsEngineMock) RecordAdapterPrice

func (me *MetricsEngineMock) RecordAdapterPrice(labels AdapterLabels, cpm float64)

RecordAdapterPrice mock

func (*MetricsEngineMock) RecordAdapterRequest

func (me *MetricsEngineMock) RecordAdapterRequest(labels AdapterLabels)

RecordAdapterRequest mock

func (*MetricsEngineMock) RecordAdapterTime

func (me *MetricsEngineMock) RecordAdapterTime(labels AdapterLabels, length time.Duration)

RecordAdapterTime mock

func (*MetricsEngineMock) RecordAdapterVideoBidDuration

func (me *MetricsEngineMock) RecordAdapterVideoBidDuration(labels AdapterLabels, videoBidDuration int)

RecordAdapterVideoBidDuration mock

func (*MetricsEngineMock) RecordAdsCertReq

func (me *MetricsEngineMock) RecordAdsCertReq(success bool)

func (*MetricsEngineMock) RecordAdsCertSignTime

func (me *MetricsEngineMock) RecordAdsCertSignTime(adsCertSignTime time.Duration)

func (*MetricsEngineMock) RecordBadRequest

func (me *MetricsEngineMock) RecordBadRequest(endpoint string, pubId string, nbr *openrtb3.NoBidReason)

RecordPanic mock

func (*MetricsEngineMock) RecordBidValidationCreativeSizeError

func (me *MetricsEngineMock) RecordBidValidationCreativeSizeError(adapter openrtb_ext.BidderName, account string)

func (*MetricsEngineMock) RecordBidValidationCreativeSizeWarn

func (me *MetricsEngineMock) RecordBidValidationCreativeSizeWarn(adapter openrtb_ext.BidderName, account string)

func (*MetricsEngineMock) RecordBidValidationSecureMarkupError

func (me *MetricsEngineMock) RecordBidValidationSecureMarkupError(adapter openrtb_ext.BidderName, account string)

func (*MetricsEngineMock) RecordBidValidationSecureMarkupWarn

func (me *MetricsEngineMock) RecordBidValidationSecureMarkupWarn(adapter openrtb_ext.BidderName, account string)

func (*MetricsEngineMock) RecordBidderServerResponseTime

func (me *MetricsEngineMock) RecordBidderServerResponseTime(bidderServerResponseTime time.Duration)

RecordBidderServerResponseTime mock

func (*MetricsEngineMock) RecordBids

func (me *MetricsEngineMock) RecordBids(pubid, profileid, biddder, deal string)

func (*MetricsEngineMock) RecordConnectionAccept

func (me *MetricsEngineMock) RecordConnectionAccept(success bool)

RecordConnectionAccept mock

func (*MetricsEngineMock) RecordConnectionClose

func (me *MetricsEngineMock) RecordConnectionClose(success bool)

RecordConnectionClose mock

func (*MetricsEngineMock) RecordCookieSync

func (me *MetricsEngineMock) RecordCookieSync(status CookieSyncStatus)

RecordCookieSync mock

func (*MetricsEngineMock) RecordDNSTime

func (me *MetricsEngineMock) RecordDNSTime(dnsLookupTime time.Duration)

RecordDNSTime mock

func (*MetricsEngineMock) RecordDebugRequest

func (me *MetricsEngineMock) RecordDebugRequest(debugEnabled bool, pubId string)

RecordDebugRequest mock

func (*MetricsEngineMock) RecordFloorStatus

func (me *MetricsEngineMock) RecordFloorStatus(pubId, source, code string)

func (*MetricsEngineMock) RecordFloorsRequestForAccount

func (me *MetricsEngineMock) RecordFloorsRequestForAccount(pubId string)

func (*MetricsEngineMock) RecordImps

func (me *MetricsEngineMock) RecordImps(labels ImpLabels)

RecordImps mock

func (*MetricsEngineMock) RecordModuleCalled

func (me *MetricsEngineMock) RecordModuleCalled(labels ModuleLabels, duration time.Duration)

func (*MetricsEngineMock) RecordModuleExecutionError

func (me *MetricsEngineMock) RecordModuleExecutionError(labels ModuleLabels)

func (*MetricsEngineMock) RecordModuleFailed

func (me *MetricsEngineMock) RecordModuleFailed(labels ModuleLabels)

func (*MetricsEngineMock) RecordModuleSuccessNooped

func (me *MetricsEngineMock) RecordModuleSuccessNooped(labels ModuleLabels)

func (*MetricsEngineMock) RecordModuleSuccessRejected

func (me *MetricsEngineMock) RecordModuleSuccessRejected(labels ModuleLabels)

func (*MetricsEngineMock) RecordModuleSuccessUpdated

func (me *MetricsEngineMock) RecordModuleSuccessUpdated(labels ModuleLabels)

func (*MetricsEngineMock) RecordModuleTimeout

func (me *MetricsEngineMock) RecordModuleTimeout(labels ModuleLabels)

func (*MetricsEngineMock) RecordOverheadTime

func (me *MetricsEngineMock) RecordOverheadTime(overhead OverheadType, length time.Duration)

RecordOverheadTime mock

func (*MetricsEngineMock) RecordPanic

func (me *MetricsEngineMock) RecordPanic(hostname, method string)

RecordPanic mock

func (*MetricsEngineMock) RecordPodCombGenTime

func (me *MetricsEngineMock) RecordPodCombGenTime(labels PodLabels, elapsedTime time.Duration)

RecordPodCombGenTime mock

func (*MetricsEngineMock) RecordPodCompititveExclusionTime

func (me *MetricsEngineMock) RecordPodCompititveExclusionTime(labels PodLabels, elapsedTime time.Duration)

RecordPodCompititveExclusionTime mock

func (*MetricsEngineMock) RecordPodImpGenTime

func (me *MetricsEngineMock) RecordPodImpGenTime(labels PodLabels, startTime time.Time)

RecordPodImpGenTime mock

func (*MetricsEngineMock) RecordPrebidCacheRequestTime

func (me *MetricsEngineMock) RecordPrebidCacheRequestTime(success bool, length time.Duration)

RecordPrebidCacheRequestTime mock

func (*MetricsEngineMock) RecordRejectedBids

func (me *MetricsEngineMock) RecordRejectedBids(pubid, bidder, code string)

func (*MetricsEngineMock) RecordRejectedBidsForAccount

func (me *MetricsEngineMock) RecordRejectedBidsForAccount(pubId string)

func (*MetricsEngineMock) RecordRejectedBidsForBidder

func (me *MetricsEngineMock) RecordRejectedBidsForBidder(bidder openrtb_ext.BidderName)

func (*MetricsEngineMock) RecordRequest

func (me *MetricsEngineMock) RecordRequest(labels Labels)

RecordRequest mock

func (*MetricsEngineMock) RecordRequestHavingDuplicateBidID

func (me *MetricsEngineMock) RecordRequestHavingDuplicateBidID()

RecordRequestHavingDuplicateBidID mock

func (*MetricsEngineMock) RecordRequestPrivacy

func (me *MetricsEngineMock) RecordRequestPrivacy(privacy PrivacyLabels)

RecordRequestPrivacy mock

func (*MetricsEngineMock) RecordRequestQueueTime

func (me *MetricsEngineMock) RecordRequestQueueTime(success bool, requestType RequestType, length time.Duration)

RecordRequestQueueTime mock

func (*MetricsEngineMock) RecordRequestTime

func (me *MetricsEngineMock) RecordRequestTime(labels Labels, length time.Duration)

RecordRequestTime mock

func (*MetricsEngineMock) RecordSetUid

func (me *MetricsEngineMock) RecordSetUid(status SetUidStatus)

RecordSetUid mock

func (*MetricsEngineMock) RecordStoredDataError

func (me *MetricsEngineMock) RecordStoredDataError(labels StoredDataLabels)

RecordStoredDataError mock

func (*MetricsEngineMock) RecordStoredDataFetchTime

func (me *MetricsEngineMock) RecordStoredDataFetchTime(labels StoredDataLabels, length time.Duration)

RecordStoredDataFetchTime mock

func (*MetricsEngineMock) RecordStoredImpCacheResult

func (me *MetricsEngineMock) RecordStoredImpCacheResult(cacheResult CacheResult, inc int)

RecordStoredImpCacheResult mock

func (*MetricsEngineMock) RecordStoredReqCacheResult

func (me *MetricsEngineMock) RecordStoredReqCacheResult(cacheResult CacheResult, inc int)

RecordStoredReqCacheResult mock

func (*MetricsEngineMock) RecordStoredResponse

func (me *MetricsEngineMock) RecordStoredResponse(pubId string)

func (*MetricsEngineMock) RecordSyncerRequest

func (me *MetricsEngineMock) RecordSyncerRequest(key string, status SyncerCookieSyncStatus)

RecordSyncerRequest mock

func (*MetricsEngineMock) RecordSyncerSet

func (me *MetricsEngineMock) RecordSyncerSet(key string, status SyncerSetUidStatus)

RecordSyncerSet mock

func (*MetricsEngineMock) RecordTLSHandshakeTime

func (me *MetricsEngineMock) RecordTLSHandshakeTime(bidderName openrtb_ext.BidderName, tlsHandshakeTime time.Duration)

func (*MetricsEngineMock) RecordTMaxTimeout

func (me *MetricsEngineMock) RecordTMaxTimeout()

RecordTMaxTimeout mock

func (*MetricsEngineMock) RecordTimeoutNotice

func (me *MetricsEngineMock) RecordTimeoutNotice(success bool)

RecordTimeoutNotice mock

func (*MetricsEngineMock) RecordVASTTagType

func (me *MetricsEngineMock) RecordVASTTagType(bidder, vastTagType string)

RecordVASTTagType mock

func (*MetricsEngineMock) RecordVastVersion

func (me *MetricsEngineMock) RecordVastVersion(coreBidder, vastVersion string)

RecordVastVersion mock

func (*MetricsEngineMock) RecordXMLParserResponseMismatch

func (me *MetricsEngineMock) RecordXMLParserResponseMismatch(method string, isMismatch bool)

RecordXMLParserResponseMismatch mock

func (*MetricsEngineMock) RecordXMLParserResponseTime

func (me *MetricsEngineMock) RecordXMLParserResponseTime(parser string, method string, respTime time.Duration)

RecordXMLParserResponseTime records execution time for multiple parsers

type ModuleLabels

type ModuleLabels struct {
	Module    string
	Stage     string
	AccountID string
}

type ModuleMetrics

type ModuleMetrics struct {
	DurationTimer         metrics.Timer
	CallCounter           metrics.Counter
	FailureCounter        metrics.Counter
	SuccessNoopCounter    metrics.Counter
	SuccessUpdateCounter  metrics.Counter
	SuccessRejectCounter  metrics.Counter
	ExecutionErrorCounter metrics.Counter
	TimeoutCounter        metrics.Counter
}

type OWMetricsEngine

type OWMetricsEngine interface {
	//RecordBids records the bidder deal bids labeled by pubid, profile, bidder and deal
	RecordBids(pubid, profileid, bidder, deal string)
	//RecordVastVersion record the count of vast version labelled by bidder and vast version
	RecordVastVersion(coreBidder, vastVersion string)
	//RecordVASTTagType record the count of vast tag type labeled by bidder and vast tag
	RecordVASTTagType(bidder, vastTagType string)

	RecordPanic(hostname, method string)
	RecordBadRequest(endpoint string, pubId string, nbr *openrtb3.NoBidReason)
	//RecordXMLParserResponseTime records execution time for multiple parsers
	RecordXMLParserResponseTime(parser string, method string, respTime time.Duration)
	//RecordXMLParserResponseMismatch records number of response mismatch
	RecordXMLParserResponseMismatch(method string, isMismatch bool)
}

type OverheadType

type OverheadType string

OverheadType: overhead type enumeration

const (
	// PreBidder - measures the time needed to execute the adapter's MakeRequests() implementation, build Prebid headers and apply GZip compression if needed
	PreBidder OverheadType = "pre-bidder"
	// MakeAuctionResponse - measures the amount of time spent doing all the MakeBids() calls as well as preparing PBS's response
	MakeAuctionResponse OverheadType = "make-auction-response"
	// MakeBidderRequests - measures the time needed to fetch a stored request (if needed), parse, unmarshal, and validate the OpenRTB request, interpret its privacy policies, and split it into multiple requests sanitized for each bidder
	MakeBidderRequests OverheadType = "make-bidder-requests"
)

func OverheadTypes

func OverheadTypes() []OverheadType

func (OverheadType) String

func (t OverheadType) String() string

type PodLabels

type PodLabels struct {
	AlgorithmName    string // AlgorithmName which is used for generating impressions
	NoOfImpressions  *int   // NoOfImpressions represents number of impressions generated
	NoOfCombinations *int   // NoOfCombinations represents number of combinations generated
	NoOfResponseBids *int   // NoOfResponseBids represents number of bids responded (including bids with similar duration)
}

PodLabels defines metric labels describing algorithm type and other labels as per scenario

type PrivacyLabels

type PrivacyLabels struct {
	CCPAEnforced   bool
	CCPAProvided   bool
	COPPAEnforced  bool
	GDPREnforced   bool
	GDPRTCFVersion TCFVersionValue
	LMTEnforced    bool
}

PrivacyLabels defines metrics describing the result of privacy enforcement.

type RequestLabels

type RequestLabels struct {
	RequestStatus RequestStatus
}

RequestLabels defines metric labels describing the result of a network request.

type RequestStatus

type RequestStatus string

RequestStatus : The request return status

const (
	RequestStatusOK               RequestStatus = "ok"
	RequestStatusBadInput         RequestStatus = "badinput"
	RequestStatusErr              RequestStatus = "err"
	RequestStatusNetworkErr       RequestStatus = "networkerr"
	RequestStatusBlacklisted      RequestStatus = "blacklistedacctorapp"
	RequestStatusQueueTimeout     RequestStatus = "queuetimeout"
	RequestStatusAccountConfigErr RequestStatus = "acctconfigerr"
)

Request/return status

func RequestStatuses

func RequestStatuses() []RequestStatus

type RequestType

type RequestType string

RequestType : Request type enumeration

const (
	ReqTypeORTB2Web  RequestType = "openrtb2-web"
	ReqTypeORTB2App  RequestType = "openrtb2-app"
	ReqTypeORTB2DOOH RequestType = "openrtb2-dooh"
	ReqTypeAMP       RequestType = "amp"
	ReqTypeVideo     RequestType = "video"
)

The request types (endpoints)

func RequestTypes

func RequestTypes() []RequestType

type SetUidStatus

type SetUidStatus string

SetUidStatus is a status code resulting from a call to the /setuid endpoint.

const (
	SetUidOK                     SetUidStatus = "ok"
	SetUidBadRequest             SetUidStatus = "bad_request"
	SetUidOptOut                 SetUidStatus = "opt_out"
	SetUidGDPRHostCookieBlocked  SetUidStatus = "gdpr_blocked_host_cookie"
	SetUidAccountBlocked         SetUidStatus = "acct_blocked"
	SetUidAccountConfigMalformed SetUidStatus = "acct_config_malformed"
	SetUidAccountInvalid         SetUidStatus = "acct_invalid"
	SetUidSyncerUnknown          SetUidStatus = "syncer_unknown"
)

/setuid action labels

func SetUidStatuses

func SetUidStatuses() []SetUidStatus

SetUidStatuses returns possible setuid statuses.

type StoredDataError

type StoredDataError string
const (
	StoredDataErrorNetwork   StoredDataError = "network"
	StoredDataErrorUndefined StoredDataError = "undefined"
)

func StoredDataErrors

func StoredDataErrors() []StoredDataError

type StoredDataFetchType

type StoredDataFetchType string
const (
	FetchAll   StoredDataFetchType = "all"
	FetchDelta StoredDataFetchType = "delta"
)

func StoredDataFetchTypes

func StoredDataFetchTypes() []StoredDataFetchType

type StoredDataLabels

type StoredDataLabels struct {
	DataType      StoredDataType
	DataFetchType StoredDataFetchType
	Error         StoredDataError
}

type StoredDataType

type StoredDataType string
const (
	AccountDataType  StoredDataType = "account"
	AMPDataType      StoredDataType = "amp"
	CategoryDataType StoredDataType = "category"
	RequestDataType  StoredDataType = "request"
	VideoDataType    StoredDataType = "video"
	ResponseDataType StoredDataType = "response"
)

func StoredDataTypes

func StoredDataTypes() []StoredDataType

type SyncerCookieSyncStatus

type SyncerCookieSyncStatus string

SyncerCookieSyncStatus is a status code from an invocation of a syncer resulting from a call to the /cookie_sync endpoint.

const (
	SyncerCookieSyncOK               SyncerCookieSyncStatus = "ok"
	SyncerCookieSyncPrivacyBlocked   SyncerCookieSyncStatus = "privacy_blocked"
	SyncerCookieSyncAlreadySynced    SyncerCookieSyncStatus = "already_synced"
	SyncerCookieSyncTypeNotSupported SyncerCookieSyncStatus = "type_not_supported"
)

func SyncerRequestStatuses

func SyncerRequestStatuses() []SyncerCookieSyncStatus

SyncerRequestStatuses returns possible syncer statuses.

type SyncerSetUidStatus

type SyncerSetUidStatus string

SyncerSetUidStatus is a status code from an invocation of a syncer resulting from a call to the /setuid endpoint.

const (
	SyncerSetUidOK      SyncerSetUidStatus = "ok"
	SyncerSetUidCleared SyncerSetUidStatus = "cleared"
)

func SyncerSetUidStatuses

func SyncerSetUidStatuses() []SyncerSetUidStatus

SyncerSetUidStatuses returns possible syncer set statuses.

type TCFVersionValue

type TCFVersionValue string

TCFVersionValue : The possible values for TCF versions

const (
	TCFVersionErr TCFVersionValue = "err"
	TCFVersionV2  TCFVersionValue = "v2"
)

func TCFVersionToValue

func TCFVersionToValue(version int) TCFVersionValue

TCFVersionToValue takes an integer TCF version and returns the corresponding TCFVersionValue

func TCFVersions

func TCFVersions() []TCFVersionValue

TCFVersions returns the possible values for the TCF version

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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