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 2 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
4 changes: 2 additions & 2 deletions DuckDuckGo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -15370,8 +15370,8 @@
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/duckduckgo/BrowserServicesKit";
requirement = {
kind = exactVersion;
version = 218.0.0;
branch = smodi/compilation_time_tracking;
kind = branch;
};
};
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" : "e5d390c8559fbe7b1ca67fd3982c91bcc0437d60",
"version" : "218.0.0"
"branch" : "smodi/compilation_time_tracking",
"revision" : "e6a31c758753763c47e3a44ee84e1ec761552e2c"
}
},
{
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 retryCount, let timeBucketAggregation):
let timeBucket = GeneralPixel.CompileTimeBucketAggregation(number: timeBucketAggregation)
domainEvent = .contentBlockingCompilationTaskPerformance(retryCount: retryCount,
timeBucketAggregation: timeBucket)
}

PixelKit.fire(DebugEvent(domainEvent, error: error), withAdditionalParameters: parameters) { _, error in
Expand Down
30 changes: 30 additions & 0 deletions 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(retryCount: Int, timeBucketAggregation: CompileTimeBucketAggregation)

case secureVaultInitError(error: Error)
case secureVaultError(error: Error)
Expand Down Expand Up @@ -946,6 +947,9 @@ enum GeneralPixel: PixelKitEventV2 {
case .contentBlockingLRCMissing:
return "content_blocking_lrc_missing"

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

case .secureVaultInitError:
return "secure_vault_init_error"
case .secureVaultError:
Expand Down Expand Up @@ -1442,4 +1446,30 @@ enum GeneralPixel: PixelKitEventV2 {
}

}

public enum CompileTimeBucketAggregation: String, CustomStringConvertible {

public var description: String { rawValue }

case lessThan1 = "1"
case lessThan2 = "2"
case lessThan5 = "5"
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 ...5:
self = .lessThan5
case ...10:
self = .lessThan10
default:
self = .more
}
}
}
}
Loading