зеркало из https://github.com/mozilla/glean.git
Document the convenience function `measure`
[doc only]
This commit is contained in:
Родитель
46e90a97ac
Коммит
36207f27e8
|
@ -57,6 +57,14 @@ fun onLoginCancel() {
|
|||
}
|
||||
```
|
||||
|
||||
For convenience one can measure the time of a function or block of code:
|
||||
|
||||
```Kotlin
|
||||
Auth.loginTime.measure {
|
||||
// Process login flow
|
||||
}
|
||||
```
|
||||
|
||||
The time reported in the telemetry ping will be timespan recorded during the lifetime of the ping.
|
||||
|
||||
There are test APIs available too:
|
||||
|
@ -136,6 +144,14 @@ func onLoginCancel() {
|
|||
}
|
||||
```
|
||||
|
||||
For convenience one can measure the time of a function or block of code:
|
||||
|
||||
```Kotlin
|
||||
Auth.loginTime.measure {
|
||||
// Process login flow
|
||||
}
|
||||
```
|
||||
|
||||
The time reported in the telemetry ping will be timespan recorded during the lifetime of the ping.
|
||||
|
||||
There are test APIs available too:
|
||||
|
|
|
@ -69,6 +69,14 @@ fun onPageLoaded(e: Event) {
|
|||
}
|
||||
```
|
||||
|
||||
For convenience one can measure the time of a function or block of code:
|
||||
|
||||
```Kotlin
|
||||
Pages.pageLoad.measure {
|
||||
// Load a page
|
||||
}
|
||||
```
|
||||
|
||||
There are test APIs available too. For convenience, properties `sum` and `count` are exposed to facilitate validating that data was recorded correctly.
|
||||
|
||||
Continuing the `pageLoad` example above, at this point the metric should have a `sum == 11` and a `count == 2`:
|
||||
|
@ -152,6 +160,15 @@ func onPageLoaded() {
|
|||
}
|
||||
```
|
||||
|
||||
For convenience one can measure the time of a function or block of code:
|
||||
|
||||
```Swift
|
||||
Pages.pageLoad.measure {
|
||||
// Load a page
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
There are test APIs available too. For convenience, properties `sum` and `count` are exposed to facilitate validating that data was recorded correctly.
|
||||
|
||||
Continuing the `pageLoad` example above, at this point the metric should have a `sum == 11` and a `count == 2`:
|
||||
|
|
Загрузка…
Ссылка в новой задаче