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

Analytics activities #3024

Merged
merged 20 commits into from
Oct 4, 2023
Merged

Analytics activities #3024

merged 20 commits into from
Oct 4, 2023

Conversation

VeronikaSolovei9
Copy link
Contributor

@VeronikaSolovei9 VeronikaSolovei9 commented Aug 11, 2023

reportAnalytics integration: call before invoking each analytics adapter: /auction, /amp, /video, /event

@VeronikaSolovei9 VeronikaSolovei9 marked this pull request as ready for review August 22, 2023 01:07
analytics/config/config.go Outdated Show resolved Hide resolved
privacy/component.go Outdated Show resolved Hide resolved
analytics/config/config.go Outdated Show resolved Hide resolved
analytics/core.go Outdated Show resolved Hide resolved
}
return sn, nil
return components, nil
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are you combining the ComponentName and ComponentType fields here? They are handled separately, so this code just needs to parse ComponentName. Right?

Copy link
Contributor Author

@VeronikaSolovei9 VeronikaSolovei9 Aug 30, 2023

Choose a reason for hiding this comment

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

It looks like we need to incorporate componentType here too.
I added a comment with the description and example of what will happen if there are multiple component names and types.

    // condition can contain more than one component type and component name may have more than one names
// in this case scopes should have all combinations of names and types
// for instance for the config like this
//     "condition": {
//          "componentName": ["enabledAnalytics", "filelogger", "bidder.appnexus"],
//           "componentType":["analytics", "rtd"]
//     }
// result scopes should be:
// analytics.enabledAnalytics
// analytics.filelogger
// rtd.enabledAnalytics
// rtd.filelogger
// bidder.appnexus

I found that before this fix in case if we have a config like this:

"condition": {
        "componentName": [ "filelogger"],
         "componentType":["analytics"]
    }

result component object has componentType="bidder".

Should we rename this function to conditionToRuleComponent ?

Copy link
Contributor

Choose a reason for hiding this comment

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

result component object has componentType="bidder".

Right. That's the desired behavior. There is no guarantee of name uniqueness between adapters, analytics, and modules. The only way we know that filelogger is meant to be an analytics type is for that to be specified. Since adapters are most common, we made that the default for convience.

"componentName": [ "filelogger"] should be interpreted as bidder.filelogger.

in this case scopes should have all combinations of names and types

That's not my expectation and I don't believe that's in the spec.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is so confusing. My suggestion may not be right, it's easy to revert it back.
If I refer to the issue #2591 it says:

The following attributes may be seen:

componentName - this is the biddercode, the analytics adapter code, or the module code.
componentType - this is "bidder", "analytics", or for modules: if the module tag contains "rtd", then type is "rtd", otherwise type is "general".

In examples below it shows:

 rules: [{
          condition: {
            componentType: ["bidder", "analytics"]
          },
          allow: false
        }

This gave me the idea that config name can only have name and config type can only have a type and we will need to combine them together.

Copy link
Contributor

@SyntaxNode SyntaxNode Sep 6, 2023

Choose a reason for hiding this comment

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

Interesting. Reviewing the history of issue #2591, it seems the dot-notation was removed the first day of the focus group. I didn't remember that change. It does offer a lot of simplification with the assumption that name conflicts between analytics, adapters, and modules are rare.

In this case, let's keep the target as a Component, but change the componentName constraint to simply an array of strings. We can delete the complex Component comparison logic. The new matching algorithm for componentName ignores the type and the componentType ignores the name. We don't need to compute the matrix of all possibilities. These comparisons should be case insensitive (I think they are already).

Copy link
Contributor

Choose a reason for hiding this comment

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

That would be a lot of tangental work to include in this PR. I put up #3081 for the change.

@VeronikaSolovei9
Copy link
Contributor Author

I also tried to move analytics.config content one level up to analytics and got a circular dependency issue.

 imports github.com/prebid/prebid-server/router
 imports github.com/prebid/prebid-server/analytics
 imports github.com/prebid/prebid-server/analytics/filesystem
 imports github.com/prebid/prebid-server/analytics: import cycle not allowed

Do I still need to move it?

@@ -26,9 +25,11 @@ import (
nativeRequests "github.com/prebid/openrtb/v19/native1/request"
"github.com/prebid/openrtb/v19/openrtb2"
"github.com/prebid/openrtb/v19/openrtb3"
config2 "github.com/prebid/prebid-server/analytics/config"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just a nit pick, but I might suggest using a name like analytics rather than just config2 to better document what sort of package config2 represents.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Renamed to analyticsConf, analytics are already imported in this file.

hhhjort
hhhjort previously approved these changes Aug 30, 2023
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.

Just a naming nitpick to consider, but otherwise looking good now.

@VeronikaSolovei9
Copy link
Contributor Author

Moved Runner to it's own go file to the root of analytics package.
I will follow your name suggestions for the "analytics.config" package. Maybe "analytics.composite"?

@SyntaxNode
Copy link
Contributor

Moved Runner to it's own go file to the root of analytics package. I will follow your name suggestions for the "analytics.config" package. Maybe "analytics.composite"?

For adapters, we have exchange.BuildAdapters. For modules, we have modules.Build. Perhaps analytics.build as the package name?

# Conflicts:
#	endpoints/openrtb2/amp_auction.go
#	endpoints/openrtb2/auction.go
#	endpoints/openrtb2/video_auction.go
#	privacy/activitycontrol.go
#	privacy/activitycontrol_test.go
#	privacy/component.go
#	privacy/component_test.go
analytics/build/build.go Outdated Show resolved Hide resolved
analytics/build/build.go Show resolved Hide resolved
endpoints/openrtb2/video_auction.go Show resolved Hide resolved
analytics/core.go Outdated Show resolved Hide resolved
SyntaxNode
SyntaxNode previously approved these changes Sep 12, 2023
hhhjort
hhhjort previously approved these changes Sep 15, 2023
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

SyntaxNode
SyntaxNode previously approved these changes Sep 19, 2023
@VeronikaSolovei9 VeronikaSolovei9 dismissed stale reviews from SyntaxNode and hhhjort via c09f523 September 24, 2023 22:50
@VeronikaSolovei9
Copy link
Contributor Author

Merged with the main branch. Please re-review.

hhhjort
hhhjort previously approved these changes Sep 25, 2023
# Conflicts:
#	endpoints/openrtb2/video_auction_test.go
#	endpoints/setuid_test.go
@VeronikaSolovei9 VeronikaSolovei9 merged commit 134e9aa into master Oct 4, 2023
@SyntaxNode SyntaxNode deleted the analytics_activities branch November 17, 2023 22:13
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.

3 participants