Skip to content

Commit 144f23e

Browse files
Remove Clearcut dependency. (#7210)
* Remove Clearcut dependency. * Update CHANGELOG.md * Update CHANGELOG.md * Update CHANGELOG.md * Update CHANGELOG.md * Keep cleanupClearcutCacheDirectory method.
1 parent 62f7c6c commit 144f23e

23 files changed

+247
-759
lines changed

FirebasePerformance/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Unreleased
2+
* Deprecate Clearcut event transport mechanism.
3+
14
# Version 7.7.0
25
* Add community supported tvOS.
36

FirebasePerformance/Sources/Configurations/FPRConfigurations.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -187,13 +187,6 @@ FOUNDATION_EXTERN FPRConfigName kFPRConfigInstrumentationEnabled;
187187
*/
188188
- (uint32_t)memorySamplingFrequencyInBackgroundInMS;
189189

190-
/**
191-
* Returns a float specifying the transport percentage for FLL. Range [0-100].
192-
*
193-
* @return The percentage of devices sending events to FLL.
194-
*/
195-
- (float_t)fllTransportPercentage;
196-
197190
@end
198191

199192
NS_ASSUME_NONNULL_END

FirebasePerformance/Sources/Configurations/FPRConfigurations.m

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -474,36 +474,4 @@ - (uint32_t)memorySamplingFrequencyInBackgroundInMS {
474474
return samplingFrequency;
475475
}
476476

477-
#pragma mark - Google Data Transport related configurations.
478-
479-
- (float_t)fllTransportPercentage {
480-
// Order of precedence is:
481-
//
482-
// Any RC config flags exists?
483-
// -> Yes
484-
// -> If Transport flag exists, honor the value (active rollout scenario)
485-
// -> Otherwise, send to Fll (deprecation scenario)
486-
// -> No
487-
// -> Send to clearcut (onboarding scenario)
488-
//
489-
// If a PList override also exists than that takes the priority
490-
491-
// By default send to Clearcut
492-
float transportPercentage = 0.0f; // Range [0 - 100]
493-
494-
if (self.remoteConfigFlags && [self.remoteConfigFlags containsRemoteConfigFlags]) {
495-
// If Transport flag exists, honor the value (active rollout scenario)
496-
// Otherwise, send to Fll (deprecation scenario)
497-
transportPercentage = [self.remoteConfigFlags fllTransportPercentageWithDefaultValue:100.0f];
498-
}
499-
500-
// If a PList override also exists than that takes the priority
501-
id plistObject = [self objectForInfoDictionaryKey:@"fllTransportPercentage"];
502-
if (plistObject) {
503-
transportPercentage = [plistObject floatValue];
504-
}
505-
506-
return transportPercentage;
507-
}
508-
509477
@end

FirebasePerformance/Sources/Configurations/FPRRemoteConfigFlags.h

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,6 @@
4040
*/
4141
- (void)update;
4242

43-
/**
44-
* Returns if there was a successful fetch in the past and if any remote config flag exists.
45-
*
46-
* @return YES if any remote config flag exists; NO otherwise.
47-
*/
48-
- (BOOL)containsRemoteConfigFlags;
49-
5043
#pragma mark - General configs.
5144

5245
/**
@@ -207,17 +200,4 @@
207200
*/
208201
- (int)sessionMaxDurationWithDefaultValue:(int)maxDurationInMinutes;
209202

210-
#pragma mark - Google Data Transport related configs.
211-
212-
/**
213-
* Returns the fll event transport percentage. A value of 100 means all the events are sent to
214-
* Fll. A value of 0 means, event are not sent to FLL. Range [0-100]. A value of -1 means
215-
* the value is not found. Name in remote config: "fpr_log_transport_ios_percent"
216-
*
217-
* @param percentage Default value of the transport rate to be returned if value does not exist
218-
* in remote config.
219-
* @return FLL transport percentage.
220-
*/
221-
- (float)fllTransportPercentageWithDefaultValue:(float)percentage;
222-
223203
@end

FirebasePerformance/Sources/Configurations/FPRRemoteConfigFlags.m

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ - (instancetype)initWithRemoteConfig:(FIRRemoteConfig *)config {
9595
[keysToCache setObject:@(FPRConfigValueTypeInteger)
9696
forKey:@"fpr_session_gauge_memory_capture_frequency_bg_ms"];
9797
[keysToCache setObject:@(FPRConfigValueTypeInteger) forKey:@"fpr_session_max_duration_min"];
98-
[keysToCache setObject:@(FPRConfigValueTypeFloat) forKey:@"fpr_log_transport_ios_percent"];
9998
self.configKeys = [keysToCache copy];
10099

101100
[self update];
@@ -136,19 +135,6 @@ - (void)update {
136135
}
137136
}
138137

139-
- (BOOL)containsRemoteConfigFlags {
140-
// Ideally this should not be tied to any specific flag but since "fpr_enabled" is and should
141-
// always be available we simply check for its existence to validate that the RC flags exists
142-
// in the cache or not.
143-
id cachedValueObject = [self cachedValueForConfigFlag:@"fpr_enabled"];
144-
145-
if (cachedValueObject) {
146-
return true;
147-
}
148-
149-
return false;
150-
}
151-
152138
#pragma mark - Util methods.
153139

154140
- (void)resetCache {
@@ -344,10 +330,4 @@ - (int)sessionMaxDurationWithDefaultValue:(int)maxDurationInMinutes {
344330
defaultValue:maxDurationInMinutes];
345331
}
346332

347-
#pragma mark - Google Data Transport related methods
348-
349-
- (float)fllTransportPercentageWithDefaultValue:(float)percentage {
350-
return [self getFloatValueForFlag:@"fpr_log_transport_ios_percent" defaultValue:percentage];
351-
}
352-
353333
@end

FirebasePerformance/Sources/FPRClient+Private.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#import "FirebasePerformance/ProtoSupport/PerfMetric.pbobjc.h"
1616
#import "FirebasePerformance/Sources/FPRClient.h"
1717

18-
@class FPRGDTCCLogger;
18+
@class FPRGDTLogger;
1919
@class FPRConfigurations;
2020
@class FIRInstallations;
2121

@@ -28,7 +28,7 @@
2828
@property(nonatomic, getter=isConfigured, readwrite) BOOL configured;
2929

3030
/** GDT Logger to transmit Fireperf events to Google Data Transport. */
31-
@property(nonatomic) FPRGDTCCLogger *gdtLogger;
31+
@property(nonatomic) FPRGDTLogger *gdtLogger;
3232

3333
/** The queue group all FPRClient work will run on. Used for testing only. */
3434
@property(nonatomic, readonly) dispatch_group_t eventsQueueGroup;

FirebasePerformance/Sources/FPRClient.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
#import "FirebasePerformance/Sources/FPRConsoleLogger.h"
2626
#import "FirebasePerformance/Sources/FPRProtoUtils.h"
2727
#import "FirebasePerformance/Sources/Instrumentation/FPRInstrumentation.h"
28-
#import "FirebasePerformance/Sources/Loggers/FPRGDTCCLogger.h"
28+
#import "FirebasePerformance/Sources/Loggers/FPRGDTLogger.h"
2929
#import "FirebasePerformance/Sources/Timer/FIRTrace+Internal.h"
3030
#import "FirebasePerformance/Sources/Timer/FIRTrace+Private.h"
3131

@@ -117,7 +117,7 @@ - (BOOL)startWithConfiguration:(FPRConfiguration *)config error:(NSError *__auto
117117

118118
dispatch_group_async(self.eventsQueueGroup, self.eventsQueue, ^{
119119
// Create the Logger for the Perf SDK events to be sent to Google Data Transport.
120-
self.gdtLogger = [[FPRGDTCCLogger alloc] initWithLogSource:logSource];
120+
self.gdtLogger = [[FPRGDTLogger alloc] initWithLogSource:logSource];
121121

122122
#if __has_include("CoreTelephony/CTTelephonyNetworkInfo.h")
123123
// Create telephony network information object ahead of time to avoid runtime delays.

FirebasePerformance/Sources/Loggers/FPRGDTCCLogger.h renamed to FirebasePerformance/Sources/Loggers/FPRGDTLogger.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ NS_ASSUME_NONNULL_BEGIN
1919
@class FPRMSGPerfMetric;
2020

2121
/** Logger used to dispatch events to Google Data Transport layer. */
22-
@interface FPRGDTCCLogger : NSObject
22+
@interface FPRGDTLogger : NSObject
2323

2424
/** Log source initialized against. */
2525
@property(nonatomic, readonly) NSInteger logSource;
@@ -31,7 +31,7 @@ NS_ASSUME_NONNULL_BEGIN
3131
* Instantiates an instance of this class.
3232
*
3333
* @param logSource The log source for this logger to be used.
34-
* @return Instance of FPRGDTCCLogger.
34+
* @return Instance of FPRGDTLogger.
3535
*/
3636
- (instancetype)initWithLogSource:(NSInteger)logSource NS_DESIGNATED_INITIALIZER;
3737

FirebasePerformance/Sources/Loggers/FPRGDTCCLogger.m renamed to FirebasePerformance/Sources/Loggers/FPRGDTLogger.m

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
#import "FirebasePerformance/Sources/Loggers/FPRGDTCCLogger.h"
16-
#import "FirebasePerformance/Sources/Loggers/FPRGDTCCLogger_Private.h"
15+
#import "FirebasePerformance/Sources/Loggers/FPRGDTLogger.h"
16+
#import "FirebasePerformance/Sources/Loggers/FPRGDTLogger_Private.h"
1717

1818
#import "FirebasePerformance/Sources/Configurations/FPRConfigurations.h"
1919

@@ -25,21 +25,17 @@
2525

2626
#import "FirebasePerformance/ProtoSupport/PerfMetric.pbobjc.h"
2727

28-
@implementation FPRGDTCCLogger
28+
@implementation FPRGDTLogger
2929

3030
- (instancetype)initWithLogSource:(NSInteger)logSource {
3131
if (self = [super init]) {
3232
_logSource = logSource;
3333

34-
_queue = dispatch_queue_create("com.google.FPRGDTCCLogger", DISPATCH_QUEUE_SERIAL);
34+
_queue = dispatch_queue_create("com.google.FPRGDTLogger", DISPATCH_QUEUE_SERIAL);
3535
_configurations = [FPRConfigurations sharedInstance];
3636
FPRGDTLogSampler *logSampler = [[FPRGDTLogSampler alloc] init];
3737
FPRGDTRateLimiter *rateLimiter = [[FPRGDTRateLimiter alloc] init];
3838

39-
_gdtcctTransport = [[GDTCORTransport alloc] initWithMappingID:@(logSource).stringValue
40-
transformers:@[ logSampler, rateLimiter ]
41-
target:kGDTCORTargetCCT];
42-
4339
_gdtfllTransport = [[GDTCORTransport alloc] initWithMappingID:@(logSource).stringValue
4440
transformers:@[ logSampler, rateLimiter ]
4541
target:kGDTCORTargetFLL];
@@ -59,10 +55,7 @@ - (instancetype)initWithLogSource:(NSInteger)logSource {
5955
}
6056

6157
- (void)logEvent:(FPRMSGPerfMetric *)event {
62-
GDTCORTransport *eventTransporter = self.gdtcctTransport;
63-
if ([self shouldSendEventToFll:event]) {
64-
eventTransporter = self.gdtfllTransport;
65-
}
58+
GDTCORTransport *eventTransporter = self.gdtfllTransport;
6659

6760
dispatch_async(self.queue, ^{
6861
GDTCOREvent *gdtEvent = [eventTransporter eventForTransport];
@@ -76,16 +69,4 @@ - (void)logEvent:(FPRMSGPerfMetric *)event {
7669
});
7770
}
7871

79-
- (BOOL)shouldSendEventToFll:(FPRMSGPerfMetric *)event {
80-
return ([self.configurations fllTransportPercentage] >= [self instanceSeedForEvent:event]);
81-
}
82-
83-
- (float)instanceSeedForEvent:(FPRMSGPerfMetric *)event {
84-
if (_instanceSeed == -1.0) {
85-
// Seed is a float value with range [1 - 100].
86-
_instanceSeed = (float)([event.applicationInfo.appInstanceId hash] % 100 + 1);
87-
}
88-
return _instanceSeed;
89-
}
90-
9172
@end

FirebasePerformance/Sources/Loggers/FPRGDTCCLogger_Private.h renamed to FirebasePerformance/Sources/Loggers/FPRGDTLogger_Private.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,17 @@
1414

1515
#import <Foundation/Foundation.h>
1616

17-
#import "FirebasePerformance/Sources/Loggers/FPRGDTCCLogger.h"
17+
#import "FirebasePerformance/Sources/Loggers/FPRGDTLogger.h"
1818

1919
#import <GoogleDataTransport/GoogleDataTransport.h>
2020
#import "FirebasePerformance/Sources/Configurations/FPRConfigurations.h"
2121

22-
/** FPRGDTCCLogger private definition used for unit testing. */
23-
@interface FPRGDTCCLogger ()
22+
/** FPRGDTLogger private definition used for unit testing. */
23+
@interface FPRGDTLogger ()
2424

2525
/** Log source for which the logger is being used. */
2626
@property(nonatomic, readwrite) NSInteger logSource;
2727

28-
/** Google Data Transport instance for Clearcut. */
29-
@property(nonatomic, readwrite) GDTCORTransport *gdtcctTransport;
30-
3128
/** Google Data Transport instance for FLL. */
3229
@property(nonatomic, readwrite) GDTCORTransport *gdtfllTransport;
3330

0 commit comments

Comments
 (0)