diff --git a/endpoints/auction.go b/endpoints/auction.go index 0be772975a9..82726b1c30a 100644 --- a/endpoints/auction.go +++ b/endpoints/auction.go @@ -12,7 +12,6 @@ import ( "github.com/golang/glog" "github.com/julienschmidt/httprouter" - "github.com/mssola/user_agent" "github.com/prebid/prebid-server/adapters" "github.com/prebid/prebid-server/cache" "github.com/prebid/prebid-server/config" @@ -122,7 +121,6 @@ func (a *auction) auction(w http.ResponseWriter, r *http.Request, _ httprouter.P RType: labels.RType, Adapter: getAdapterValue(bidder), PubID: labels.PubID, - Browser: labels.Browser, CookieFlag: labels.CookieFlag, AdapterBids: pbsmetrics.AdapterBidPresent, } @@ -365,22 +363,13 @@ func sortBidsAddKeywordsMobile(bids pbs.PBSBidSlice, pbs_req *pbs.PBSRequest, pr } func getDefaultLabels(r *http.Request) pbsmetrics.Labels { - rlabels := pbsmetrics.Labels{ + return pbsmetrics.Labels{ Source: pbsmetrics.DemandUnknown, RType: pbsmetrics.ReqTypeLegacy, PubID: "", - Browser: pbsmetrics.BrowserOther, CookieFlag: pbsmetrics.CookieFlagUnknown, RequestStatus: pbsmetrics.RequestStatusOK, } - - if ua := user_agent.New(r.Header.Get("User-Agent")); ua != nil { - name, _ := ua.Browser() - if name == "Safari" { - rlabels.Browser = pbsmetrics.BrowserSafari - } - } - return rlabels } func setLabelSource(labels *pbsmetrics.Labels, req *pbs.PBSRequest, status *string) { diff --git a/endpoints/openrtb2/amp_auction.go b/endpoints/openrtb2/amp_auction.go index d82acf9cb95..902af46421b 100644 --- a/endpoints/openrtb2/amp_auction.go +++ b/endpoints/openrtb2/amp_auction.go @@ -107,7 +107,6 @@ func (deps *endpointDeps) AmpAuction(w http.ResponseWriter, r *http.Request, _ h Source: pbsmetrics.DemandWeb, RType: pbsmetrics.ReqTypeAMP, PubID: pbsmetrics.PublisherUnknown, - Browser: getBrowserName(r), CookieFlag: pbsmetrics.CookieFlagUnknown, RequestStatus: pbsmetrics.RequestStatusOK, } diff --git a/endpoints/openrtb2/auction.go b/endpoints/openrtb2/auction.go index ee4f5d1dd4a..0eab528401a 100644 --- a/endpoints/openrtb2/auction.go +++ b/endpoints/openrtb2/auction.go @@ -18,7 +18,6 @@ import ( "github.com/gofrs/uuid" "github.com/golang/glog" "github.com/julienschmidt/httprouter" - "github.com/mssola/user_agent" "github.com/mxmCherry/openrtb" "github.com/mxmCherry/openrtb/native" nativeRequests "github.com/mxmCherry/openrtb/native/request" @@ -115,7 +114,6 @@ func (deps *endpointDeps) Auction(w http.ResponseWriter, r *http.Request, _ http Source: pbsmetrics.DemandUnknown, RType: pbsmetrics.ReqTypeORTB2Web, PubID: pbsmetrics.PublisherUnknown, - Browser: getBrowserName(r), CookieFlag: pbsmetrics.CookieFlagUnknown, RequestStatus: pbsmetrics.RequestStatusOK, } @@ -1271,20 +1269,6 @@ func parseUserID(cfg *config.Configuration, httpReq *http.Request) (string, bool } } -// getBrowserName checks if a request comes from a Safari browser. -// Returns pbsmetrics.BrowserSafari or pbsmetrics.BrowserOther -// depending on the value of the "User-Agent" header of our http.Request -func getBrowserName(r *http.Request) pbsmetrics.Browser { - var browser pbsmetrics.Browser = pbsmetrics.BrowserOther - if ua := user_agent.New(r.Header.Get("User-Agent")); ua != nil { - name, _ := ua.Browser() - if name == "Safari" { - browser = pbsmetrics.BrowserSafari - } - } - return browser -} - // Write(return) errors to the client, if any. Returns true if errors were found. func writeError(errs []error, w http.ResponseWriter, labels *pbsmetrics.Labels) bool { var rc bool = false diff --git a/endpoints/openrtb2/video_auction.go b/endpoints/openrtb2/video_auction.go index 29866677628..b3cec4f011b 100644 --- a/endpoints/openrtb2/video_auction.go +++ b/endpoints/openrtb2/video_auction.go @@ -105,7 +105,6 @@ func (deps *endpointDeps) VideoAuctionEndpoint(w http.ResponseWriter, r *http.Re Source: pbsmetrics.DemandUnknown, RType: pbsmetrics.ReqTypeVideo, PubID: pbsmetrics.PublisherUnknown, - Browser: getBrowserName(r), CookieFlag: pbsmetrics.CookieFlagUnknown, RequestStatus: pbsmetrics.RequestStatusOK, } diff --git a/endpoints/openrtb2/video_auction_test.go b/endpoints/openrtb2/video_auction_test.go index 2b6c478e7ff..f612528622d 100644 --- a/endpoints/openrtb2/video_auction_test.go +++ b/endpoints/openrtb2/video_auction_test.go @@ -856,7 +856,6 @@ func TestHandleError(t *testing.T) { Source: pbsmetrics.DemandUnknown, RType: pbsmetrics.ReqTypeVideo, PubID: pbsmetrics.PublisherUnknown, - Browser: "test browser", CookieFlag: pbsmetrics.CookieFlagUnknown, RequestStatus: pbsmetrics.RequestStatusOK, } @@ -1028,7 +1027,6 @@ func TestHandleErrorDebugLog(t *testing.T) { Source: pbsmetrics.DemandUnknown, RType: pbsmetrics.ReqTypeVideo, PubID: pbsmetrics.PublisherUnknown, - Browser: "test browser", CookieFlag: pbsmetrics.CookieFlagUnknown, RequestStatus: pbsmetrics.RequestStatusOK, } diff --git a/exchange/exchange_test.go b/exchange/exchange_test.go index 73fb170b2d3..bf973a26773 100644 --- a/exchange/exchange_test.go +++ b/exchange/exchange_test.go @@ -1140,7 +1140,6 @@ func TestPanicRecovery(t *testing.T) { RType: pbsmetrics.ReqTypeORTB2Web, Adapter: openrtb_ext.BidderAppnexus, PubID: "test1", - Browser: pbsmetrics.BrowserSafari, CookieFlag: pbsmetrics.CookieFlagYes, AdapterBids: pbsmetrics.AdapterBidNone, } diff --git a/exchange/utils.go b/exchange/utils.go index 6ae18a27d8f..edbc4e87901 100644 --- a/exchange/utils.go +++ b/exchange/utils.go @@ -211,7 +211,6 @@ func splitBidRequest(req *openrtb.BidRequest, RType: labels.RType, Adapter: coreBidder, PubID: labels.PubID, - Browser: labels.Browser, CookieFlag: labels.CookieFlag, AdapterBids: pbsmetrics.AdapterBidPresent, } diff --git a/pbsmetrics/config/metrics_test.go b/pbsmetrics/config/metrics_test.go index c95a7827ebb..d81345c4da4 100644 --- a/pbsmetrics/config/metrics_test.go +++ b/pbsmetrics/config/metrics_test.go @@ -47,7 +47,6 @@ func TestMultiMetricsEngine(t *testing.T) { Source: pbsmetrics.DemandWeb, RType: pbsmetrics.ReqTypeORTB2Web, PubID: "test1", - Browser: pbsmetrics.BrowserSafari, CookieFlag: pbsmetrics.CookieFlagYes, RequestStatus: pbsmetrics.RequestStatusOK, } @@ -56,7 +55,6 @@ func TestMultiMetricsEngine(t *testing.T) { RType: pbsmetrics.ReqTypeORTB2Web, Adapter: openrtb_ext.BidderAppnexus, PubID: "test1", - Browser: pbsmetrics.BrowserSafari, CookieFlag: pbsmetrics.CookieFlagYes, AdapterBids: pbsmetrics.AdapterBidNone, } @@ -65,7 +63,6 @@ func TestMultiMetricsEngine(t *testing.T) { RType: pbsmetrics.ReqTypeORTB2Web, Adapter: openrtb_ext.BidderPubmatic, PubID: "test1", - Browser: pbsmetrics.BrowserSafari, CookieFlag: pbsmetrics.CookieFlagYes, AdapterBids: pbsmetrics.AdapterBidPresent, } @@ -92,7 +89,6 @@ func TestMultiMetricsEngine(t *testing.T) { Source: pbsmetrics.DemandWeb, RType: pbsmetrics.ReqTypeAMP, PubID: "test2", - Browser: pbsmetrics.BrowserOther, CookieFlag: pbsmetrics.CookieFlagYes, RequestStatus: pbsmetrics.RequestStatusBlacklisted, }, @@ -100,7 +96,6 @@ func TestMultiMetricsEngine(t *testing.T) { Source: pbsmetrics.DemandWeb, RType: pbsmetrics.ReqTypeVideo, PubID: "test2", - Browser: pbsmetrics.BrowserOther, CookieFlag: pbsmetrics.CookieFlagYes, RequestStatus: pbsmetrics.RequestStatusBlacklisted, }, @@ -149,8 +144,6 @@ func TestMultiMetricsEngine(t *testing.T) { VerifyMetrics(t, "ImpMeter", goEngine.ImpMeter.Count(), 8) VerifyMetrics(t, "LegacyImpMeter", goEngine.LegacyImpMeter.Count(), 10) VerifyMetrics(t, "NoCookieMeter", goEngine.NoCookieMeter.Count(), 0) - VerifyMetrics(t, "SafariRequestMeter", goEngine.SafariRequestMeter.Count(), 5) - VerifyMetrics(t, "SafariNoCookieMeter", goEngine.SafariNoCookieMeter.Count(), 0) VerifyMetrics(t, "AdapterMetrics.Pubmatic.GotBidsMeter", goEngine.AdapterMetrics[openrtb_ext.BidderPubmatic].GotBidsMeter.Count(), 5) VerifyMetrics(t, "AdapterMetrics.Pubmatic.NoBidMeter", goEngine.AdapterMetrics[openrtb_ext.BidderPubmatic].NoBidMeter.Count(), 0) for _, err := range pbsmetrics.AdapterErrors() { diff --git a/pbsmetrics/go_metrics.go b/pbsmetrics/go_metrics.go index f3c6c1d2818..180b12295c6 100644 --- a/pbsmetrics/go_metrics.go +++ b/pbsmetrics/go_metrics.go @@ -21,8 +21,6 @@ type Metrics struct { LegacyImpMeter metrics.Meter AppRequestMeter metrics.Meter NoCookieMeter metrics.Meter - SafariRequestMeter metrics.Meter - SafariNoCookieMeter metrics.Meter RequestTimer metrics.Timer RequestsQueueTimer map[RequestType]map[bool]metrics.Timer PrebidCacheRequestTimerSuccess metrics.Timer @@ -127,8 +125,6 @@ func NewBlankMetrics(registry metrics.Registry, exchanges []openrtb_ext.BidderNa LegacyImpMeter: blankMeter, AppRequestMeter: blankMeter, NoCookieMeter: blankMeter, - SafariRequestMeter: blankMeter, - SafariNoCookieMeter: blankMeter, RequestTimer: blankTimer, DNSLookupTimer: blankTimer, RequestsQueueTimer: make(map[RequestType]map[bool]metrics.Timer), @@ -227,10 +223,8 @@ func NewMetrics(registry metrics.Registry, exchanges []openrtb_ext.BidderName, d newMetrics.ImpsTypeAudio = metrics.GetOrRegisterMeter("imp_audio", registry) newMetrics.ImpsTypeNative = metrics.GetOrRegisterMeter("imp_native", registry) - newMetrics.SafariRequestMeter = metrics.GetOrRegisterMeter("safari_requests", registry) newMetrics.NoCookieMeter = metrics.GetOrRegisterMeter("no_cookie_requests", registry) newMetrics.AppRequestMeter = metrics.GetOrRegisterMeter("app_requests", registry) - newMetrics.SafariNoCookieMeter = metrics.GetOrRegisterMeter("safari_no_cookie_requests", registry) newMetrics.RequestTimer = metrics.GetOrRegisterTimer("request_time", registry) newMetrics.DNSLookupTimer = metrics.GetOrRegisterTimer("dns_lookup_time", registry) newMetrics.PrebidCacheRequestTimerSuccess = metrics.GetOrRegisterTimer("prebid_cache_request_time.ok", registry) @@ -410,12 +404,6 @@ func (me *Metrics) RecordRequest(labels Labels) { if labels.Source == DemandApp { me.AppRequestMeter.Mark(1) } else { - if labels.Browser == BrowserSafari { - me.SafariRequestMeter.Mark(1) - if labels.CookieFlag == CookieFlagNo { - me.SafariNoCookieMeter.Mark(1) - } - } if labels.CookieFlag == CookieFlagNo { // NOTE: Old behavior was log me.AMPNoCookieMeter here for AMP requests. // AMP is still new and OpenRTB does not do this, so changing to match diff --git a/pbsmetrics/go_metrics_test.go b/pbsmetrics/go_metrics_test.go index 0a763750d68..f4d62c46c12 100644 --- a/pbsmetrics/go_metrics_test.go +++ b/pbsmetrics/go_metrics_test.go @@ -16,8 +16,6 @@ func TestNewMetrics(t *testing.T) { ensureContains(t, registry, "app_requests", m.AppRequestMeter) ensureContains(t, registry, "no_cookie_requests", m.NoCookieMeter) - ensureContains(t, registry, "safari_requests", m.SafariRequestMeter) - ensureContains(t, registry, "safari_no_cookie_requests", m.SafariNoCookieMeter) ensureContains(t, registry, "request_time", m.RequestTimer) ensureContains(t, registry, "amp_no_cookie_requests", m.AmpNoCookieMeter) ensureContainsAdapterMetrics(t, registry, "adapter.appnexus", m.AdapterMetrics["appnexus"]) diff --git a/pbsmetrics/metrics.go b/pbsmetrics/metrics.go index 13e937e35c7..95fa13cc192 100644 --- a/pbsmetrics/metrics.go +++ b/pbsmetrics/metrics.go @@ -11,7 +11,6 @@ type Labels struct { Source DemandSource RType RequestType PubID string // exchange specific ID, so we cannot compile in values - Browser Browser CookieFlag CookieFlag RequestStatus RequestStatus } @@ -22,7 +21,6 @@ type AdapterLabels struct { RType RequestType Adapter openrtb_ext.BidderName PubID string // exchange specific ID, so we cannot compile in values - Browser Browser CookieFlag CookieFlag AdapterBids AdapterBid AdapterErrors map[AdapterError]struct{} @@ -116,9 +114,6 @@ type ImpMediaType string // RequestType : Request type enumeration type RequestType string -// Browser type enumeration -type Browser string - // CookieFlag : User ID cookie exists flag type CookieFlag string @@ -188,19 +183,6 @@ func ImpTypes() []ImpMediaType { } } -// Browser flag; at this point we only care about identifying Safari -const ( - BrowserSafari Browser = "safari" - BrowserOther Browser = "other" -) - -func BrowserTypes() []Browser { - return []Browser{ - BrowserSafari, - BrowserOther, - } -} - // Cookie flag const ( CookieFlagYes CookieFlag = "exists"