Skip to content
This repository has been archived by the owner on Dec 14, 2021. It is now read-only.

Sync telemetry #1090

Merged
merged 4 commits into from Oct 24, 2019
Merged

Sync telemetry #1090

merged 4 commits into from Oct 24, 2019

Conversation

joeyg
Copy link
Contributor

@joeyg joeyg commented Jul 27, 2019

@joeyg joeyg requested a review from a team as a code owner July 27, 2019 04:28
@joeyg joeyg self-assigned this Jul 27, 2019
@joeyg joeyg added this to In Progress in Lockwise Mobile via automation Jul 27, 2019
Copy link

@eliserichards eliserichards left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Is there any sort of documentation around the telemetry stuff for iOS? I'm going to see if I can hunt it down if it exists...

@irrationalagent
Copy link
Contributor

@eliserichards here is some docs I'll review this today as well.

Copy link
Contributor

@irrationalagent irrationalagent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How difficult would it be to generate a random "sync_id" for each sync and include that in all sync-related events? would make analyzing success/failure on a per-sync basis easier.

barring that, i believe we would still have at most one sync end or sync timeout event per sync start event, correct?

case .reset:
return .reset
case .sync:
return .sync
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

given that there is also sync timeout end and error, should this be sync start or similar?

return id
case .touch(let id):
return "ID: \(id)"
case .syncError(let error):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

according the telemetry library there is a max string length of 50 https://github.com/mozilla-mobile/telemetry-ios/blob/aac1e1873134ea69f992e3bbc45b431d6564d64c/Telemetry/TelemetryEvent.swift#L8 its unclear to me what would happen if we pass it something longer,e.g. if an error message is really long

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The message is truncated.

@jhugman jhugman self-requested a review August 12, 2019 12:39
Copy link
Contributor

@jhugman jhugman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand that you're using Actions in a way we haven't done previously, in order to leverage the existing Telemetry machinery.

This is okay, but feels somewhat hacky. The right way to do this would be to make the telemetry machinery listen to the datastore sync state and log something there — we already have a TimedOut sync state.

Given this may be additionally machinery to add another alternative would be to make the actions change the state of the datastore: check the sync status isn't .Synced, dispatch a .Timeout action, then make the datastore respond to that action by syncStatus.accept(.Timeout).

Incidentally, the android version appears to use exactly your implementation.

For exediency, I'm going to raise a tech-debt issue for this, but approve this.

@@ -16,6 +16,59 @@ enum DataStoreAction: Action {
case sync
case touch(id: String)
case delete(id: String)
case syncEnd
case syncTimeout(error: String)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Do we need to have an error message for syncTimeout?

return id
case .touch(let id):
return "ID: \(id)"
case .syncError(let error):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The message is truncated.

@@ -257,17 +259,20 @@ extension BaseDataStore {
if (self.syncSubject.value != .Synced) {
self.syncSubject.accept(.TimedOut)
self.dispatcher.dispatch(action: SentryAction(title: "Sync timeout without error", error: nil, line: ""))
self.dispatcher.dispatch(action: DataStoreAction.syncTimeout(error: ""))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I see what is happening. Hmm. I don't think I like this. I'll expand further.

@kaylagalway kaylagalway merged commit 12c577f into master Oct 24, 2019
@sandysage sandysage moved this from In Progress to Done in Lockwise Mobile Oct 28, 2019
@kaylagalway kaylagalway deleted the sync-telemetry branch November 20, 2019 17:52
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

None yet

5 participants