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

Adding pixel info for content blocking compilation performance tracking #3634

Merged
merged 19 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DuckDuckGo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -15225,7 +15225,7 @@
repositoryURL = "https://github.com/duckduckgo/BrowserServicesKit";
requirement = {
kind = exactVersion;
version = 219.1.0;
version = 220.0.0;
};
};
9FF521422BAA8FF300B9819B /* XCRemoteSwiftPackageReference "lottie-spm" */ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/duckduckgo/BrowserServicesKit",
"state" : {
"revision" : "6c335fb4355e7128dd9fb9fd25ac3de8942846ad",
"version" : "219.1.0"
"revision" : "55e7de13a99793329993367169c9b6bafbd07bac",
"version" : "220.0.0"
}
},
{
Expand Down Expand Up @@ -75,7 +75,7 @@
{
"identity" : "lottie-spm",
"kind" : "remoteSourceControl",
"location" : "https://github.com/airbnb/lottie-spm",
"location" : "https://github.com/airbnb/lottie-spm.git",
"state" : {
"revision" : "1d29eccc24cc8b75bff9f6804155112c0ffc9605",
"version" : "4.4.3"
Expand Down
9 changes: 5 additions & 4 deletions DuckDuckGo/ContentBlocker/ContentBlocking.swift
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,11 @@ final class AppContentBlocking {

case .contentBlockingLRCMissing:
domainEvent = .contentBlockingLRCMissing
case .contentBlockingCompilationTime:
// Temporarily avoid firing this pixel. This can be re-enabled if it's determined to be necessary later.
// domainEvent = .contentBlockingCompilationTime
return

case .contentBlockingCompilationTaskPerformance(let iterationCount, let timeBucketAggregation):
let timeBucket = GeneralPixel.CompileTimeBucketAggregation(number: timeBucketAggregation)
domainEvent = .contentBlockingCompilationTaskPerformance(iterationCount: iterationCount,
timeBucketAggregation: timeBucket)
}

PixelKit.fire(DebugEvent(domainEvent, error: error), withAdditionalParameters: parameters) { _, error in
Expand Down
50 changes: 49 additions & 1 deletion DuckDuckGo/Statistics/GeneralPixel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ enum GeneralPixel: PixelKitEventV2 {
case contentBlockingFetchLRCSucceeded
case contentBlockingNoMatchInLRC
case contentBlockingLRCMissing
case contentBlockingCompilationTaskPerformance(iterationCount: Int, timeBucketAggregation: CompileTimeBucketAggregation)

case secureVaultInitError(error: Error)
case secureVaultError(error: Error)
Expand Down Expand Up @@ -675,7 +676,7 @@ enum GeneralPixel: PixelKitEventV2 {
case .duckPlayerContingencyLearnMoreClicked:
return "duckplayer_mac_contingency_learn-more-clicked"

// Duck Player Temporary Overlay Pixels
// Duck Player Temporary Overlay Pixels
case .duckPlayerYouTubeOverlayNavigationBack:
return "duckplayer_youtube_overlay_navigation_back"
case .duckPlayerYouTubeOverlayNavigationRefresh:
Expand Down Expand Up @@ -946,6 +947,9 @@ enum GeneralPixel: PixelKitEventV2 {
case .contentBlockingLRCMissing:
return "content_blocking_lrc_missing"

case .contentBlockingCompilationTaskPerformance(let iterationCount, let timeBucketAggregation):
return "content_blocking_compilation_loops_\(iterationCount)_time_\(timeBucketAggregation)"

case .secureVaultInitError:
return "secure_vault_init_error"
case .secureVaultError:
Expand Down Expand Up @@ -1446,4 +1450,48 @@ enum GeneralPixel: PixelKitEventV2 {
enum AutofillParameterKeys {
static var backfilled = "backfilled"
}

public enum CompileTimeBucketAggregation: String, CustomStringConvertible {

public var description: String { rawValue }

case lessThan1 = "1"
case lessThan2 = "2"
case lessThan3 = "3"
case lessThan4 = "4"
case lessThan5 = "5"
case lessThan6 = "6"
case lessThan7 = "7"
case lessThan8 = "8"
case lessThan9 = "9"
case lessThan10 = "10"
case more
bwaresiak marked this conversation as resolved.
Show resolved Hide resolved

public init(number: Double) {
switch number {
case ...1:
self = .lessThan1
case ...2:
self = .lessThan2
case ...3:
self = .lessThan3
case ...4:
self = .lessThan4
case ...5:
self = .lessThan5
case ...6:
self = .lessThan6
case ...7:
self = .lessThan7
case ...8:
self = .lessThan8
case ...9:
self = .lessThan9
case ...10:
self = .lessThan10
default:
self = .more
}
}
}
}
2 changes: 1 addition & 1 deletion LocalPackages/DataBrokerProtection/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ let package = Package(
targets: ["DataBrokerProtection"])
],
dependencies: [
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "219.1.0"),
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "220.0.0"),
.package(path: "../SwiftUIExtensions"),
.package(path: "../AppKitExtensions"),
.package(path: "../XPCHelper"),
Expand Down
2 changes: 1 addition & 1 deletion LocalPackages/FeatureFlags/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ let package = Package(
targets: ["FeatureFlags"]),
],
dependencies: [
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "219.1.0"),
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "220.0.0"),
],
targets: [
// Targets are the basic building blocks of a package, defining a module or a test suite.
Expand Down
2 changes: 1 addition & 1 deletion LocalPackages/NetworkProtectionMac/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ let package = Package(
.library(name: "VPNAppLauncher", targets: ["VPNAppLauncher"]),
],
dependencies: [
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "219.1.0"),
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "220.0.0"),
.package(url: "https://github.com/airbnb/lottie-spm", exact: "4.4.3"),
.package(path: "../AppLauncher"),
.package(path: "../UDSHelper"),
Expand Down
2 changes: 1 addition & 1 deletion LocalPackages/NewTabPage/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ let package = Package(
targets: ["NewTabPage"]),
],
dependencies: [
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "219.1.0"),
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "220.0.0"),
.package(path: "../WebKitExtensions"),
.package(path: "../Utilities"),
],
Expand Down
2 changes: 1 addition & 1 deletion LocalPackages/SubscriptionUI/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ let package = Package(
targets: ["SubscriptionUI"]),
],
dependencies: [
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "219.1.0"),
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "220.0.0"),
.package(path: "../SwiftUIExtensions"),
.package(path: "../FeatureFlags")
],
Expand Down
2 changes: 1 addition & 1 deletion LocalPackages/WebKitExtensions/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ let package = Package(
),
],
dependencies: [
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "219.1.0"),
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "220.0.0"),
.package(path: "../AppKitExtensions")
],
targets: [
Expand Down
Loading