github.com/prebid/prebid-server/v2@v2.18.0/metrics/metrics_mock.go (about) 1 package metrics 2 3 import ( 4 "time" 5 6 "github.com/prebid/prebid-server/v2/openrtb_ext" 7 "github.com/stretchr/testify/mock" 8 ) 9 10 // MetricsEngineMock is mock for the MetricsEngine interface 11 type MetricsEngineMock struct { 12 mock.Mock 13 } 14 15 // RecordRequest mock 16 func (me *MetricsEngineMock) RecordRequest(labels Labels) { 17 me.Called(labels) 18 } 19 20 // RecordConnectionAccept mock 21 func (me *MetricsEngineMock) RecordConnectionAccept(success bool) { 22 me.Called(success) 23 } 24 25 // RecordTMaxTimeout mock 26 func (me *MetricsEngineMock) RecordTMaxTimeout() { 27 me.Called() 28 } 29 30 // RecordConnectionClose mock 31 func (me *MetricsEngineMock) RecordConnectionClose(success bool) { 32 me.Called(success) 33 } 34 35 // RecordImps mock 36 func (me *MetricsEngineMock) RecordImps(labels ImpLabels) { 37 me.Called(labels) 38 } 39 40 // RecordRequestTime mock 41 func (me *MetricsEngineMock) RecordRequestTime(labels Labels, length time.Duration) { 42 me.Called(labels, length) 43 } 44 45 // RecordStoredDataFetchTime mock 46 func (me *MetricsEngineMock) RecordStoredDataFetchTime(labels StoredDataLabels, length time.Duration) { 47 me.Called(labels, length) 48 } 49 50 // RecordStoredDataError mock 51 func (me *MetricsEngineMock) RecordStoredDataError(labels StoredDataLabels) { 52 me.Called(labels) 53 } 54 55 // RecordAdapterPanic mock 56 func (me *MetricsEngineMock) RecordAdapterPanic(labels AdapterLabels) { 57 me.Called(labels) 58 } 59 60 // RecordAdapterRequest mock 61 func (me *MetricsEngineMock) RecordAdapterRequest(labels AdapterLabels) { 62 me.Called(labels) 63 } 64 65 // RecordAdapterConnections mock 66 func (me *MetricsEngineMock) RecordAdapterConnections(bidderName openrtb_ext.BidderName, connWasReused bool, connWaitTime time.Duration) { 67 me.Called(bidderName, connWasReused, connWaitTime) 68 } 69 70 // RecordDNSTime mock 71 func (me *MetricsEngineMock) RecordDNSTime(dnsLookupTime time.Duration) { 72 me.Called(dnsLookupTime) 73 } 74 75 func (me *MetricsEngineMock) RecordTLSHandshakeTime(tlsHandshakeTime time.Duration) { 76 me.Called(tlsHandshakeTime) 77 } 78 79 // RecordBidderServerResponseTime mock 80 func (me *MetricsEngineMock) RecordBidderServerResponseTime(bidderServerResponseTime time.Duration) { 81 me.Called(bidderServerResponseTime) 82 } 83 84 // RecordAdapterBidReceived mock 85 func (me *MetricsEngineMock) RecordAdapterBidReceived(labels AdapterLabels, bidType openrtb_ext.BidType, hasAdm bool) { 86 me.Called(labels, bidType, hasAdm) 87 } 88 89 // RecordAdapterPrice mock 90 func (me *MetricsEngineMock) RecordAdapterPrice(labels AdapterLabels, cpm float64) { 91 me.Called(labels, cpm) 92 } 93 94 // RecordAdapterTime mock 95 func (me *MetricsEngineMock) RecordAdapterTime(labels AdapterLabels, length time.Duration) { 96 me.Called(labels, length) 97 } 98 99 // RecordOverheadTime mock 100 func (me *MetricsEngineMock) RecordOverheadTime(overhead OverheadType, length time.Duration) { 101 me.Called(overhead, length) 102 } 103 104 // RecordCookieSync mock 105 func (me *MetricsEngineMock) RecordCookieSync(status CookieSyncStatus) { 106 me.Called(status) 107 } 108 109 // RecordSyncerRequest mock 110 func (me *MetricsEngineMock) RecordSyncerRequest(key string, status SyncerCookieSyncStatus) { 111 me.Called(key, status) 112 } 113 114 // RecordSetUid mock 115 func (me *MetricsEngineMock) RecordSetUid(status SetUidStatus) { 116 me.Called(status) 117 } 118 119 // RecordSyncerSet mock 120 func (me *MetricsEngineMock) RecordSyncerSet(key string, status SyncerSetUidStatus) { 121 me.Called(key, status) 122 } 123 124 // RecordStoredReqCacheResult mock 125 func (me *MetricsEngineMock) RecordStoredReqCacheResult(cacheResult CacheResult, inc int) { 126 me.Called(cacheResult, inc) 127 } 128 129 // RecordStoredImpCacheResult mock 130 func (me *MetricsEngineMock) RecordStoredImpCacheResult(cacheResult CacheResult, inc int) { 131 me.Called(cacheResult, inc) 132 } 133 134 // RecordAccountCacheResult mock 135 func (me *MetricsEngineMock) RecordAccountCacheResult(cacheResult CacheResult, inc int) { 136 me.Called(cacheResult, inc) 137 } 138 139 // RecordPrebidCacheRequestTime mock 140 func (me *MetricsEngineMock) RecordPrebidCacheRequestTime(success bool, length time.Duration) { 141 me.Called(success, length) 142 } 143 144 // RecordRequestQueueTime mock 145 func (me *MetricsEngineMock) RecordRequestQueueTime(success bool, requestType RequestType, length time.Duration) { 146 me.Called(success, requestType, length) 147 } 148 149 // RecordTimeoutNotice mock 150 func (me *MetricsEngineMock) RecordTimeoutNotice(success bool) { 151 me.Called(success) 152 } 153 154 // RecordRequestPrivacy mock 155 func (me *MetricsEngineMock) RecordRequestPrivacy(privacy PrivacyLabels) { 156 me.Called(privacy) 157 } 158 159 // RecordAdapterBuyerUIDScrubbed mock 160 func (me *MetricsEngineMock) RecordAdapterBuyerUIDScrubbed(adapterName openrtb_ext.BidderName) { 161 me.Called(adapterName) 162 } 163 164 // RecordAdapterGDPRRequestBlocked mock 165 func (me *MetricsEngineMock) RecordAdapterGDPRRequestBlocked(adapterName openrtb_ext.BidderName) { 166 me.Called(adapterName) 167 } 168 169 // RecordDebugRequest mock 170 func (me *MetricsEngineMock) RecordDebugRequest(debugEnabled bool, pubId string) { 171 me.Called(debugEnabled, pubId) 172 } 173 174 func (me *MetricsEngineMock) RecordStoredResponse(pubId string) { 175 me.Called(pubId) 176 } 177 178 func (me *MetricsEngineMock) RecordAdsCertReq(success bool) { 179 me.Called(success) 180 } 181 182 func (me *MetricsEngineMock) RecordAdsCertSignTime(adsCertSignTime time.Duration) { 183 me.Called(adsCertSignTime) 184 } 185 186 func (me *MetricsEngineMock) RecordBidValidationCreativeSizeError(adapter openrtb_ext.BidderName, account string) { 187 me.Called(adapter, account) 188 } 189 190 func (me *MetricsEngineMock) RecordBidValidationCreativeSizeWarn(adapter openrtb_ext.BidderName, account string) { 191 me.Called(adapter, account) 192 } 193 194 func (me *MetricsEngineMock) RecordBidValidationSecureMarkupError(adapter openrtb_ext.BidderName, account string) { 195 me.Called(adapter, account) 196 } 197 198 func (me *MetricsEngineMock) RecordBidValidationSecureMarkupWarn(adapter openrtb_ext.BidderName, account string) { 199 me.Called(adapter, account) 200 } 201 202 func (me *MetricsEngineMock) RecordModuleCalled(labels ModuleLabels, duration time.Duration) { 203 me.Called(labels, duration) 204 } 205 206 func (me *MetricsEngineMock) RecordModuleFailed(labels ModuleLabels) { 207 me.Called(labels) 208 } 209 210 func (me *MetricsEngineMock) RecordModuleSuccessNooped(labels ModuleLabels) { 211 me.Called(labels) 212 } 213 214 func (me *MetricsEngineMock) RecordModuleSuccessUpdated(labels ModuleLabels) { 215 me.Called(labels) 216 } 217 218 func (me *MetricsEngineMock) RecordModuleSuccessRejected(labels ModuleLabels) { 219 me.Called(labels) 220 } 221 222 func (me *MetricsEngineMock) RecordModuleExecutionError(labels ModuleLabels) { 223 me.Called(labels) 224 } 225 226 func (me *MetricsEngineMock) RecordModuleTimeout(labels ModuleLabels) { 227 me.Called(labels) 228 }