-
Notifications
You must be signed in to change notification settings - Fork 752
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
New Analytics Adapter: PubxAi #3863
base: master
Are you sure you want to change the base?
Conversation
PubxAI Analytics adapter
Hi @tej656, when you have time, please merge with master and resolve conflicts. Also, we recently released PBS 3.0, more specifically v3.1.0, which updates Prebid Server package import references throughout the project from
As a result, after merging with master, please ensure all Prebid Server package import references in the files you’ve changed are |
@bsardo i have updated the merge conflicts. |
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.
Taking an initial pass. This is a very large PR and there are a lot of complications we need to look out for regarding concurrent safety. Still need to take time to review concurrent constructs, but the use of sleep statements in tests is concerning.
analytics/build/build.go
Outdated
@@ -43,6 +44,26 @@ func New(analytics *config.Analytics) analytics.Runner { | |||
glog.Errorf("Could not initialize PubstackModule: %v", err) | |||
} | |||
} | |||
glog.Info("pubxai.Enabled: ", analytics.Pubxai.Enabled) |
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 log line necessary? Do the other analytics adapters do this?
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.
removed it
analytics/build/build.go
Outdated
clock.New(), | ||
) | ||
if err == nil { | ||
glog.Infof("PubxaiModule initialized") |
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.
Nitpick: No need to use Infof
for formatting for a static string.
analytics/pubxai/config/config.go
Outdated
return nil, fmt.Errorf("fail to parse the module args, arg=analytics.pubxai.configuration_refresh_delay: %v", err) | ||
} | ||
|
||
endpointUrl, err := url.Parse(endpoint + "/config?pubxId=" + pubxId) |
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.
You must sanitize the user provided pubxId string when including it as a query parameter.
@@ -0,0 +1,63 @@ | |||
// Code generated by MockGen. DO NOT EDIT. |
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 use the testify mock library? That's our standard in this project.
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.
sure, updated all the mocks to use testify mock
close(stop) | ||
// Ensure task stops correctly | ||
time.Sleep(2 * time.Second) | ||
assert.NotNil(t, configChan) |
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.
Do not use sleep statements in tests. Instead, use channel messages or other definitive sync mechanisms. I'm not willing to add 4 seconds to this projects test runtime here.
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.
updated the tests to remove sleeps
auctionBids, winningBids := processorService.ProcessLogData(ao) | ||
assert.Nil(t, auctionBids) | ||
assert.Nil(t, winningBids) | ||
} |
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.
Kindly reformat to Go table driven tests.
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.
updated all the tests to Go table driven tests.
analytics/pubxai/utils/utils.go
Outdated
Timestamp int64 `json:"timestamp"` | ||
} | ||
|
||
type UtilsService interface { |
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.
Why do utils need to be a service?
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.
this was for mainly for the Unit tests, but anyway, since not using gomock anymore, utils is not a service anymore
util/useragentutil/useragentutil.go
Outdated
const ( | ||
DEVICE_DESKTOP = iota | ||
DEVICE_MOBILE | ||
DEVICE_TABLET |
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.
Nitpick: Following Go naming standards, use MixedCaps here instead of SCREAMING_CAPS.
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.
Updated
analytics/pubxai/utils/utils.go
Outdated
type FloorData struct { | ||
FetchStatus string `json:"fetchStatus"` | ||
FloorProvider string `json:"floorProvider"` | ||
Location string `json:"location"` | ||
ModelVersion string `json:"modelVersion"` | ||
NoFloorSignaled bool `json:"noFloorSignaled"` | ||
SkipRate int64 `json:"skipRate"` | ||
Skipped bool `json:"skipped"` | ||
SkippedReason string `json:"skippedReason"` | ||
} |
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.
Any specific reason to have duplicate struct ?
FloorDetail struct is having same fields
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.
aah, my bad, this was not used, removed it
Update mocking and Testing Framework changes
remove log statement
No description provided.