Skip to content

Conversation

SyntaxNode
Copy link
Contributor

No description provided.

@@ -433,7 +433,7 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter, server co
return bidder, nil
}

func (a *adapter) MakeTimeoutNotification(req *adapters.RequestData) (*adapters.RequestData, []error) {
func (a *adapter) MakeTimeoutNotification(req *adapters.RequestData) (*adapters.RequestData, error) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not directly related. Updated the function signature since only a single error is used.

Copy link

Code coverage summary

Note:

  • Prebid team doesn't anticipate tests covering code paths that might result in marshal and unmarshal errors
  • Coverage summary encompasses all commits leading up to the latest one, 2f114c1

audienceNetwork

Refer here for heat map coverage report

github.com/prebid/prebid-server/v3/adapters/audienceNetwork/facebook.go:45:	MakeRequests			100.0%
github.com/prebid/prebid-server/v3/adapters/audienceNetwork/facebook.go:67:	buildRequests			76.9%
github.com/prebid/prebid-server/v3/adapters/audienceNetwork/facebook.go:121:	makeAuthID			100.0%
github.com/prebid/prebid-server/v3/adapters/audienceNetwork/facebook.go:128:	modifyRequest			89.5%
github.com/prebid/prebid-server/v3/adapters/audienceNetwork/facebook.go:169:	modifyImp			100.0%
github.com/prebid/prebid-server/v3/adapters/audienceNetwork/facebook.go:217:	extractPlacementAndPublisher	85.0%
github.com/prebid/prebid-server/v3/adapters/audienceNetwork/facebook.go:268:	modifyImpCustom			75.9%
github.com/prebid/prebid-server/v3/adapters/audienceNetwork/facebook.go:328:	MakeBids			96.3%
github.com/prebid/prebid-server/v3/adapters/audienceNetwork/facebook.go:387:	resolveBidType			75.0%
github.com/prebid/prebid-server/v3/adapters/audienceNetwork/facebook.go:397:	resolveImpType			77.8%
github.com/prebid/prebid-server/v3/adapters/audienceNetwork/facebook.go:419:	Builder				100.0%
github.com/prebid/prebid-server/v3/adapters/audienceNetwork/facebook.go:436:	MakeTimeoutNotification		90.0%
total:										(statements)			87.5%

defer func() {
if _, err := io.Copy(io.Discard, resp.Body); err != nil {
glog.Errorf("[agmaAnalytics] Draining response body failed: %v", err)
}
Copy link
Contributor Author

@SyntaxNode SyntaxNode Aug 19, 2025

Choose a reason for hiding this comment

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

The response body must be fully read and closed to ensure connection reuse. Discarding the body is especially needed when the body content is ignored / not used.

@@ -238,13 +238,13 @@ func (f *PriceFloorFetcher) fetchAndValidate(config config.AccountFloorFetch) (*
}

if len(floorResp) > (config.MaxFileSizeKB * 1024) {
glog.Errorf("Recieved invalid floor data from URL: %s, reason : floor file size is greater than MaxFileSize", config.URL)
glog.Errorf("Received invalid floor data from URL: %s, reason : floor file size is greater than MaxFileSize", config.URL)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unrelated typo spotted while editing this file.

Copy link

Code coverage summary

Note:

  • Prebid team doesn't anticipate tests covering code paths that might result in marshal and unmarshal errors
  • Coverage summary encompasses all commits leading up to the latest one, 5d01bb2

audienceNetwork

Refer here for heat map coverage report

github.com/prebid/prebid-server/v3/adapters/audienceNetwork/facebook.go:45:	MakeRequests			100.0%
github.com/prebid/prebid-server/v3/adapters/audienceNetwork/facebook.go:67:	buildRequests			76.9%
github.com/prebid/prebid-server/v3/adapters/audienceNetwork/facebook.go:121:	makeAuthID			100.0%
github.com/prebid/prebid-server/v3/adapters/audienceNetwork/facebook.go:128:	modifyRequest			89.5%
github.com/prebid/prebid-server/v3/adapters/audienceNetwork/facebook.go:169:	modifyImp			100.0%
github.com/prebid/prebid-server/v3/adapters/audienceNetwork/facebook.go:217:	extractPlacementAndPublisher	85.0%
github.com/prebid/prebid-server/v3/adapters/audienceNetwork/facebook.go:268:	modifyImpCustom			75.9%
github.com/prebid/prebid-server/v3/adapters/audienceNetwork/facebook.go:328:	MakeBids			96.3%
github.com/prebid/prebid-server/v3/adapters/audienceNetwork/facebook.go:387:	resolveBidType			75.0%
github.com/prebid/prebid-server/v3/adapters/audienceNetwork/facebook.go:397:	resolveImpType			77.8%
github.com/prebid/prebid-server/v3/adapters/audienceNetwork/facebook.go:419:	Builder				100.0%
github.com/prebid/prebid-server/v3/adapters/audienceNetwork/facebook.go:436:	MakeTimeoutNotification		90.0%
total:										(statements)			87.5%

"net/http"
"net/url"
"time"

"github.com/docker/go-units"
"github.com/golang/glog"
)

func fetchConfig(client *http.Client, endpoint *url.URL) (*Configuration, error) {
res, err := client.Get(endpoint.String())
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we want to add a timeout to this fetch while we are here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree we should. I don't know the pubstack analytics module well enough to implement it. Will reach out to pubstack to implement.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Discussed offline. I will reach out to pubstack to see what a reasonable timeout would be and we can update it in another PR.

@@ -27,7 +28,12 @@ func NewHttpSender(client *http.Client, endpoint string) Sender {
if err != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we want to add a timeout just above to the http request?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree we should. I don't know the pubstack analytics module well enough to implement it. Will reach out to pubstack to implement.

@@ -52,14 +52,20 @@ func (rc *RateConverter) fetch() (*Rates, error) {
if err != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we want to add a timeout to the http request just above?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. Good catch. I added a configurable timeout with a default of 60 seconds. In test from my machine, latency is around 30ms. Since this isn't part of the real time auction flow, happy to set this to a higher limit considering there is no limit today. Hosts can reduce if they find it necessary or we can revisit the default later if there are no concerns right now.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Discussed offline. We can address this in a follow-up PR.

@hhhjort
Copy link
Collaborator

hhhjort commented Aug 19, 2025

Looks good other than optionally adding timeouts to the calls that have no timeout context.

if _, err := io.Copy(io.Discard, httpResp.Body); err != nil {
glog.Errorf("Error while draining fetched floor response body: %v", err)
}
httpResp.Body.Close()
Copy link
Contributor

Choose a reason for hiding this comment

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

Is Body.Close() neccessary? We do call Close() on this body in unpackResponse()s caller function FetchRequests(...)

80   func (fetcher *HttpFetcher) FetchRequests(ctx context.Context, requestIDs []string, impIDs []string) (requestData map[string]json.RawMessage, impData map[string]json.RawMessage, errs []error) {
81 *--  8 lines: if len(requestIDs) == 0 && len(impIDs) == 0 {---------------------------------------------------------------------------------------------------------
89  
90       httpResp, err := ctxhttp.Do(ctx, fetcher.client, httpReq)
91       if err != nil {
92           return nil, nil, []error{err}
93       }
94       defer httpResp.Body.Close()
95       requestData, impData, errs = unpackResponse(httpResp)
96       return
97   }
stored_requests/backends/http_fetcher/fetcher.go

Do we get a panic for calling Close() twice?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure I follow. unpackResponse does not close the body.

Copy link
Contributor

@guscarreon guscarreon Aug 19, 2025

Choose a reason for hiding this comment

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

Line 94 inside FetchRequests(...) defers the call to httpResp.Body.Close(). Is it ok if unpackResponse(httpResp) calls httpResp.Body.Close() and we do another httpResp.Body.Close() before FetchRequests(...) goes out of scope?

Copy link
Contributor

Choose a reason for hiding this comment

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

I got this one wrong @SyntaxNode. Nevermind

Copy link

Code coverage summary

Note:

  • Prebid team doesn't anticipate tests covering code paths that might result in marshal and unmarshal errors
  • Coverage summary encompasses all commits leading up to the latest one, 618b307

audienceNetwork

Refer here for heat map coverage report

github.com/prebid/prebid-server/v3/adapters/audienceNetwork/facebook.go:45:	MakeRequests			100.0%
github.com/prebid/prebid-server/v3/adapters/audienceNetwork/facebook.go:67:	buildRequests			76.9%
github.com/prebid/prebid-server/v3/adapters/audienceNetwork/facebook.go:121:	makeAuthID			100.0%
github.com/prebid/prebid-server/v3/adapters/audienceNetwork/facebook.go:128:	modifyRequest			89.5%
github.com/prebid/prebid-server/v3/adapters/audienceNetwork/facebook.go:169:	modifyImp			100.0%
github.com/prebid/prebid-server/v3/adapters/audienceNetwork/facebook.go:217:	extractPlacementAndPublisher	85.0%
github.com/prebid/prebid-server/v3/adapters/audienceNetwork/facebook.go:268:	modifyImpCustom			75.9%
github.com/prebid/prebid-server/v3/adapters/audienceNetwork/facebook.go:328:	MakeBids			96.3%
github.com/prebid/prebid-server/v3/adapters/audienceNetwork/facebook.go:387:	resolveBidType			75.0%
github.com/prebid/prebid-server/v3/adapters/audienceNetwork/facebook.go:397:	resolveImpType			77.8%
github.com/prebid/prebid-server/v3/adapters/audienceNetwork/facebook.go:419:	Builder				100.0%
github.com/prebid/prebid-server/v3/adapters/audienceNetwork/facebook.go:436:	MakeTimeoutNotification		90.0%
total:										(statements)			87.5%

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

@bsardo bsardo merged commit 4e44ab4 into prebid:master Aug 19, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants