Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UOE-11752: Add stats for fastxml in vastunwrap repository #990

Open
wants to merge 9 commits into
base: ci
Choose a base branch
from
6 changes: 3 additions & 3 deletions adapters/vastbidder/vastbidder.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ func (a *VASTBidder) fastXMLTesting(handler *responseHandler, responseData *adap
}

xmlParsingMetrics := &openrtb_ext.FastXMLMetrics{
XMLParserTime: handlerTime,
EtreeParserTime: etreeParserTime,
IsRespMismatch: isVASTMismatch,
FastXMLParserTime: handlerTime,
EtreeParserTime: etreeParserTime,
IsRespMismatch: isVASTMismatch,
}

responseData.FastXMLMetrics = xmlParsingMetrics
Expand Down
33 changes: 7 additions & 26 deletions endpoints/events/vtrack_ow.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"bytes"
"encoding/base64"
"errors"
"regexp"
"strings"
"time"

Expand All @@ -17,7 +16,6 @@ import (

var (
errEventURLNotConfigured = errors.New("event urls not configured")
tmpWSRemoverRegex = regexp.MustCompile(`>\s+<`)
)

// InjectVideoEventTrackers injects the video tracking events
Expand Down Expand Up @@ -62,20 +60,19 @@ func InjectVideoEventTrackers(

//temporary
if fastXMLResponse != vastXML {
fastXMLResponse, etreeXMLResponse = tmpFastXMLProcessing(fastXMLResponse, response)
fastXMLResponse, etreeXMLResponse = openrtb_ext.FastXMLPostProcessing(fastXMLResponse, response)
}

isResponseMismatch := (etreeXMLResponse != fastXMLResponse)
metrics = &openrtb_ext.FastXMLMetrics{
FastXMLParserTime: fastXMLParserTime,
EtreeParserTime: etreeParserTime,
IsRespMismatch: (etreeXMLResponse != fastXMLResponse),
}

if isResponseMismatch {
if metrics.IsRespMismatch {
openrtb_ext.FastXMLLogf("\n[XML_PARSER_TEST] method:[vcr] creative:[%s]", base64.StdEncoding.EncodeToString([]byte(vastXML)))
}

metrics = &openrtb_ext.FastXMLMetrics{
XMLParserTime: fastXMLParserTime,
EtreeParserTime: etreeParserTime,
IsRespMismatch: isResponseMismatch,
}
}

return response, metrics, err
Expand Down Expand Up @@ -197,9 +194,6 @@ func injectVideoEventsFastXML(vastXML string, eventURLMap map[string]string, nur
return vastXML, nil
}

//Add CDATA and Expand Inline Nodes
xu.ApplyXMLSettingsOperations()

var buf bytes.Buffer
xu.Build(&buf)
return buf.String(), nil
Expand Down Expand Up @@ -229,16 +223,3 @@ func FindCreatives(doc *etree.Document) []*etree.Element {
creatives = append(creatives, doc.FindElements("VAST/Ad/Wrapper/Creatives/Creative/NonLinearAds")...)
return creatives
}

func tmpFastXMLProcessing(fastXML, etreeXML string) (string, string) {
//replace only if trackers are injected
fastXML = strings.TrimSpace(fastXML) //step1: remove heading and trailing whitespaces
fastXML = tmpWSRemoverRegex.ReplaceAllString(fastXML, "><") //step2: remove inbetween whitespaces
fastXML = strings.ReplaceAll(fastXML, " ><", "><") //step3: remove attribute endtag whitespace (this should be always before step2)
fastXML = strings.ReplaceAll(fastXML, "'", "\"") //step4: convert single quote to double quote

etreeXML = tmpWSRemoverRegex.ReplaceAllString(etreeXML, "><") //step2: remove inbetween whitespaces
etreeXML = strings.ReplaceAll(etreeXML, " ><", "><") //step3: remove attribute endtag whitespace (this should be always before step2)
etreeXML = strings.ReplaceAll(etreeXML, "'", "\"")
return fastXML, etreeXML
}
2 changes: 1 addition & 1 deletion endpoints/events/vtrack_ow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ func TestCompareXMLParsers(t *testing.T) {
fastXML, _ := injectVideoEventsFastXML(vast, eventURLMap, false, adcom1.LinearityLinear)

if vast != fastXML {
fastXML, etreeXML = tmpFastXMLProcessing(fastXML, etreeXML)
fastXML, etreeXML = openrtb_ext.FastXMLPostProcessing(fastXML, etreeXML)
}

if len(debugLines) > 0 {
Expand Down
36 changes: 31 additions & 5 deletions exchange/exchange_ow.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package exchange

import (
"context"
"encoding/base64"
"encoding/json"
"errors"
"fmt"
Expand All @@ -10,6 +11,7 @@ import (
"strconv"
"strings"

unwrapmodels "git.pubmatic.com/vastunwrap/unwrap/models"
"github.com/golang/glog"
"github.com/prebid/openrtb/v20/openrtb2"
"github.com/prebid/prebid-server/v2/adapters"
Expand Down Expand Up @@ -184,6 +186,30 @@ func recordBids(ctx context.Context, metricsEngine metrics.MetricsEngine, pubID
}
}

func RecordFastXMLTestMetrics(metricsEngine metrics.MetricsEngine, ctx *unwrapmodels.UnwrapContext, etreeResp, fastxmlResp *unwrapmodels.UnwrapResponse) {
fastxmlResponse, etreeResponse := openrtb_ext.FastXMLPostProcessing(string(fastxmlResp.Response), string(etreeResp.Response))

fastxmlMetrics := openrtb_ext.FastXMLMetrics{
EtreeParserTime: ctx.FastXMLTestCtx.ETreeStats.ProcessingTime,
FastXMLParserTime: ctx.FastXMLTestCtx.FastXMLStats.ProcessingTime,
IsRespMismatch: etreeResponse != fastxmlResponse,
}

if fastxmlMetrics.IsRespMismatch {
var flog openrtb_ext.UnwrapFastXMLLog
flog.InputXML = string(ctx.Vast)
for _, mock := range ctx.FastXMLTestCtx.WrapperMock {
flog.VASTXmls = append(flog.VASTXmls, string(mock.GetResponseBytes()))
}
resp, _ := json.Marshal(&flog)
openrtb_ext.FastXMLLogf("\n[XML_PARSER_TEST] method:[unwrap] response:[%s]", base64.StdEncoding.EncodeToString([]byte(resp)))
}

recordFastXMLMetrics(metricsEngine, "unwrap", &fastxmlMetrics)
metricsEngine.RecordXMLParserResponseTime(metrics.XMLParserLabelFastXML, "unwrap", ctx.FastXMLTestCtx.FastXMLStats.ResponseTime)
metricsEngine.RecordXMLParserResponseTime(metrics.XMLParserLabelETree, "unwrap", ctx.FastXMLTestCtx.ETreeStats.ResponseTime)
}

func recordVastVersion(metricsEngine metrics.MetricsEngine, adapterBids map[openrtb_ext.BidderName]*entities.PbsOrtbSeatBid) {
for _, seatBid := range adapterBids {
for _, pbsBid := range seatBid.Bids {
Expand Down Expand Up @@ -213,17 +239,17 @@ func recordOpenWrapBidResponseMetrics(bidder *bidderAdapter, bidResponse *adapte
recordFastXMLMetrics(bidder.me, "vastbidder", bidResponse.FastXMLMetrics)
if bidResponse.FastXMLMetrics.IsRespMismatch {
resp, _ := jsonutil.Marshal(bidResponse)
openrtb_ext.FastXMLLogf("\n[XML_PARSER_TEST] method:[vast_bidder] response:[%s]", resp)
openrtb_ext.FastXMLLogf("\n[XML_PARSER_TEST] method:[vast_bidder] response:[%s]", base64.StdEncoding.EncodeToString([]byte(resp)))
}
}

recordVASTTagType(bidder.me, bidResponse, bidder.BidderName)
}

func recordFastXMLMetrics(metricsEngine metrics.MetricsEngine, method string, vastBidderInfo *openrtb_ext.FastXMLMetrics) {
metricsEngine.RecordXMLParserResponseTime(metrics.XMLParserLabelFastXML, method, vastBidderInfo.XMLParserTime)
metricsEngine.RecordXMLParserResponseTime(metrics.XMLParserLabelETree, method, vastBidderInfo.EtreeParserTime)
metricsEngine.RecordXMLParserResponseMismatch(method, vastBidderInfo.IsRespMismatch)
func recordFastXMLMetrics(metricsEngine metrics.MetricsEngine, method string, fastxmlMetrics *openrtb_ext.FastXMLMetrics) {
metricsEngine.RecordXMLParserProcessingTime(metrics.XMLParserLabelFastXML, method, fastxmlMetrics.FastXMLParserTime)
metricsEngine.RecordXMLParserProcessingTime(metrics.XMLParserLabelETree, method, fastxmlMetrics.EtreeParserTime)
metricsEngine.RecordXMLParserResponseMismatch(method, fastxmlMetrics.IsRespMismatch)
}

func recordVASTTagType(metricsEngine metrics.MetricsEngine, adapterBids *adapters.BidderResponse, bidder openrtb_ext.BidderName) {
Expand Down
20 changes: 10 additions & 10 deletions exchange/exchange_ow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1829,14 +1829,14 @@ func TestRecordFastXMLMetrics(t *testing.T) {
name: "Record_Fast_XML_Metrics_Respnse_matched",
args: args{
vastBidderInfo: &openrtb_ext.FastXMLMetrics{
XMLParserTime: time.Millisecond * 10,
EtreeParserTime: time.Millisecond * 20,
IsRespMismatch: false,
FastXMLParserTime: time.Millisecond * 10,
EtreeParserTime: time.Millisecond * 20,
IsRespMismatch: false,
},
getMetricsEngine: func() *metrics.MetricsEngineMock {
metricEngine := &metrics.MetricsEngineMock{}
metricEngine.Mock.On("RecordXMLParserResponseTime", metrics.XMLParserLabelFastXML, testMethodName, time.Millisecond*10).Return()
metricEngine.Mock.On("RecordXMLParserResponseTime", metrics.XMLParserLabelETree, testMethodName, time.Millisecond*20).Return()
metricEngine.Mock.On("RecordXMLParserProcessingTime", metrics.XMLParserLabelFastXML, testMethodName, time.Millisecond*10).Return()
metricEngine.Mock.On("RecordXMLParserProcessingTime", metrics.XMLParserLabelETree, testMethodName, time.Millisecond*20).Return()
metricEngine.Mock.On("RecordXMLParserResponseMismatch", testMethodName, false).Return()
return metricEngine
},
Expand All @@ -1846,14 +1846,14 @@ func TestRecordFastXMLMetrics(t *testing.T) {
name: "Record_Fast_XML_Metrics_Respnse_mismatched",
args: args{
vastBidderInfo: &openrtb_ext.FastXMLMetrics{
XMLParserTime: time.Millisecond * 15,
EtreeParserTime: time.Millisecond * 25,
IsRespMismatch: true,
FastXMLParserTime: time.Millisecond * 15,
EtreeParserTime: time.Millisecond * 25,
IsRespMismatch: true,
},
getMetricsEngine: func() *metrics.MetricsEngineMock {
metricEngine := &metrics.MetricsEngineMock{}
metricEngine.Mock.On("RecordXMLParserResponseTime", metrics.XMLParserLabelFastXML, testMethodName, time.Millisecond*15).Return()
metricEngine.Mock.On("RecordXMLParserResponseTime", metrics.XMLParserLabelETree, testMethodName, time.Millisecond*25).Return()
metricEngine.Mock.On("RecordXMLParserProcessingTime", metrics.XMLParserLabelFastXML, testMethodName, time.Millisecond*15).Return()
metricEngine.Mock.On("RecordXMLParserProcessingTime", metrics.XMLParserLabelETree, testMethodName, time.Millisecond*25).Return()
metricEngine.Mock.On("RecordXMLParserResponseMismatch", testMethodName, true).Return()
return metricEngine
},
Expand Down
11 changes: 5 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module github.com/PubMatic-OpenWrap/prebid-server/v2

go 1.21

replace git.pubmatic.com/vastunwrap => git.pubmatic.com/PubMatic/vastunwrap v0.0.0-20240827084017-0e392d3beb8b
replace git.pubmatic.com/vastunwrap => git.pubmatic.com/PubMatic/vastunwrap v0.0.0-20250123125015-dc60a6d46a6e

require (
github.com/DATA-DOG/go-sqlmock v1.5.0
Expand All @@ -29,14 +29,13 @@ require (
github.com/prebid/go-gdpr v1.12.0
github.com/prebid/go-gpp v0.2.0
github.com/prebid/openrtb/v20 v20.1.0
github.com/prebid/prebid-server/v2 v2.10.0
github.com/prometheus/client_golang v1.12.1
github.com/prometheus/client_model v0.2.0
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475
github.com/rs/cors v1.11.0
github.com/sergi/go-diff v1.3.1 // indirect
github.com/spf13/viper v1.15.0
github.com/stretchr/testify v1.8.4
github.com/stretchr/testify v1.8.1
github.com/vrischmann/go-metrics-influxdb v0.1.1
github.com/xeipuuv/gojsonschema v1.2.0
github.com/yudai/gojsondiff v1.0.0
Expand All @@ -48,12 +47,11 @@ require (
)

require (
git.pubmatic.com/PubMatic/go-common v0.0.0-20240313090142-97ff3d63b7c3
git.pubmatic.com/PubMatic/go-common v0.0.0-20250114170528-cb2fb632c358
git.pubmatic.com/PubMatic/go-netacuity-client v0.0.0-20240104092757-5d6f15e25fe3
git.pubmatic.com/vastunwrap v0.0.0-00010101000000-000000000000
github.com/51Degrees/device-detection-go/v4 v4.4.35
github.com/PubMatic-OpenWrap/fastxml v0.0.0-20241125102315-0d8f851a6e52
github.com/beevik/etree/110 v0.0.0-00010101000000-000000000000 // indirect
github.com/PubMatic-OpenWrap/fastxml v0.0.0-20250123111707-e173d4775632
github.com/diegoholiveira/jsonlogic/v3 v3.5.3
github.com/go-sql-driver/mysql v1.7.1
github.com/golang/mock v1.6.0
Expand All @@ -64,6 +62,7 @@ require (
)

require (
github.com/prebid/prebid-server/v2 v2.0.0-00010101000000-000000000000
github.com/spf13/cast v1.5.0
github.com/tidwall/gjson v1.17.1
github.com/tidwall/sjson v1.2.5
Expand Down
17 changes: 7 additions & 10 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RX
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
git.pubmatic.com/PubMatic/go-common v0.0.0-20240313090142-97ff3d63b7c3 h1:Ea8zwi1eeX4kqvi9RyyXrizIIRcstM0XBwf8U7NHrno=
git.pubmatic.com/PubMatic/go-common v0.0.0-20240313090142-97ff3d63b7c3/go.mod h1:c/I6IcDn4Mtq4mmw8wGJN3v0o10nIMX7VTuQnsalUw0=
git.pubmatic.com/PubMatic/go-common v0.0.0-20250114170528-cb2fb632c358 h1:A+ohfTqsSCfiLybo+tRQ+YXqCPTYiBp0U9lA8gv8MS8=
git.pubmatic.com/PubMatic/go-common v0.0.0-20250114170528-cb2fb632c358/go.mod h1:I6yt+Te6PaQdUW+pq7/LHNWZ6/+5SSlExknAr3Mfv58=
git.pubmatic.com/PubMatic/go-netacuity-client v0.0.0-20240104092757-5d6f15e25fe3 h1:zQUpPJOjTBGu2fIydrfRWphH7EWLlBE/Qgn64BSoccI=
git.pubmatic.com/PubMatic/go-netacuity-client v0.0.0-20240104092757-5d6f15e25fe3/go.mod h1:w733mqJnHt0hLR9mIFMzyDR0D94qzc7mFHsuE0tFQho=
git.pubmatic.com/PubMatic/vastunwrap v0.0.0-20240827084017-0e392d3beb8b h1:7AsXylZJDwq514L8KE0Id079VNfUsDEMUIYMlRYH+0Y=
git.pubmatic.com/PubMatic/vastunwrap v0.0.0-20240827084017-0e392d3beb8b/go.mod h1:kcoJf7k+xug8X8fLWmsiKhPnYP+k7RZkfUoUo5QF+KA=
git.pubmatic.com/PubMatic/vastunwrap v0.0.0-20250123125015-dc60a6d46a6e h1:RjLv6Iah+NSESu8kEsaY+b+CXi7Xh/H5TQv1mdKw88w=
git.pubmatic.com/PubMatic/vastunwrap v0.0.0-20250123125015-dc60a6d46a6e/go.mod h1:6ifXxHCGVlH6hGlaoCKiu5XhGJPkC8qeaeylcvkO9vQ=
github.com/51Degrees/device-detection-go/v4 v4.4.35 h1:qhP2tzoXhGE1aYY3NftMJ+ccxz0+2kM8aF4SH7fTyuA=
github.com/51Degrees/device-detection-go/v4 v4.4.35/go.mod h1:dbdG1fySqdY+a5pUnZ0/G0eD03G6H3Vh8kRC+1f9qSc=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
Expand All @@ -69,8 +69,8 @@ github.com/NYTimes/gziphandler v1.1.1/go.mod h1:n/CVRwUEOgIxrgPvAQhUUr9oeUtvrhMo
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
github.com/PubMatic-OpenWrap/etree v1.0.2-0.20241125102329-0b5c47d99ad5 h1:uNJ9lOn3q677J2PbR9wbnHec8452lHYvUZCfqMUxk0s=
github.com/PubMatic-OpenWrap/etree v1.0.2-0.20241125102329-0b5c47d99ad5/go.mod h1:5Y8qgcuDoy3XXG907UXkGnVTwihF16rXyJa4zRT7hOE=
github.com/PubMatic-OpenWrap/fastxml v0.0.0-20241125102315-0d8f851a6e52 h1:n1pLyiO0A0dUwvYjktIIRd6Kikm//msfvV6JO7m3lIE=
github.com/PubMatic-OpenWrap/fastxml v0.0.0-20241125102315-0d8f851a6e52/go.mod h1:TGGzSA5ziWpfLsKvqOzgdPGEZ7SJIQjHbcJw6lWoyHU=
github.com/PubMatic-OpenWrap/fastxml v0.0.0-20250123111707-e173d4775632 h1:DaeedRNSTsE0PEMJkAQ929vzNgtxR3oLJ09vCAFm2kY=
github.com/PubMatic-OpenWrap/fastxml v0.0.0-20250123111707-e173d4775632/go.mod h1:h3KCtxPGi4/UjwtoWu2Vt07zOxPyLH46za2L74KH0NY=
github.com/PubMatic-OpenWrap/prebid-openrtb/v20 v20.0.0-20240222072752-2d647d1707ef h1:CXsyYtEgZz/0++fiug6QZXrRYG6BBrl9IGveCxsnhiE=
github.com/PubMatic-OpenWrap/prebid-openrtb/v20 v20.0.0-20240222072752-2d647d1707ef/go.mod h1:hLBrA/APkSrxs5MaW639l+y/EAHivDfRagO2TX/wbSc=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
Expand All @@ -91,8 +91,6 @@ github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d/go.mod h1:W
github.com/aws/aws-sdk-go v1.36.29/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro=
github.com/barkimedes/go-deepcopy v0.0.0-20220514131651-17c30cfc62df h1:GSoSVRLoBaFpOOds6QyY1L8AX7uoY+Ln3BHc22W40X0=
github.com/barkimedes/go-deepcopy v0.0.0-20220514131651-17c30cfc62df/go.mod h1:hiVxq5OP2bUGBRNS3Z/bt/reCLFNbdcST6gISi1fiOM=
github.com/beevik/etree v1.1.0 h1:T0xke/WvNtMoCqgzPhkX2r4rjY3GDZFi+FjpRZY2Jbs=
github.com/beevik/etree v1.1.0/go.mod h1:r8Aw8JqVegEf0w2fDnATrX9VpkMcyFeM0FhwO62wh+A=
github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A=
github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
Expand Down Expand Up @@ -505,9 +503,8 @@ github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
github.com/subosito/gotenv v1.4.2 h1:X1TuBLAMDFbaTAChgCBLu3DU3UPyELpnF2jjJ2cz/S8=
github.com/subosito/gotenv v1.4.2/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0=
Expand Down
21 changes: 16 additions & 5 deletions metrics/config/metrics_ow.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ func NewMetricsRegistry() MetricsRegistry {
}
}

// RecordXMLParserResponseTime records execution time for multiple parsers
func (me *MultiMetricsEngine) RecordXMLParserResponseTime(parser string, method string, respTime time.Duration) {
// RecordXMLParserProcessingTime records execution time for multiple parsers
func (me *MultiMetricsEngine) RecordXMLParserProcessingTime(parser string, method string, respTime time.Duration) {
for _, thisME := range *me {
thisME.RecordXMLParserResponseTime(parser, method, respTime)
thisME.RecordXMLParserProcessingTime(parser, method, respTime)
}
}

Expand All @@ -38,6 +38,13 @@ func (me *MultiMetricsEngine) RecordXMLParserResponseMismatch(method string, isM
}
}

// RecordXMLParserResponseTime records execution time for multiple parsers
func (me *MultiMetricsEngine) RecordXMLParserResponseTime(parser string, method string, respTime time.Duration) {
for _, thisME := range *me {
thisME.RecordXMLParserResponseTime(parser, method, respTime)
}
}

func (me *MultiMetricsEngine) RecordVASTTagType(biddder, vastTag string) {
for _, thisME := range *me {
thisME.RecordVASTTagType(biddder, vastTag)
Expand Down Expand Up @@ -122,10 +129,14 @@ func (me *NilMetricsEngine) RecordPanic(hostname, method string) {
func (me *NilMetricsEngine) RecordBadRequest(endpoint string, pubId string, nbr *openrtb3.NoBidReason) {
}

// RecordXMLParserResponseTime records execution time for multiple parsers
func (me *NilMetricsEngine) RecordXMLParserResponseTime(parser string, method string, respTime time.Duration) {
// RecordXMLParserProcessingTime records execution time for multiple parsers
func (me *NilMetricsEngine) RecordXMLParserProcessingTime(parser string, method string, respTime time.Duration) {
}

// RecordXMLParserResponseMismatch as a noop
func (me *NilMetricsEngine) RecordXMLParserResponseMismatch(method string, isMismatch bool) {
}

// RecordXMLParserResponseTime records execution time for multiple parsers
func (me *NilMetricsEngine) RecordXMLParserResponseTime(parser string, method string, respTime time.Duration) {
}
8 changes: 6 additions & 2 deletions metrics/go_metrics_ow.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,14 @@ func (me *Metrics) RecordPanic(hostname, method string) {
func (me *Metrics) RecordBadRequest(endpoint string, pubId string, nbr *openrtb3.NoBidReason) {
}

// RecordXMLParserResponseTime records execution time for multiple parsers
func (me *Metrics) RecordXMLParserResponseTime(parser string, method string, respTime time.Duration) {
// RecordXMLParserProcessingTime records execution time for multiple parsers
func (me *Metrics) RecordXMLParserProcessingTime(parser string, method string, respTime time.Duration) {
}

// RecordXMLParserResponseMismatch as a noop
func (me *Metrics) RecordXMLParserResponseMismatch(method string, isMismatch bool) {
}

// RecordXMLParserResponseTime records execution time for multiple parsers
func (me *Metrics) RecordXMLParserResponseTime(parser string, method string, respTime time.Duration) {
}
Loading
Loading