Skip to content

Commit

Permalink
Adding pixel info for content blocking compilation performance tracki…
Browse files Browse the repository at this point in the history
…ng (#3634)

Task/Issue URL:
https://app.asana.com/0/1208613456171888/1208801514911205/f
Tech Design URL:
https://app.asana.com/0/481882893211075/1208730499188670/f
CC:

**Description**:

**Optional E2E tests**:
- [ ] Run PIR E2E tests
Check this to run the Personal Information Removal end to end tests. If
updating CCF, or any PIR related code, tick this.

**Steps to test this PR**:
1.

<!--
Tagging instructions
If this PR isn't ready to be merged for whatever reason it should be
marked with the `DO NOT MERGE` label (particularly if it's a draft)
If it's pending Product Review/PFR, please add the `Pending Product
Review` label.

If at any point it isn't actively being worked on/ready for
review/otherwise moving forward (besides the above PR/PFR exception)
strongly consider closing it (or not opening it in the first place). If
you decide not to close it, make sure it's labelled to make it clear the
PRs state and comment with more information.
-->

**Definition of Done**:

* [ ] Does this PR satisfy our [Definition of
Done](https://app.asana.com/0/1202500774821704/1207634633537039/f)?

---
###### Internal references:
[Pull Request Review
Checklist](https://app.asana.com/0/1202500774821704/1203764234894239/f)
[Software Engineering
Expectations](https://app.asana.com/0/59792373528535/199064865822552)
[Technical Design
Template](https://app.asana.com/0/59792373528535/184709971311943)
[Pull Request
Documentation](https://app.asana.com/0/1202500774821704/1204012835277482/f)

---------

Co-authored-by: Bartek Waresiak <[email protected]>
  • Loading branch information
studiosutara and bwaresiak authored Dec 9, 2024
1 parent 13fd870 commit 4bd587e
Show file tree
Hide file tree
Showing 10 changed files with 64 additions and 15 deletions.
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

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

0 comments on commit 4bd587e

Please sign in to comment.