forked from GitLiveApp/firebase-kotlin-sdk
-
Notifications
You must be signed in to change notification settings - Fork 1
/
performance.kt
71 lines (64 loc) · 2.93 KB
/
performance.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package dev.gitlive.firebase.perf
import dev.gitlive.firebase.Firebase
import dev.gitlive.firebase.FirebaseApp
import dev.gitlive.firebase.FirebaseException
import dev.gitlive.firebase.perf.metrics.Trace
/** Returns the [FirebasePerformance] instance of the default [FirebaseApp]. */
public expect val Firebase.performance: FirebasePerformance
/** Returns the [FirebasePerformance] instance of a given [FirebaseApp]. */
public expect fun Firebase.performance(app: FirebaseApp): FirebasePerformance
/**
* The Firebase Performance Monitoring API.
*
* It is automatically initialized by FirebaseApp.
*
* This SDK uses FirebaseInstallations to identify the app instance and periodically sends data
* to the Firebase backend. To stop sending performance events, call [setPerformanceCollectionEnabled] with value [false].
*/
public expect class FirebasePerformance {
/**
* Creates a Trace object with given name.
*
* @param traceName name of the trace, requires no leading or trailing whitespace, no leading
* underscore '_' character.
* @return the new Trace object.
*/
public fun newTrace(traceName: String): Trace
/**
* Determines whether performance monitoring is enabled or disabled. This respects the Firebase
* Performance specific values first, and if these aren't set, uses the Firebase wide data
* collection switch.
*
* @return true if performance monitoring is enabled and false if performance monitoring is
* disabled. This is for dynamic enable/disable state. This does not reflect whether
* instrumentation is enabled/disabled in Gradle properties.
*/
public fun isPerformanceCollectionEnabled(): Boolean
/**
* Enables or disables performance monitoring. This setting is persisted and applied on future
* invocations of your application. By default, performance monitoring is enabled. If you need to
* change the default (for example, because you want to prompt the user before collecting
* performance stats), add:
*
* `<meta-data android:name=firebase_performance_collection_enabled android:value=false />`
*
* to your application’s manifest. Changing the value during runtime will override the manifest
* value.
*
* If you want to permanently disable sending performance metrics, add
*
* `<meta-data android:name="firebase_performance_collection_deactivated" android:value="true" />`
*
* to your application's manifest. Changing the value during runtime will not override the
* manifest value.
*
* This is separate from enabling/disabling instrumentation in Gradle properties.
*
* @param enable Should performance monitoring be enabled
*/
public fun setPerformanceCollectionEnabled(enable: Boolean)
}
/**
* Exception that gets thrown when an operation on Firebase Performance fails.
*/
public expect open class FirebasePerformanceException : FirebaseException