Merge pull request #1564 from mozilla/1699653-measure-nicety

Bug 1699653 - Document the convenience function `measure`
This commit is contained in:
Jan-Erik Rediger 2021-03-22 14:39:56 +01:00 коммит произвёл GitHub
Родитель 6589f155d1 36207f27e8
Коммит 9395cae33d
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 33 добавлений и 0 удалений

Просмотреть файл

@ -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`: