Skip to content

Commit

Permalink
Update ci with latest master (prebid#494)
Browse files Browse the repository at this point in the history
* OTT-1058: record number of deal responses for given pub-prof-partner (prebid#485) (prebid#487)

Co-authored-by: Pubmatic-Dhruv-Sonone <[email protected]>

* OTT-1060: Added IncDealBidCount in stats server for selected publishe… (prebid#491)

---------

Co-authored-by: ashishshinde-pubm <[email protected]>
Co-authored-by: Pubmatic-Dhruv-Sonone <[email protected]>
Co-authored-by: ShriprasadM <[email protected]>
  • Loading branch information
4 people authored May 29, 2023
1 parent 42448de commit 9bd3c1a
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 1 deletion.
4 changes: 3 additions & 1 deletion exchange/bidder.go
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,9 @@ func (bidder *bidderAdapter) requestBid(ctx context.Context, bidderRequest Bidde
}
} else {
errs = append(errs, httpInfo.err)
if errortypes.ReadCode(httpInfo.err) == errortypes.TimeoutErrorCode {
recordPartnerTimeout(ctx, bidderRequest.BidderLabels.PubID, bidder.BidderName.String())
}
}
}

Expand Down Expand Up @@ -562,7 +565,6 @@ func (bidder *bidderAdapter) doRequestImpl(ctx context.Context, req *adapters.Re
// a loop of trying to report timeouts to the timeout notifications.
go bidder.doTimeoutNotification(tb, req, logger)
}

}
return &httpCallInfo{
request: req,
Expand Down
11 changes: 11 additions & 0 deletions exchange/exchange_ow.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/prebid/prebid-server/analytics"
"github.com/prebid/prebid-server/exchange/entities"
"github.com/prebid/prebid-server/metrics"
pubmaticstats "github.com/prebid/prebid-server/metrics/pubmatic_stats"
"github.com/prebid/prebid-server/openrtb_ext"
"golang.org/x/net/publicsuffix"
)
Expand Down Expand Up @@ -176,9 +177,19 @@ func recordBids(ctx context.Context, metricsEngine metrics.MetricsEngine, pubID
deal = nodeal
}
metricsEngine.RecordBids(pubID, profileID, seatBid.Seat, deal)
pubmaticstats.IncBidResponseByDealCountInPBS(pubID, profileID, seatBid.Seat, deal)
}
}
}
}

}

// recordPartnerTimeout captures the partnertimeout if any at publisher profile level
func recordPartnerTimeout(ctx context.Context, pubID, aliasBidder string) {
if metricEnabled, ok := ctx.Value(bidCountMetricEnabled).(bool); metricEnabled && ok {
if profileID, ok := ctx.Value(owProfileId).(string); ok && profileID != "" {
pubmaticstats.IncPartnerTimeoutInPBS(pubID, profileID, aliasBidder)
}
}
}
11 changes: 11 additions & 0 deletions metrics/pubmatic_stats/stats.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package pubmaticstats

// IncBidResponseByDealCountInPBS counts number of bids received from aliasBidder for
// publisher, profile
// if dealid is not present then value would be'nodeal'
var IncBidResponseByDealCountInPBS = func(publisher, profile, aliasBidder, dealId string) {
}

// IncPartnerTimeoutInPBS counts partner timeouts fro given publisher, profile and aliasbidder
var IncPartnerTimeoutInPBS = func(publisher, profile, aliasBidder string) {
}
11 changes: 11 additions & 0 deletions metrics/pubmatic_stats/stats_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package pubmaticstats

import "testing"

func TestIncBidResponseByDealCountInPBS(t *testing.T) {
IncBidResponseByDealCountInPBS("some_publisher_id", "some_profile_id", "some_alias_bidder", "some_dealid")
}

func TestIncPartnerTimeoutInPBS(t *testing.T) {
IncPartnerTimeoutInPBS("some_publisher_id", "some_profile_id", "some_alias_bidder")
}

0 comments on commit 9bd3c1a

Please sign in to comment.