1 |
efrain |
1 |
// Copyright 2020 Google LLC
|
|
|
2 |
//
|
|
|
3 |
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
4 |
// you may not use this file except in compliance with the License.
|
|
|
5 |
// You may obtain a copy of the License at
|
|
|
6 |
//
|
|
|
7 |
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
8 |
//
|
|
|
9 |
// Unless required by applicable law or agreed to in writing, software
|
|
|
10 |
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
11 |
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
12 |
// See the License for the specific language governing permissions and
|
|
|
13 |
// limitations under the License.
|
|
|
14 |
|
|
|
15 |
#import <Foundation/Foundation.h>
|
|
|
16 |
|
|
|
17 |
/**
|
|
|
18 |
* Configuration flags retrieved from Firebase Remote Configuration.
|
|
|
19 |
*/
|
|
|
20 |
@interface FPRRemoteConfigFlags : NSObject
|
|
|
21 |
|
|
|
22 |
/**
|
|
|
23 |
* The name of the name space for which the remote config flags are fetched.
|
|
|
24 |
*/
|
|
|
25 |
@property(nonatomic, readonly, nonnull) NSString *remoteConfigNamespace;
|
|
|
26 |
|
|
|
27 |
#pragma mark - Instance methods
|
|
|
28 |
|
|
|
29 |
- (nullable instancetype)init NS_UNAVAILABLE;
|
|
|
30 |
|
|
|
31 |
/** Singleton instance of Firebase Remote Configuration flags. */
|
|
|
32 |
+ (nullable instancetype)sharedInstance;
|
|
|
33 |
|
|
|
34 |
/**
|
|
|
35 |
* Initiate a fetch of the flags from Firebase Remote Configuration and updates the configurations
|
|
|
36 |
* at the end of the fetch.
|
|
|
37 |
*
|
|
|
38 |
* @note This method is throttled to initiate a fetch once in 12 hours. So, calling this method does
|
|
|
39 |
* not guarantee a fetch from Firebase Remote Config.
|
|
|
40 |
*/
|
|
|
41 |
- (void)update;
|
|
|
42 |
|
|
|
43 |
#pragma mark - General configs.
|
|
|
44 |
|
|
|
45 |
/**
|
|
|
46 |
* Returns if performance SDK is enabled.
|
|
|
47 |
* Name in remote config: "fpr_enabled".
|
|
|
48 |
*
|
|
|
49 |
* @param sdkEnabled Default value to be returned if values does not exist in remote config.
|
|
|
50 |
* @return Specifies if SDK should be enabled or not.
|
|
|
51 |
*/
|
|
|
52 |
- (BOOL)performanceSDKEnabledWithDefaultValue:(BOOL)sdkEnabled;
|
|
|
53 |
|
|
|
54 |
/**
|
|
|
55 |
* Returns set of versions on which SDK is disabled.
|
|
|
56 |
* Name in remote config: "fpr_disabled_ios_versions".
|
|
|
57 |
*
|
|
|
58 |
* @param sdkVersions Default value to be returned if values does not exist in remote config.
|
|
|
59 |
* @return SDK versions list where the SDK has to be disabled.
|
|
|
60 |
*/
|
|
|
61 |
- (nullable NSSet<NSString *> *)sdkDisabledVersionsWithDefaultValue:
|
|
|
62 |
(nullable NSSet<NSString *> *)sdkVersions;
|
|
|
63 |
|
|
|
64 |
/**
|
|
|
65 |
* Returns the log source against which the events will be recorded.
|
|
|
66 |
* Name in remote config: "fpr_log_source"
|
|
|
67 |
*
|
|
|
68 |
* @param logSource Default value to be returned if values does not exist in remote config.
|
|
|
69 |
* @return Log source towards which the events would be logged.
|
|
|
70 |
*/
|
|
|
71 |
- (int)logSourceWithDefaultValue:(int)logSource;
|
|
|
72 |
|
|
|
73 |
#pragma mark - Rate limiting related configs.
|
|
|
74 |
|
|
|
75 |
/**
|
|
|
76 |
* Returns the time limit for which the event are measured against. Measured in seconds.
|
|
|
77 |
* Name in remote config: "fpr_rl_time_limit_sec"
|
|
|
78 |
*
|
|
|
79 |
* @param durationInSeconds Default value to be returned if values does not exist in remote config.
|
|
|
80 |
* @return Time limit used for rate limiting in seconds.
|
|
|
81 |
*/
|
|
|
82 |
- (int)rateLimitTimeDurationWithDefaultValue:(int)durationInSeconds;
|
|
|
83 |
|
|
|
84 |
/**
|
|
|
85 |
* Returns the number of trace events that are allowed when the app is in foreground.
|
|
|
86 |
* Name in remote config: "fpr_rl_trace_event_count_fg"
|
|
|
87 |
*
|
|
|
88 |
* @param eventCount Default value to be returned if values does not exist in remote config.
|
|
|
89 |
* @return Trace count limit when the app is in foreground.
|
|
|
90 |
*/
|
|
|
91 |
- (int)rateLimitTraceCountInForegroundWithDefaultValue:(int)eventCount;
|
|
|
92 |
|
|
|
93 |
/**
|
|
|
94 |
* Returns the number of trace events that are allowed when the app is in background.
|
|
|
95 |
* Name in remote config: "fpr_rl_trace_event_count_bg"
|
|
|
96 |
*
|
|
|
97 |
* @param eventCount Default value to be returned if values does not exist in remote config.
|
|
|
98 |
* @return Trace count limit when the app is in background.
|
|
|
99 |
*/
|
|
|
100 |
- (int)rateLimitTraceCountInBackgroundWithDefaultValue:(int)eventCount;
|
|
|
101 |
|
|
|
102 |
/**
|
|
|
103 |
* Returns the number of network trace events that are allowed when the app is in foreground.
|
|
|
104 |
* Name in remote config: "fpr_rl_network_request_event_count_fg"
|
|
|
105 |
*
|
|
|
106 |
* @param eventCount Default value to be returned if values does not exist in remote config.
|
|
|
107 |
* @return Network request count limit when the app is in foreground.
|
|
|
108 |
*/
|
|
|
109 |
- (int)rateLimitNetworkRequestCountInForegroundWithDefaultValue:(int)eventCount;
|
|
|
110 |
|
|
|
111 |
/**
|
|
|
112 |
* Returns the number of network trace events that are allowed when the app is in background.
|
|
|
113 |
* Name in remote config: "fpr_rl_network_request_event_count_bg"
|
|
|
114 |
*
|
|
|
115 |
* @param eventCount Default value to be returned if values does not exist in remote config.
|
|
|
116 |
* @return Network request count limit when the app is in background.
|
|
|
117 |
*/
|
|
|
118 |
- (int)rateLimitNetworkRequestCountInBackgroundWithDefaultValue:(int)eventCount;
|
|
|
119 |
|
|
|
120 |
#pragma mark - Sampling related configs.
|
|
|
121 |
|
|
|
122 |
/**
|
|
|
123 |
* Returns the sampling rate for traces. A value of 1 means all the events must be sent to the
|
|
|
124 |
* backend. A value of 0 means, no data must be sent. Range [0-1]. A value of -1 means the value is
|
|
|
125 |
* not found.
|
|
|
126 |
* Name in remote config: "fpr_vc_trace_sampling_rate"
|
|
|
127 |
*
|
|
|
128 |
* @param samplingRate Default value to be returned if values does not exist in remote config.
|
|
|
129 |
* @return Sampling rate used for the number of traces.
|
|
|
130 |
*/
|
|
|
131 |
- (float)traceSamplingRateWithDefaultValue:(float)samplingRate;
|
|
|
132 |
|
|
|
133 |
/**
|
|
|
134 |
* Returns the sampling rate for network requests. A value of 1 means all the events must be sent to
|
|
|
135 |
* the backend. A value of 0 means, no data must be sent. Range [0-1]. A value of -1 means the value
|
|
|
136 |
* is not found.
|
|
|
137 |
* Name in remote config: "fpr_vc_network_request_sampling_rate"
|
|
|
138 |
*
|
|
|
139 |
* @param samplingRate Default value to be returned if values does not exist in remote config.
|
|
|
140 |
* @return Sampling rate used for the number of network request traces.
|
|
|
141 |
*/
|
|
|
142 |
- (float)networkRequestSamplingRateWithDefaultValue:(float)samplingRate;
|
|
|
143 |
|
|
|
144 |
#pragma mark - Session related configs.
|
|
|
145 |
|
|
|
146 |
/**
|
|
|
147 |
* Returns the sampling rate for sessions. A value of 1 means all the events must be sent to the
|
|
|
148 |
* backend. A value of 0 means, no data must be sent. Range [0-1]. A value of -1 means the value is
|
|
|
149 |
* not found.
|
|
|
150 |
* Name in remote config: "fpr_vc_session_sampling_rate"
|
|
|
151 |
*
|
|
|
152 |
* @param samplingRate Default value to be returned if values does not exist in remote config.
|
|
|
153 |
* @return Session sampling rate used for the number of sessions generated.
|
|
|
154 |
*/
|
|
|
155 |
- (float)sessionSamplingRateWithDefaultValue:(float)samplingRate;
|
|
|
156 |
|
|
|
157 |
/**
|
|
|
158 |
* Returns the frequency at which CPU usage is measured when the app is in foreground. Measured in
|
|
|
159 |
* milliseconds. Name in remote config: "fpr_session_gauge_cpu_capture_frequency_fg_ms"
|
|
|
160 |
*
|
|
|
161 |
* @param defaultFrequency Default value to be returned if values does not exist in remote config.
|
|
|
162 |
* @return Frequency at which CPU information is captured when app is in foreground.
|
|
|
163 |
*/
|
|
|
164 |
- (int)sessionGaugeCPUCaptureFrequencyInForegroundWithDefaultValue:(int)defaultFrequency;
|
|
|
165 |
|
|
|
166 |
/**
|
|
|
167 |
* Returns the frequency at which CPU usage is measured when the app is in background. Measured in
|
|
|
168 |
* milliseconds. Name in remote config: "fpr_session_gauge_cpu_capture_frequency_bg_ms"
|
|
|
169 |
*
|
|
|
170 |
* @param defaultFrequency Default value to be returned if values does not exist in remote config.
|
|
|
171 |
* @return Frequency at which CPU information is captured when app is in background.
|
|
|
172 |
*/
|
|
|
173 |
- (int)sessionGaugeCPUCaptureFrequencyInBackgroundWithDefaultValue:(int)defaultFrequency;
|
|
|
174 |
|
|
|
175 |
/**
|
|
|
176 |
* Returns the frequency at which memory usage is measured when the app is in foreground. Measured
|
|
|
177 |
* in milliseconds. Name in remote config: "fpr_session_gauge_memory_capture_frequency_fg_ms"
|
|
|
178 |
*
|
|
|
179 |
* @param defaultFrequency Default value to be returned if values does not exist in remote config.
|
|
|
180 |
* @return Frequency at which memory information is captured when app is in foreground.
|
|
|
181 |
*/
|
|
|
182 |
- (int)sessionGaugeMemoryCaptureFrequencyInForegroundWithDefaultValue:(int)defaultFrequency;
|
|
|
183 |
|
|
|
184 |
/**
|
|
|
185 |
* Returns the frequency at which memory usage is measured when the app is in background. Measured
|
|
|
186 |
* in milliseconds. Name in remote config: "fpr_session_gauge_memory_capture_frequency_bg_ms"
|
|
|
187 |
*
|
|
|
188 |
* @param defaultFrequency Default value to be returned if values does not exist in remote config.
|
|
|
189 |
* @return Frequency at which memory information is captured when app is in background.
|
|
|
190 |
*/
|
|
|
191 |
- (int)sessionGaugeMemoryCaptureFrequencyInBackgroundWithDefaultValue:(int)defaultFrequency;
|
|
|
192 |
|
|
|
193 |
/**
|
|
|
194 |
* Returns the maximum allowed duration for the length of a session. Measured in minutes.
|
|
|
195 |
* Name in remote config: "fpr_session_max_duration_min"
|
|
|
196 |
*
|
|
|
197 |
* @param maxDurationInMinutes Default value to be returned if values does not exist in remote
|
|
|
198 |
* config.
|
|
|
199 |
* @return Duration for which a sessions can be active.
|
|
|
200 |
*/
|
|
|
201 |
- (int)sessionMaxDurationWithDefaultValue:(int)maxDurationInMinutes;
|
|
|
202 |
|
|
|
203 |
@end
|