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

Improved error handling on Beachfront adapter #873

Merged
merged 8 commits into from
May 20, 2019
Merged

Improved error handling on Beachfront adapter #873

merged 8 commits into from
May 20, 2019

Conversation

muncha
Copy link
Contributor

@muncha muncha commented Apr 9, 2019

Checking http statuses, in particular the possibility of a 200 with a empty array which should be treated as an empty response.

Copy link
Collaborator

@hhhjort hhhjort left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -499,6 +527,13 @@ func extractVideoCrid(nurl string) string {
return strings.TrimSuffix(chunky[2], ":")
}

// Thank you, brightroll.
Copy link
Contributor

Choose a reason for hiding this comment

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

Can I ask what's the purpose of this comment? If it's just a leftover of some sort, can we please remove it? Thanks!

Beachfront is now sending an empty array and 200 as their "no results" response. This should catch that.
*/

if response.StatusCode == http.StatusOK && len(response.Body) <= 2 {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason why we can't just check len(response.Body) == 0 rather than len(response.Body) <= 2 ?

@@ -140,15 +142,14 @@ func (a *BeachfrontAdapter) MakeRequests(request *openrtb.BidRequest) ([]*adapte
var beachfrontRequests BeachfrontRequests
var reqJSON []byte
var uri string
var errs = make([]error, 0)
var errs = make([]error, 0, len(request.Imp))
var err error
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure if it's uncommon to have three or more Imps in a given request but, according to the code flow, I believe We'll have at most two Error object elements in this slice, so maybe we are wastiong memory by assigning more than we need whenever we have three or more Imps in a request

if response.StatusCode == http.StatusNoContent {
return nil, nil
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Can we reduce:

409     if response.StatusCode == http.StatusOK && len(response.Body) <= 2 {
410         return nil, nil
411     }
412
413     if response.StatusCode == http.StatusNoContent {
414         return nil, nil
415     }
416

To a single statement?

if (response.StatusCode == http.StatusNoContent) || (response.StatusCode == http.StatusOK && len(response.Body) <= 2) {
      return nil, nil
}

@mansinahar mansinahar merged commit 298baf8 into prebid:master May 20, 2019
mgloystein added a commit to spotx/prebid-server that referenced this pull request Jun 14, 2019
* Use the correct labels for cache performance metric (prebid#904)

* PubMatic Adslot validation (prebid#886)

* testing a few changes to validate adslot, more to follow

* Changed AdSlot to optional parameter, modified validation and test cases for the same

* removed imp id from adslot validation error msgs

* assign banner size

* remove TrimSpace where it is not needed as recommended in the review

* Implementation of Categories Http fetcher (prebid#882)

* Implementation of Categories Http fetcher

-Added code to fetch data using http
-Added previously loaded categories to run http request just at the first time

* Moved common Category struct to stored_request

* Added comments

* Minor refactoring

* Minor refactoring

-Added verification if category exist in map

* Minor refactoring

* Minor refactoring

-strings.Replace changed to strings.TrimSuffix

* Improved error handling on Beachfront adapter (prebid#873)

* Removed a redundant error message that was causing some confusion.

* trying to turn '[]' into null and 200 inti 404

* not a goot path

* looking at the status codes

* I think I have covers all these bases.

* checking for empty array response a failing sanely

* removed an attempt to pointlessly reset the status code.

* corrected and added test cases

* Fix Rubicon bidder for multi-format impression processing (prebid#902)

* Replace Dockerfile Alpine linux with Ubuntu (prebid#885)

* Ubuntu dockerfile works, includes backups and out file

* Ubuntu Dockerfile creates image successfully and prebid-server was tested with a sample request. Seems to work fine

* Ubuntu 18.04 now builds, validates.sh, and curls sample request successfully

* Removed sed command

* [fix] broken Go 1.9 compatibility (prebid#910)

This CL addresses Go 1.9 compatibility issue along with adding back Go
1.9 to travis testing setup to prevent such bugs.

Issue: prebid#895

* Fixed "invalid BidType: " error for lifestreet adapter (prebid#893)

* Fixed "invalid BidType: " error for lifestreet adapter

* After run gofmt

* Used standard bid.ext type to get bid.ext.prebid.type

* [Currency support] Activate multi-currencies support (prebid#894)

This CL is the last piece to activate currency conversion support in
PBS. It activates currency support per default.

Currency rates will be fetched once per hour (PrebidJS file is updated
once a day).

Issue: prebid#280

* ImproveDigital adapter: (prebid#887)

- Add support for video
 - Add support for mobile/app
 - Add support for multibid responses
 - Extend optional parameters

* Add a PI exemption environment variable to PBS (prebid#916)

* Refactored to official name of config item

* Changes suggested by Mansi Nahar

* [Sharethrough] Add new Sharethrough Adapter (prebid#903)

* wip

* wip

* wip

* exploration for sharethrough prebid-server

* WIP: updating sharethrough adapter to latest prebid version

Co-authored-by: Chris Nguyen <cnguyen@sharethrough.com>

* WIP: adding butler params to the request

#164291358

Co-authored-by: Josh Becker <jbecker@sharethrough.com>

* Manage bid sizes

[#164291358]

Co-authored-by: Josh Becker <jbecker@sharethrough.com>

* Manage GDPR

[#164291358]

Co-authored-by: Josh Becker <jbecker@sharethrough.com>

* Populate prebid-server version if provided

[#164291358]

Co-authored-by: Josh Becker <jbecker@sharethrough.com>

* Refactor gdpr data extraction from request

[#164291358]

Co-authored-by: Eddy Pechuzal <epechuzal@sharethrough.com>

* Add instant play capability

[#164291358]

Co-authored-by: Eddy Pechuzal <epechuzal@sharethrough.com>

* Split in multiple files

[#164291358]

Co-authored-by: Eddy Pechuzal <epechuzal@sharethrough.com>

* Add s2s-win beacon
todo? replace server name by server id?

[#164291358]

Co-authored-by: Eddy Pechuzal <epechuzal@sharethrough.com>

* Removing `server` param in s2s-win beacon (will be added in imp req)

[#164291358]

* Clean up code + enable syncer (prebid#4)

[#165257793]

* Proper error handling (prebid#6)

* Proper error handling

[#165745574]

* Address review (baby clean up) + catch error that was missed

[#165745574]

* Implement Unit Tests (prebid#7)

* Proper error handling

[#165745574]

* Address review (baby clean up) + catch error that was missed

[#165745574]

* Implement unit tests for utils

[#165891351]

* Add UT for utils + butler

[#165891351]

Co-authored-by: Michael Duran <mduran@sharethrough.com>

* Attempt for testing Bidder interface function implementations

[#165891351]

Co-authored-by: Michael Duran <mduran@sharethrough.com>

* Finalizing Unit tests

[#165891351]

Co-authored-by: Chris Nguyen <cnguyen@sharethrough.com>
Co-authored-by: Josh Becker <jbecker@sharethrough.com>

* Fixing sharethrough.yaml capabilities

[#165891351]

Co-authored-by: Josh Becker <jbecker@sharethrough.com>

* Send supplyId to imp req instead of hbSource (prebid#5)

[#165477915]

* Finalize PR (prebid#8)

[#164911891]

Co-authored-by: Josh Becker <jbecker@sharethrough.com>

* Remove test setting

* Add Sharethrough in syncer_test

* Update deserializing of third party partners

* Refactor/optimize UserAgent parsing (prebid#9)

following josephveach's review in prebid#903

* Addressing June 3rd review from prebid#903

Optimizations, clean up suggested by @mansinahar

* Addressing June 4th review from prebid#903 (prebid#10)

* Addressing June 4th review from prebid#903

Clean up canAutoPlayVideo + hardcode bhVersion to unknown for now...

* Removing hbVersion butler param since it's not accessible

* Fix adMarkup error handling

* [Mgid] Add new Mgid Adapter (prebid#907)

* new mgid adapter

* increase coverage

* remove extra imports

* Cache validation fix (prebid#911)

* Cache validation fix

if no bids returned - don't throw cache error, just return empty result

* Cache validation fix

- optimization: do not run auction logic if no bids returned

* Cache validation fix: minor refactoring

* Cache validation fix: minor refactoring

* Cache validation fix: added unit test for no bids returned

* Cache validation fix: minor refactoring

* Remove hard coded targeting keys (prebid#923)
@muncha
Copy link
Contributor Author

muncha commented Aug 22, 2019

@guscarreon thanks for all that. I'll be putting in an "improvements" PR shortly.

katsuo5 pushed a commit to flux-dev-team/prebid-server-1 that referenced this pull request Dec 1, 2020
* Removed a redundant error message that was causing some confusion.

* trying to turn '[]' into null and 200 inti 404

* not a goot path

* looking at the status codes

* I think I have covers all these bases.

* checking for empty array response a failing sanely

* removed an attempt to pointlessly reset the status code.

* corrected and added test cases
katsuo5 pushed a commit to flux-dev-team/prebid-server-1 that referenced this pull request Dec 2, 2020
* Removed a redundant error message that was causing some confusion.

* trying to turn '[]' into null and 200 inti 404

* not a goot path

* looking at the status codes

* I think I have covers all these bases.

* checking for empty array response a failing sanely

* removed an attempt to pointlessly reset the status code.

* corrected and added test cases
katsuo5 pushed a commit to flux-dev-team/prebid-server-1 that referenced this pull request Dec 4, 2020
* Removed a redundant error message that was causing some confusion.

* trying to turn '[]' into null and 200 inti 404

* not a goot path

* looking at the status codes

* I think I have covers all these bases.

* checking for empty array response a failing sanely

* removed an attempt to pointlessly reset the status code.

* corrected and added test cases
@muncha muncha deleted the erroneous_error branch December 29, 2020 17:27
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.

5 participants