-
Notifications
You must be signed in to change notification settings - Fork 6
UOE-8632: refactor URL macro replacer to reduce mem allocs #419
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
base: ci_backup_20240824
Are you sure you want to change the base?
Conversation
611c595
to
377d385
Compare
377d385
to
15c10ca
Compare
func replaceMacro(trackerURL, macro, value string) string { | ||
macro = strings.TrimSpace(macro) | ||
trimmedValue := strings.TrimSpace(value) | ||
func replaceMacros(trackerURL string, macroMap map[string]string) string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you try using Macro Replacer from macros package and check if we get similar benchmark result?
trackingEle.CreateAttr("event", event) | ||
trackingEle.SetText(fmt.Sprintf("%s", url)) | ||
trackingEle.SetText(eventURLMap[event]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this needs to be CData
instead of plain text.
eventURL = replaceMacro(eventURL, PBSAccountMacro, req.Site.Publisher.ID) | ||
} | ||
|
||
if req != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this check even required at this stage?
err := json.Unmarshal(req.Ext, &reqExt) | ||
if err == nil { | ||
customMacroMap = reqExt.Prebid.Macros | ||
// replace standard macros |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Request Level macro remain constant for all the tracker. Can we populate this only once?
// lookup in custom macros - keep this block at last for highest priority | ||
reqExt := new(openrtb_ext.ExtRequest) | ||
if req.Ext != nil { | ||
err := json.Unmarshal(req.Ext, &reqExt) | ||
if err != nil { | ||
glog.Warningf("Error in unmarshling req.Ext.Prebid.Vast: [%s]", err.Error()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we get access to requestWrapper here, will reduce the extract unmarshling overhead?
exchange/auction.go
Outdated
`<VASTAdTagURI><![CDATA[%v]]></VASTAdTagURI>` + | ||
`<Impression></Impression><Creatives></Creatives>` + | ||
`</Wrapper></Ad></VAST>` | ||
wrapperVASTTemplate := `<VAST version="3.0"><Ad><Wrapper><AdSystem>prebid.org wrapper</AdSystem><VASTAdTagURI><![CDATA[%v]]></VASTAdTagURI><Impression></Impression><Creatives></Creatives></Wrapper></Ad></VAST>` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let us revert formatting change. This is prebid function
The base branch was changed.
Description
Please add change description or link to ticket, docs, etc.
Checklist:
header-bidding
repo with appropiate commit id.For Prebid upgrade, refer: https://inside.pubmatic.com:8443/confluence/display/Products/Prebid-server+upgrade