Skip to content
This repository was archived by the owner on Feb 24, 2025. It is now read-only.

Commit 8c0cb45

Browse files
Smodi/compilation time tracking (#3685)
<!-- Note: This checklist is a reminder of our shared engineering expectations. Feel free to change it, although assigning a GitHub reviewer and the items in bold are required. ⚠️ If you're an external contributor, please file an issue first before working on a PR, as we can't guarantee that we will accept your changes if they haven't been discussed ahead of time. Thanks! --> Task/Issue URL: https://app.asana.com/0/1208613456171888/1208801514911205/f Tech Design URL: https://app.asana.com/0/481882893211075/1208730499188670/f CC: **Description**: <!-- If at any point it isn't actively being worked on/ready for review/otherwise moving forward strongly consider closing it (or not opening it in the first place). If you decide not to close it, use Draft PR while work is still in progress or use `DO NOT MERGE` label to clarify the PRs state and comment with more information. --> **Steps to test this PR**: 1. 2. <!-- Before submitting a PR, please ensure you have tested the combinations you expect the reviewer to test, then delete configurations you *know* do not need explicit testing. Using a simulator where a physical device is unavailable is acceptable. --> **Definition of Done (Internal Only)**: * [ ] Does this PR satisfy our [Definition of Done](https://app.asana.com/0/1202500774821704/1207634633537039/f)? **Copy Testing**: * [ ] Use of correct apostrophes in new copy, ie `’` rather than `'` **Orientation Testing**: * [ ] Portrait * [ ] Landscape **Device Testing**: * [ ] iPhone SE (1st Gen) * [ ] iPhone 8 * [ ] iPhone X * [ ] iPhone 14 Pro * [ ] iPad **OS Testing**: * [ ] iOS 15 * [ ] iOS 16 * [ ] iOS 17 **Theme Testing**: * [ ] Light theme * [ ] Dark theme --- ###### Internal references: [Software Engineering Expectations](https://app.asana.com/0/59792373528535/199064865822552) [Technical Design Template](https://app.asana.com/0/59792373528535/184709971311943) --------- Co-authored-by: Bartek Waresiak <[email protected]>
1 parent 7ae0fc2 commit 8c0cb45

File tree

4 files changed

+55
-9
lines changed

4 files changed

+55
-9
lines changed

Core/ContentBlocking.swift

+4-3
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,6 @@ public final class ContentBlocking {
116116

117117
domainEvent = .contentBlockingCompilationFailed(listType: listType, component: component)
118118

119-
case .contentBlockingCompilationTime:
120-
domainEvent = .contentBlockingCompilationTime
121-
122119
case .contentBlockingLookupRulesSucceeded:
123120
domainEvent = .contentBlockingLookupRulesSucceeded
124121

@@ -130,6 +127,10 @@ public final class ContentBlocking {
130127

131128
case .contentBlockingLRCMissing:
132129
domainEvent = .contentBlockingLRCMissing
130+
131+
case .contentBlockingCompilationTaskPerformance(let retryCount, let timeBucketAggregation):
132+
domainEvent = .contentBlockingCompilationTaskPerformance(iterationCount: retryCount,
133+
timeBucketAggregation: Pixel.Event.CompileTimeBucketAggregation(number: timeBucketAggregation))
133134
}
134135

135136
if let error = error {

Core/PixelEvent.swift

+48-3
Original file line numberDiff line numberDiff line change
@@ -535,12 +535,12 @@ extension Pixel {
535535
case contentBlockingCompilationFailed(listType: CompileRulesListType,
536536
component: ContentBlockerDebugEvents.Component)
537537

538-
case contentBlockingCompilationTime
539538
case contentBlockingLookupRulesSucceeded
540539
case contentBlockingFetchLRCSucceeded
541540
case contentBlockingNoMatchInLRC
542541
case contentBlockingLRCMissing
543542

543+
case contentBlockingCompilationTaskPerformance(iterationCount: Int, timeBucketAggregation: CompileTimeBucketAggregation)
544544
case ampBlockingRulesCompilationFailed
545545

546546
case webKitDidTerminate
@@ -1408,13 +1408,14 @@ extension Pixel.Event {
14081408
case .contentBlockingCompilationFailed(let listType, let component):
14091409
return "m_d_content_blocking_\(listType)_\(component)_compilation_failed"
14101410

1411-
case .contentBlockingCompilationTime: return "m_content_blocking_compilation_time"
14121411

14131412
case .contentBlockingLookupRulesSucceeded: return "m_content_blocking_lookup_rules_succeeded"
14141413
case .contentBlockingFetchLRCSucceeded: return "m_content_blocking_fetch_lrc_succeeded"
14151414
case .contentBlockingNoMatchInLRC: return "m_content_blocking_no_match_in_lrc"
14161415
case .contentBlockingLRCMissing: return "m_content_blocking_lrc_missing"
14171416

1417+
case .contentBlockingCompilationTaskPerformance(let iterationCount, let timeBucketAggregation):
1418+
return "m_content_blocking_compilation_loops_\(iterationCount)_time_\(timeBucketAggregation)"
14181419
case .ampBlockingRulesCompilationFailed: return "m_debug_amp_rules_compilation_failed"
14191420

14201421
case .webKitDidTerminate: return "m_d_wkt"
@@ -1880,6 +1881,50 @@ extension Pixel.Event {
18801881
case blockingAttribution
18811882
case attributed
18821883
case unknown
1883-
1884+
1885+
}
1886+
1887+
public enum CompileTimeBucketAggregation: String, CustomStringConvertible {
1888+
1889+
public var description: String { rawValue }
1890+
1891+
case lessThan1 = "1"
1892+
case lessThan2 = "2"
1893+
case lessThan3 = "3"
1894+
case lessThan4 = "4"
1895+
case lessThan5 = "5"
1896+
case lessThan6 = "6"
1897+
case lessThan7 = "7"
1898+
case lessThan8 = "8"
1899+
case lessThan9 = "9"
1900+
case lessThan10 = "10"
1901+
case more
1902+
1903+
public init(number: Double) {
1904+
switch number {
1905+
case ...1:
1906+
self = .lessThan1
1907+
case ...2:
1908+
self = .lessThan2
1909+
case ...3:
1910+
self = .lessThan3
1911+
case ...4:
1912+
self = .lessThan4
1913+
case ...5:
1914+
self = .lessThan5
1915+
case ...6:
1916+
self = .lessThan6
1917+
case ...7:
1918+
self = .lessThan7
1919+
case ...8:
1920+
self = .lessThan8
1921+
case ...9:
1922+
self = .lessThan9
1923+
case ...10:
1924+
self = .lessThan10
1925+
default:
1926+
self = .more
1927+
}
1928+
}
18841929
}
18851930
}

DuckDuckGo.xcodeproj/project.pbxproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -11570,7 +11570,7 @@
1157011570
repositoryURL = "https://github.com/DuckDuckGo/BrowserServicesKit";
1157111571
requirement = {
1157211572
kind = exactVersion;
11573-
version = 219.1.0;
11573+
version = 220.0.0;
1157411574
};
1157511575
};
1157611576
9F8FE9472BAE50E50071E372 /* XCRemoteSwiftPackageReference "lottie-spm" */ = {

DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232
"kind" : "remoteSourceControl",
3333
"location" : "https://github.com/DuckDuckGo/BrowserServicesKit",
3434
"state" : {
35-
"revision" : "6c335fb4355e7128dd9fb9fd25ac3de8942846ad",
36-
"version" : "219.1.0"
35+
"revision" : "55e7de13a99793329993367169c9b6bafbd07bac",
36+
"version" : "220.0.0"
3737
}
3838
},
3939
{

0 commit comments

Comments
 (0)