-
Notifications
You must be signed in to change notification settings - Fork 732
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
Per Impression TID Generation and Source TID Logic Updated #2412
Conversation
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 opened up a comment on the corresponding feature request issue to verify the requirements:
#2381 (comment)
endpoints/openrtb2/auction.go
Outdated
req.Source.TID = req.ID | ||
if rawUUID, err := uuid.NewV4(); err == nil { | ||
ie.SetTid(rawUUID.String()) | ||
impWrapper.RebuildImp() |
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 believe we should be rebuilding the imps here but I need to confirm. By doing so we would ensure that after the validation phase the imps on the request accurately reflect any changes made to exts on the wrapper.
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.
The updates look good. I'm waiting for confirmation on the requirements before approving and I'll look into my comment about RebuildImp
.
Also just for future reference, if you could avoid force pushing after the PR has been reviewed that would be ideal. We prefer you just push another commit with your changes as this helps the reviewers save a lot of time since they often only need to review the delta. And if conflicts arise they can be resolved by merging with master instead of rebasing with a force push 🙂. Thanks again for your contribution; I'll be on the lookout for confirmation on the requirements. |
Thank you for the review and sounds good! I'll make sure to merge instead of rebasing next time when merging master. |
3bae81c
to
dbffbea
Compare
@ccorbo I noticed you pushed up a bunch of commits, which I assume are in accordance with the new requirements. Is this ready for review? |
endpoints/openrtb2/auction.go
Outdated
req.Source.TID = rawUUID.String() | ||
} | ||
|
||
if generateRequestID && (isAmp || hasStoredBidRequest) { |
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.
We may want to put this if statement in an else
from the if
above, so that we don't call rawUUID.String()
twice.
Actually we probably want to put it all into one, so we don't call uuid.NewV4()
when we don't have to, and potentially error out when we don't even have to generate a random UUID for the request.
if req.Source.TID == "" || req.Source.TID == "{{UUID}}" || ( generateRequestID && (isAmp || hasStoredBidRequest) ) {
rawUUID, err := uuid.NewV4()
if err != nil {
return errors.New("error creating a random UUID for source.tid")
}
req.Source.TID = rawUUID.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.
thanks for the review, updated
endpoints/openrtb2/auction.go
Outdated
if err != nil { | ||
return errors.New("imp.ext.tid missing in the imp and error creating a random UID") | ||
} | ||
if ie.GetTid() == "" || ie.GetTid() == "{{UUID}}" { |
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.
Shouldn't we also check that req.Source.Tid
was originally empty before setting imp.ext.tid
as per the spec in this PR? Probably need to set a boolean to indicate if this was empty before the code above is executed, or move this above setting req.Source.Tid
.
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.
Sorry my PR summary was outdated, now updated. The logic comes from Bret's comment on this issue if you want to cross reference. We went away from tying source.tid to imp.ext.tid
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.
Okay, if we are adhering to what prebid.js is already doing, then I am okay. There is a bit of tension between allowing publishers to send in IDs while also leveraging stored requests for config management vs. dealing with IDs that were inadvertently put into a stored request rendering them static.
Seems like something odd happened with the merge from master. Github is showing all the new code from master as new code, not recognizing it as code that already exists in master. |
weird, might of been because I mixed rebasing and merging, anyway rebased and its showing the correct diff now |
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.
LGTM
@ccorbo would you mind merging with master to resolve the conflicts when you get a moment? Thanks! |
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.
Looks good! Just one small test coverage comment
if hasTid { | ||
if err := json.Unmarshal(tidJson, &e.tid); err != 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.
Could you add a test where if hasTid
is true? I noticed that the code block where it is true isn't covered by tests. I'm not looking for the unmarshal return err line (line 1306) to be covered, but line 1305 should be covered, just to show that hasTid
being true is being tested.
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.
Yep, just added test coverage around this block
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.
LGTM
Co-authored-by: Chris Corbo <[email protected]>
This PR is to update the logic SourceTID logic when enabled to fill source tid. This is related to #2381.
Logic is outlined in this issue: #2381 (comment)
Changes in this PR: