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 |
NS_ASSUME_NONNULL_BEGIN
|
|
|
18 |
|
|
|
19 |
/**
|
|
|
20 |
* Different modes of prewarm-detection
|
|
|
21 |
* KeepNone = No app start events are allowed
|
|
|
22 |
* ActivePrewarm = Only detect prewarming using ActivePrewarm environment
|
|
|
23 |
* KeepAll = All app start events are allowed
|
|
|
24 |
*/
|
|
|
25 |
typedef NS_ENUM(NSInteger, PrewarmDetectionMode) {
|
|
|
26 |
PrewarmDetectionModeKeepNone = 0,
|
|
|
27 |
PrewarmDetectionModeActivePrewarm = 1,
|
|
|
28 |
PrewarmDetectionModeKeepAll = 2
|
|
|
29 |
};
|
|
|
30 |
|
|
|
31 |
/** A typedef for ensuring that config names are one of the below specified strings. */
|
|
|
32 |
typedef NSString* const FPRConfigName;
|
|
|
33 |
|
|
|
34 |
/**
|
|
|
35 |
* Class that manages the configurations used by firebase performance SDK. This class abstracts the
|
|
|
36 |
* configuration flags from different configuration sources.
|
|
|
37 |
*/
|
|
|
38 |
@interface FPRConfigurations : NSObject
|
|
|
39 |
|
|
|
40 |
/** Enables or disables performance data collection in the SDK. If the value is set to 'NO' none of
|
|
|
41 |
* the performance data will be sent to the server. Default is YES. */
|
|
|
42 |
@property(nonatomic, getter=isDataCollectionEnabled) BOOL dataCollectionEnabled;
|
|
|
43 |
|
|
|
44 |
/** The config KVC name string for the dataCollectionEnabled property. */
|
|
|
45 |
FOUNDATION_EXTERN FPRConfigName kFPRConfigDataCollectionEnabled;
|
|
|
46 |
|
|
|
47 |
/** Enables or disables instrumenting the app to collect performance data (like app start time,
|
|
|
48 |
* networking). Default is YES. */
|
|
|
49 |
@property(nonatomic, getter=isInstrumentationEnabled) BOOL instrumentationEnabled;
|
|
|
50 |
|
|
|
51 |
/** The config KVC name string for the instrumentationEnabled property. */
|
|
|
52 |
FOUNDATION_EXTERN FPRConfigName kFPRConfigInstrumentationEnabled;
|
|
|
53 |
|
|
|
54 |
/** Log source against which the Fireperf events are recorded. */
|
|
|
55 |
@property(nonatomic, readonly) int logSource;
|
|
|
56 |
|
|
|
57 |
/** Specifies if the SDK is enabled. */
|
|
|
58 |
@property(nonatomic, readonly) BOOL sdkEnabled;
|
|
|
59 |
|
|
|
60 |
/** Specifies if the diagnostic log messages should be enabled. */
|
|
|
61 |
@property(nonatomic, readonly) BOOL diagnosticsEnabled;
|
|
|
62 |
|
|
|
63 |
- (nullable instancetype)init NS_UNAVAILABLE;
|
|
|
64 |
|
|
|
65 |
/** Singleton instance of FPRConfigurations. */
|
|
|
66 |
+ (nullable instancetype)sharedInstance;
|
|
|
67 |
|
|
|
68 |
/**
|
|
|
69 |
* Updates all the configurations flags relevant to Firebase Performance.
|
|
|
70 |
*
|
|
|
71 |
* This call blocks until the update is done.
|
|
|
72 |
*/
|
|
|
73 |
- (void)update;
|
|
|
74 |
|
|
|
75 |
#pragma mark - Configuration fetcher methods.
|
|
|
76 |
|
|
|
77 |
/**
|
|
|
78 |
* Returns the mode that prewarm-detection should drop events in.
|
|
|
79 |
*
|
|
|
80 |
* @see PrewarmDetectionMode
|
|
|
81 |
* @return filter mode of app start traces prewarm-detection
|
|
|
82 |
*/
|
|
|
83 |
- (PrewarmDetectionMode)prewarmDetectionMode;
|
|
|
84 |
|
|
|
85 |
/**
|
|
|
86 |
* Returns the percentage of instances that would send trace events. Range [0-1].
|
|
|
87 |
*
|
|
|
88 |
* @return The percentage of instances that would send trace events.
|
|
|
89 |
*/
|
|
|
90 |
- (float)logTraceSamplingRate;
|
|
|
91 |
|
|
|
92 |
/**
|
|
|
93 |
* Returns the percentage of instances that would send network request events. Range [0-1].
|
|
|
94 |
*
|
|
|
95 |
* @return The percentage of instances that would send network request events.
|
|
|
96 |
*/
|
|
|
97 |
- (float)logNetworkSamplingRate;
|
|
|
98 |
|
|
|
99 |
/**
|
|
|
100 |
* Returns the foreground event count/burst size. This is the number of events that are allowed to
|
|
|
101 |
* flow in burst when the app is in foreground.
|
|
|
102 |
*
|
|
|
103 |
* @return The foreground event count as determined from configs.
|
|
|
104 |
*/
|
|
|
105 |
- (uint32_t)foregroundEventCount;
|
|
|
106 |
|
|
|
107 |
/**
|
|
|
108 |
* Returns the foreground time limit to allow the foreground event count. This is specified in
|
|
|
109 |
* number of minutes.
|
|
|
110 |
*
|
|
|
111 |
* @return The foreground event time limit as determined from configs.
|
|
|
112 |
*/
|
|
|
113 |
- (uint32_t)foregroundEventTimeLimit;
|
|
|
114 |
|
|
|
115 |
/**
|
|
|
116 |
* Returns the background event count/burst size. This is the number of events that are allowed to
|
|
|
117 |
* flow in burst when the app is in background.
|
|
|
118 |
*
|
|
|
119 |
* @return The background event count as determined from configs.
|
|
|
120 |
*/
|
|
|
121 |
- (uint32_t)backgroundEventCount;
|
|
|
122 |
|
|
|
123 |
/**
|
|
|
124 |
* Returns the background time limit to allow the background event count. This is specified in
|
|
|
125 |
* number of minutes.
|
|
|
126 |
*
|
|
|
127 |
* @return The background event time limit as determined from configs.
|
|
|
128 |
*/
|
|
|
129 |
- (uint32_t)backgroundEventTimeLimit;
|
|
|
130 |
|
|
|
131 |
/**
|
|
|
132 |
* Returns the foreground network event count/burst size. This is the number of network events that
|
|
|
133 |
* are allowed to flow in burst when the app is in foreground.
|
|
|
134 |
*
|
|
|
135 |
* @return The foreground network event count as determined from configs.
|
|
|
136 |
*/
|
|
|
137 |
- (uint32_t)foregroundNetworkEventCount;
|
|
|
138 |
|
|
|
139 |
/**
|
|
|
140 |
* Returns the foreground time limit to allow the foreground network event count. This is specified
|
|
|
141 |
* in number of minutes.
|
|
|
142 |
*
|
|
|
143 |
* @return The foreground network event time limit as determined from configs.
|
|
|
144 |
*/
|
|
|
145 |
- (uint32_t)foregroundNetworkEventTimeLimit;
|
|
|
146 |
|
|
|
147 |
/**
|
|
|
148 |
* Returns the background network event count/burst size. This is the number of network events that
|
|
|
149 |
* are allowed to flow in burst when the app is in background.
|
|
|
150 |
*
|
|
|
151 |
* @return The background network event count as determined from configs.
|
|
|
152 |
*/
|
|
|
153 |
- (uint32_t)backgroundNetworkEventCount;
|
|
|
154 |
|
|
|
155 |
/**
|
|
|
156 |
* Returns the background time limit to allow the background network event count. This is specified
|
|
|
157 |
* in number of minutes.
|
|
|
158 |
*
|
|
|
159 |
* @return The background network event time limit as determined from configs.
|
|
|
160 |
*/
|
|
|
161 |
- (uint32_t)backgroundNetworkEventTimeLimit;
|
|
|
162 |
|
|
|
163 |
/**
|
|
|
164 |
* Returns a float specifying the percentage of device instances on which session feature is
|
|
|
165 |
* enabled. Range [0-100].
|
|
|
166 |
*
|
|
|
167 |
* @return The percentage of devices on which session feature should be enabled.
|
|
|
168 |
*/
|
|
|
169 |
- (float_t)sessionsSamplingPercentage;
|
|
|
170 |
|
|
|
171 |
/**
|
|
|
172 |
* Returns the maximum length of a session in minutes. Default is 240 minutes.
|
|
|
173 |
*
|
|
|
174 |
* @return Maximum allowed length of the session in minutes.
|
|
|
175 |
*/
|
|
|
176 |
- (uint32_t)maxSessionLengthInMinutes;
|
|
|
177 |
|
|
|
178 |
/**
|
|
|
179 |
* Returns the frequency at which the CPU usage metrics are to be collected when the app is in the
|
|
|
180 |
* foreground. Frequency is specified in milliseconds. A value of '0' means do not capture.
|
|
|
181 |
*
|
|
|
182 |
* @return An integer value specifying the frequency of capture in milliseconds.
|
|
|
183 |
*/
|
|
|
184 |
- (uint32_t)cpuSamplingFrequencyInForegroundInMS;
|
|
|
185 |
|
|
|
186 |
/**
|
|
|
187 |
* Returns the frequency at which the CPU usage metrics are to be collected when the app is in the
|
|
|
188 |
* background. Frequency is specified in milliseconds. A value of '0' means do not capture.
|
|
|
189 |
*
|
|
|
190 |
* @return An integer value specifying the frequency of capture in milliseconds.
|
|
|
191 |
*/
|
|
|
192 |
- (uint32_t)cpuSamplingFrequencyInBackgroundInMS;
|
|
|
193 |
|
|
|
194 |
/**
|
|
|
195 |
* Returns the frequency at which the memory usage metrics are to be collected when the app is in
|
|
|
196 |
* the foreground. Frequency is specified in milliseconds. A value of '0' means do not capture.
|
|
|
197 |
*
|
|
|
198 |
* @return An integer value specifying the frequency of capture in milliseconds.
|
|
|
199 |
*/
|
|
|
200 |
- (uint32_t)memorySamplingFrequencyInForegroundInMS;
|
|
|
201 |
|
|
|
202 |
/**
|
|
|
203 |
* Returns the frequency at which the memory usage metrics are to be collected when the app is in
|
|
|
204 |
* the background. Frequency is specified in milliseconds. A value of '0' means do not capture.
|
|
|
205 |
*
|
|
|
206 |
* @return An integer value specifying the frequency of capture in milliseconds.
|
|
|
207 |
*/
|
|
|
208 |
- (uint32_t)memorySamplingFrequencyInBackgroundInMS;
|
|
|
209 |
|
|
|
210 |
@end
|
|
|
211 |
|
|
|
212 |
NS_ASSUME_NONNULL_END
|