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 "FirebasePerformance/Sources/Public/FirebasePerformance/FIRTrace.h"
|
|
|
16 |
|
|
|
17 |
FOUNDATION_EXTERN NSString *__nonnull const kFPRAppStartTraceName;
|
|
|
18 |
FOUNDATION_EXTERN NSString *__nonnull const kFPRAppStartStageNameTimeToUI;
|
|
|
19 |
FOUNDATION_EXTERN NSString *__nonnull const kFPRAppStartStageNameTimeToFirstDraw;
|
|
|
20 |
FOUNDATION_EXTERN NSString *__nonnull const kFPRAppStartStageNameTimeToUserInteraction;
|
|
|
21 |
FOUNDATION_EXTERN NSString *__nonnull const kFPRAppTraceNameForegroundSession;
|
|
|
22 |
FOUNDATION_EXTERN NSString *__nonnull const kFPRAppTraceNameBackgroundSession;
|
|
|
23 |
FOUNDATION_EXTERN NSString *__nonnull const kFPRAppCounterNameTraceEventsRateLimited;
|
|
|
24 |
FOUNDATION_EXTERN NSString *__nonnull const kFPRAppCounterNameNetworkTraceEventsRateLimited;
|
|
|
25 |
FOUNDATION_EXTERN NSString *__nonnull const kFPRAppCounterNameTraceNotStopped;
|
|
|
26 |
|
|
|
27 |
/** Different states of the current application. */
|
|
|
28 |
typedef NS_ENUM(NSInteger, FPRApplicationState) {
|
|
|
29 |
FPRApplicationStateUnknown,
|
|
|
30 |
|
|
|
31 |
/** Application in foreground. */
|
|
|
32 |
FPRApplicationStateForeground,
|
|
|
33 |
|
|
|
34 |
/** Application in background. */
|
|
|
35 |
FPRApplicationStateBackground,
|
|
|
36 |
};
|
|
|
37 |
|
|
|
38 |
/** This class is used to track the app activity and create internal traces to capture the
|
|
|
39 |
* performance metrics.
|
|
|
40 |
*/
|
|
|
41 |
NS_EXTENSION_UNAVAILABLE("Firebase Performance is not supported for extensions.")
|
|
|
42 |
@interface FPRAppActivityTracker : NSObject
|
|
|
43 |
|
|
|
44 |
/** The trace that tracks the currently active session of the app. *Do not stop this trace*. This is
|
|
|
45 |
* an active trace that needs to be running. Stopping this trace might impact the overall
|
|
|
46 |
* performance metrics captured for the active session. All other operations can be performed.
|
|
|
47 |
*/
|
|
|
48 |
@property(nonatomic, nullable, readonly) FIRTrace *activeTrace;
|
|
|
49 |
|
|
|
50 |
/** Current running state of the application. */
|
|
|
51 |
@property(nonatomic, readonly) FPRApplicationState applicationState;
|
|
|
52 |
|
|
|
53 |
/** Accesses the singleton instance.
|
|
|
54 |
* @return Reference to the shared object if successful; <code>nil</code> if not.
|
|
|
55 |
*/
|
|
|
56 |
+ (nullable instancetype)sharedInstance;
|
|
|
57 |
|
|
|
58 |
- (nullable instancetype)init NS_UNAVAILABLE;
|
|
|
59 |
|
|
|
60 |
@end
|