-
Notifications
You must be signed in to change notification settings - Fork 257
RMST-299: Add support for Glean Telemetry in Remote Settings client #7288
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
Open
leplatrem
wants to merge
20
commits into
main
Choose a base branch
from
rmst-299
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
929329f
Import metrics YAML
leplatrem 35e9f57
Add telemetry module
leplatrem efcd64e
Leverage Telemetry in client
leplatrem 379badd
@acottner review
leplatrem 061d52a
Fix comment
leplatrem bdeaabe
Add tests
leplatrem 0ce04c3
Improve tests readability
leplatrem 5b0501d
Do not send whole error str, only type name
leplatrem ecc2e3a
Test and fix for signature errors
leplatrem d71d24a
Merge remote-tracking branch 'origin/main' into rmst-299
leplatrem 0b2bb38
Remove logins.db fixture file
leplatrem b32c916
Rename and rework types to make Android integration more natural
leplatrem 6cd7cf4
Publish the Kotlin wrapper for Telemetry
leplatrem 28f2fcb
Try add envs plugin
leplatrem b249cec
Revert "Remove logins.db fixture file"
leplatrem 7dc31fd
ktlint format
leplatrem 8a18d0b
More klint formatting
leplatrem d39f463
Guess glean generated code
leplatrem 28dc0f9
Adjust interface types and imports
leplatrem f49369f
glean does some casing magics
leplatrem File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
...emote_settings/android/src/main/java/mozilla/appservices/remotesettings/GleanTelemetry.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| /* This Source Code Form is subject to the terms of the Mozilla Public | ||
| * License, v. 2.0. If a copy of the MPL was not distributed with this | ||
| * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
|
||
| package mozilla.appservices.remotesettings | ||
|
|
||
| import mozilla.appservices.remotesettings.RemoteSettingsTelemetry | ||
| import mozilla.appservices.remotesettings.UptakeEventExtras | ||
| import org.mozilla.appservices.remotesettings.GleanMetrics.RemoteSettings as RSMetrics | ||
|
|
||
| /** | ||
| * GleanTelemetry is a thin wrapper used to expose | ||
| * callbacks used to emit telemetry events to Glean. | ||
| */ | ||
| class GleanTelemetry : RemoteSettingsTelemetry { | ||
| override fun reportUptake(extras: UptakeEventExtras) { | ||
| RSMetrics.uptakeRemotesettings.record( | ||
| RSMetrics.UptakeRemotesettingsExtra( | ||
| value = extras.value, | ||
| source = extras.source, | ||
| age = extras.age, | ||
| trigger = extras.trigger, | ||
| timestamp = extras.timestamp, | ||
| duration = extras.duration, | ||
| errorname = extras.errorName, | ||
| ), | ||
| ) | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| # This Source Code Form is subject to the terms of the Mozilla Public | ||
| # License, v. 2.0. If a copy of the MPL was not distributed with this | ||
| # file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
|
||
| # This file defines the metrics that will be gathered for the Remote Settings | ||
| # component. Changes to these metrics require data review. | ||
| # | ||
| # We can't record metrics from Rust directly. To work around that we: | ||
| # - Define the metrics in application-services | ||
| # - Define API calls in application-services that return the metrics | ||
| # alongside the normal results. | ||
| # - Record the metrics with Glean in the consumer code | ||
|
|
||
| --- | ||
| $schema: moz://mozilla.org/schemas/glean/metrics/2-0-0 | ||
|
|
||
| remote_settings: | ||
| uptake_remotesettings: | ||
| type: event | ||
| disabled: true # To be controlled by server knobs due to expected high volume | ||
| description: > | ||
| Was the remote content successfully pulled? This uptake telemetry | ||
| allows to monitor the behaviour of our clients when it comes to | ||
| fetching data from remote servers. | ||
| See https://searchfox.org/firefox-main/rev/1427c8863/services/common/metrics.yaml | ||
| extra_keys: | ||
| value: | ||
| description: The synchronization status (success, up_to_date, sync_error, ...) | ||
| type: string | ||
| source: | ||
| description: > | ||
| A label to distinguish what is being pulled or updated in the component (eg. recipe id, settings collection name, ...). | ||
| type: string | ||
| duration: | ||
| description: The duration of the synchronization process in milliseconds. | ||
| type: string | ||
| errorName: | ||
| description: An optional string with the error name attribute in case of failure. | ||
| type: string | ||
| trigger: | ||
| description: > | ||
| A label to distinguish what triggered the polling/fetching of remote content (eg. "broadcast", "timer", "forced", "manual") | ||
| type: string | ||
| age: | ||
| description: > | ||
| The age of pulled data in seconds (ie. difference between publication time and fetch time). | ||
| type: string | ||
| timestamp: | ||
| description: > | ||
| The current timestamp, received during synchronization. | ||
| type: string | ||
| bugs: &uptake_remotecontent_result_uptake_bugs | ||
| - https://bugzil.la/1517469 | ||
| - https://bugzil.la/1617133 | ||
| data_reviews: *uptake_remotecontent_result_uptake_bugs | ||
| notification_emails: &uptake_remotecontent_result_uptake_emails | ||
| - mleplatre@mozilla.com | ||
| - acottner@mozilla.com | ||
| data_sensitivity: | ||
| - technical | ||
| expires: never | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Is this file even required?
Since technically the telemetry is done in consuming components (eg. kotlin)
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's required if you want to check in the Kotlin code in app-services to implement the metrics (e.g. you could define a
RemoteSettingsTelemetryimplementation that firefox-android could use). Also you might want to use this PR for data review. If neither of those is true, then I don't think it's needed.