Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
pm-viral-vala committed Jan 6, 2025
1 parent 3359a04 commit bd5a66e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 13 deletions.
4 changes: 0 additions & 4 deletions endpoints/openrtb2/test_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"testing"
"time"

"git.pubmatic.com/vastunwrap/unwrap"
"github.com/buger/jsonparser"
"github.com/julienschmidt/httprouter"
"github.com/prebid/openrtb/v20/openrtb2"
Expand Down Expand Up @@ -1204,9 +1203,6 @@ func (te *exchangeTestWrapper) HoldAuction(ctx context.Context, r *exchange.Auct
return te.ex.HoldAuction(ctx, r, debugLog)
}

func (te *exchangeTestWrapper) RecordFastXMLTestMetrics(ctx *unwrap.UnwrapContext, etreeResp, fastxmlResp *unwrap.UnwrapResponse) {
}

// buildTestExchange returns an exchange with mock bidder servers and mock currency conversion server
func buildTestExchange(testCfg *testConfigValues, adapterMap map[openrtb_ext.BidderName]exchange.AdaptedBidder, mockBidServersArray []*httptest.Server, mockCurrencyRatesServer *httptest.Server, bidderInfos config.BidderInfos, cfg *config.Configuration, met metrics.MetricsEngine, mockFetcher stored_requests.CategoryFetcher) (exchange.Exchange, []*httptest.Server) {
if len(testCfg.MockBidders) == 0 {
Expand Down
2 changes: 0 additions & 2 deletions exchange/exchange.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"strings"
"time"

"git.pubmatic.com/vastunwrap/unwrap"
"github.com/prebid/prebid-server/v2/modules/pubmatic/openwrap/models/nbr"
"github.com/prebid/prebid-server/v2/modules/pubmatic/openwrap/utils"
"github.com/prebid/prebid-server/v2/privacy"
Expand Down Expand Up @@ -57,7 +56,6 @@ type extCacheInstructions struct {
type Exchange interface {
// HoldAuction executes an OpenRTB v2.5 Auction.
HoldAuction(ctx context.Context, r *AuctionRequest, debugLog *DebugLog) (*AuctionResponse, error)
RecordFastXMLTestMetrics(ctx *unwrap.UnwrapContext, etreeResp, fastxmlResp *unwrap.UnwrapResponse)
}

// IdFetcher can find the user's ID for a specific Bidder.
Expand Down
8 changes: 4 additions & 4 deletions exchange/exchange_ow.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,10 @@ func recordBids(ctx context.Context, metricsEngine metrics.MetricsEngine, pubID
}
}

func (e *exchange) RecordFastXMLTestMetrics(ctx *unwrap.UnwrapContext, etreeResp, fastxmlResp *unwrap.UnwrapResponse) {
e.me.RecordXMLParserResponseTime(metrics.XMLParserLabelFastXML, "unwrap", ctx.FastXMLTestCtx.FastXMLStats.ResponseTime)
e.me.RecordXMLParserResponseTime(metrics.XMLParserLabelETree, "unwrap", ctx.FastXMLTestCtx.ETreeStats.ResponseTime)
e.me.RecordXMLParserResponseMismatch("unwrap", (etreeResp != fastxmlResp))
func RecordFastXMLTestMetrics(metricsEngine metrics.MetricsEngine, ctx *unwrap.UnwrapContext, etreeResp, fastxmlResp *unwrap.UnwrapResponse) {
metricsEngine.RecordXMLParserResponseTime(metrics.XMLParserLabelFastXML, "unwrap", ctx.FastXMLTestCtx.FastXMLStats.ResponseTime)
metricsEngine.RecordXMLParserResponseTime(metrics.XMLParserLabelETree, "unwrap", ctx.FastXMLTestCtx.ETreeStats.ResponseTime)
metricsEngine.RecordXMLParserResponseMismatch("unwrap", string(etreeResp.Response) != string(fastxmlResp.Response))
}

func recordVastVersion(metricsEngine metrics.MetricsEngine, adapterBids map[openrtb_ext.BidderName]*entities.PbsOrtbSeatBid) {
Expand Down
6 changes: 3 additions & 3 deletions router/router_ow.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"net/http"

unwrap "git.pubmatic.com/vastunwrap/unwrap"
"github.com/PubMatic-OpenWrap/prebid-server/v2/exchange"
"github.com/julienschmidt/httprouter"
middleware "github.com/prebid/prebid-server/v2/modules/pubmatic/openwrap/middleware/adpod"
)
Expand Down Expand Up @@ -56,10 +57,9 @@ func (r *Router) registerOpenWrapEndpoints(openrtbEndpoint, ampEndpoint httprout
}

func initFastXMLTest() {
if g_ex != nil {
if g_metrics != nil {
unwrap.InitRecordFastXMLTestMetrics(func(ctx *unwrap.UnwrapContext, etreeResp, fastxmlResp *unwrap.UnwrapResponse) {
e := *g_ex
e.RecordFastXMLTestMetrics(ctx, etreeResp, fastxmlResp)
exchange.RecordFastXMLTestMetrics(g_metrics, ctx, etreeResp, fastxmlResp)
})
}
}

0 comments on commit bd5a66e

Please sign in to comment.