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

Adds timeout notifications for Facebook #1182

Merged
merged 6 commits into from
Feb 10, 2020
Merged

Adds timeout notifications for Facebook #1182

merged 6 commits into from
Feb 10, 2020

Conversation

hhhjort
Copy link
Collaborator

@hhhjort hhhjort commented Jan 31, 2020

No description provided.

Copy link
Contributor

@SyntaxNode SyntaxNode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Glad to see this doesn't require too many changes. Do you think we should add metrics around the number of callbacks going back to Facebook?


timeoutReq := adapters.RequestData{
Method: "GET",
Uri: fmt.Sprintf("https://www.facebook.com/audiencenetwork/nurl/?partner=%s&app=%s&auction=%s&ortb_loss_code=2", fa.platformID, fa.platformID, auction_id),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider moving the uri construction up a level. IMHO the extra indentation doesn't make the string substitutions any easier to see.

@@ -39,6 +39,20 @@ type Bidder interface {
MakeBids(internalRequest *openrtb.BidRequest, externalRequest *RequestData, response *ResponseData) (*BidderResponse, []error)
}

// TimeoutBidder is used to identify bidders that support timeout notifications.
type TimeoutBidder interface {
MakeRequests(request *openrtb.BidRequest, reqInfo *ExtraRequestInfo) ([]*RequestData, []error)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are the standard bidder methods duplicated here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not 100% sure it is needed, but it does make clear that it is a bidder rather than some other random thing, and can still be used for bidder things.

@hhhjort
Copy link
Collaborator Author

hhhjort commented Feb 5, 2020

We can only generate one timeout notification per timeout, and we already have metrics on timeout, so I don't see the need for an additional metric for explicit notifications

Copy link
Contributor

@guscarreon guscarreon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of questions before approving.

httpReq.Header = req.Headers
httpResp, _ := ctxhttp.Do(ctx, bidder.Client, httpReq)
// No validation yet on sending notifications
_ = httpResp
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we doing this assighnment? Is the compiler complaining about the variable being declared and not used? If that's the case, should we create it in the first place? What if we just leave it blank?

341		httpReq.Header = req.Headers
342	 -     httpResp, _ := ctxhttp.Do(ctx, bidder.Client, httpReq)
         +     _, _ := ctxhttp.Do(ctx, bidder.Client, httpReq)
343	 -     // No validation yet on sending notifications
344	 -     _ = httpResp

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that is probably best. I had pondered doing something with the response, but then decided against it.

guscarreon
guscarreon previously approved these changes Feb 6, 2020
Copy link
Contributor

@guscarreon guscarreon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM


func TestMakeTimeoutNotice(t *testing.T) {
req := adapters.RequestData{
Body: []byte(`{"imp":[{"id":"1234"}]}}`),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we also add another test case for an invalid json in this test?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Contributor

@guscarreon guscarreon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. My previews review was dismissed

@SyntaxNode SyntaxNode deleted the timeout-notice branch March 13, 2023 13:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants