-
Notifications
You must be signed in to change notification settings - Fork 731
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add metrics plugin to track device download keys task #7438
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few comments
*/ | ||
@OptIn(ExperimentalContracts::class) | ||
inline fun <T> measureMetric(metricMeasurementPlugins: List<MetricPlugin>, block: () -> T): T { | ||
contract { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's contract? Do we really need it (i can see it's experimental)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is basically a way to tell the compiler about how the function behaves. Sometimes the compiler doesn't know or is not fully aware of certain conditions or returns. So you can specify an effect when a function is invoked to help the compiler.
In our case, it allows us to write this code:
val response: KeysQueryResponse
measureMetric(plugin) {
response = block() // this won't be possible without contracts.
}
...-android/src/main/java/org/matrix/android/sdk/api/metrics/DownloadDeviceKeysMetricsPlugin.kt
Outdated
Show resolved
Hide resolved
matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/extensions/MetricsExtensions.kt
Outdated
Show resolved
Hide resolved
vector-app/src/main/java/im/vector/app/core/di/SingletonModule.kt
Outdated
Show resolved
Hide resolved
vector/src/main/java/im/vector/app/features/analytics/metrics/VectorPlugins.kt
Show resolved
Hide resolved
SonarCloud Quality Gate failed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Type of change
Content
MetricsPlugin
is added which is implemented byVectorMetricsPlugin
.Motivation and context
download_device_keys
is one of such metrics.Tests
download_device_keys
increasing here.Tested devices
Checklist
- [ ] UI change has been tested on both light and dark themes- [ ] Accessibility has been taken into account. See https://github.com/vector-im/element-android/blob/develop/CONTRIBUTING.md#accessibility- [ ] Pull request includes screenshots or videos if containing UI changes- [ ] Pull request includes a sign off- [ ] If you have modified the screen flow, or added new screens to the application, you have updated the test UiAllScreensSanityTest.allScreensTest()