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

Flipp + Alkimi: Minor Refactoring #3622

Merged
merged 1 commit into from
Apr 30, 2024

Conversation

SyntaxNode
Copy link
Contributor

@SyntaxNode SyntaxNode commented Apr 10, 2024

I was reviewing the code to see if any new adapters needed to have ImpIDs added. We're all good though, thanks very much to @pmsaurabh-narkhede.

It was harder for me to quickly see the ImpIDs implementation for Flipp + Alkimi, so I'm proposing a minor refactor to make it easier. Also noticed some policy violations in Flipp and are correcting them here.

Flipp: @hasan-kanjee
Alkimi: @kalidas-alkimi

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, c8aa744

alkimi

Refer here for heat map coverage report

github.com/prebid/prebid-server/v2/adapters/alkimi/alkimi.go:31:	Builder			100.0%
github.com/prebid/prebid-server/v2/adapters/alkimi/alkimi.go:44:	MakeRequests		81.8%
github.com/prebid/prebid-server/v2/adapters/alkimi/alkimi.go:63:	updateImps		78.6%
github.com/prebid/prebid-server/v2/adapters/alkimi/alkimi.go:109:	buildBidderRequest	100.0%
github.com/prebid/prebid-server/v2/adapters/alkimi/alkimi.go:125:	MakeBids		96.2%
github.com/prebid/prebid-server/v2/adapters/alkimi/alkimi.go:171:	resolveMacros		100.0%
github.com/prebid/prebid-server/v2/adapters/alkimi/alkimi.go:177:	getMediaTypeForImp	100.0%
total:									(statements)		89.7%

flipp

Refer here for heat map coverage report

github.com/prebid/prebid-server/v2/adapters/flipp/flipp.go:45:	Builder			100.0%
github.com/prebid/prebid-server/v2/adapters/flipp/flipp.go:53:	MakeRequests		100.0%
github.com/prebid/prebid-server/v2/adapters/flipp/flipp.go:71:	makeRequest		75.0%
github.com/prebid/prebid-server/v2/adapters/flipp/flipp.go:91:	processImp		88.6%
github.com/prebid/prebid-server/v2/adapters/flipp/flipp.go:167:	buildPrebidRequest	100.0%
github.com/prebid/prebid-server/v2/adapters/flipp/flipp.go:184:	MakeBids		93.3%
github.com/prebid/prebid-server/v2/adapters/flipp/flipp.go:214:	getAdTypes		100.0%
github.com/prebid/prebid-server/v2/adapters/flipp/flipp.go:221:	buildBid		100.0%
github.com/prebid/prebid-server/v2/adapters/flipp/flipp.go:238:	paramsUserKeyPermitted	80.0%
total:								(statements)		89.7%

@@ -59,12 +63,12 @@ func (a *adapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.E
adapterRequests = append(adapterRequests, adapterReq)
}
if len(adapterRequests) == 0 {
return nil, append(errors, fmt.Errorf("adapterRequest is empty"))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

There's no need for fmt.Errorf with a fixed string. Hoisted the error to a top level variable to be more sensitive to allocations.

// Builder builds a new instance of the Flipp adapter for the given bidder with the given config.
func Builder(bidderName openrtb_ext.BidderName, config config.Adapter, server config.Server) (adapters.Bidder, error) {
uuidGenerator = uuidutil.UUIDRandomGenerator{}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The uuidGenerator should be scoped to the adapter instance per our rules. This is to avoid memory access issues if there are adapter aliases specified.

@bsardo bsardo self-assigned this Apr 11, 2024
@kalidas-alkimi
Copy link
Contributor

@SyntaxNode The change looks fine on alkimi adapter. Thanks.

@hasan-kanjee
Copy link
Contributor

@SyntaxNode the changes on Flipp adapter looks good. Thank you for making those!

@bsardo bsardo merged commit 49e22c5 into prebid:master Apr 30, 2024
5 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.

None yet

6 participants