Skip to content
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

feat: add metrics for sync engine slow and incremental - RC (WPB-11199) #3090

Merged
merged 1 commit into from
Nov 7, 2024

Conversation

yamilmedina
Copy link
Contributor

@yamilmedina yamilmedina commented Nov 5, 2024

StoryWPB-11199 [Android] add Datadog state for sync job start and stop and how much time it took

Cherry-pick of:



PR Submission Checklist for internal contributors

  • The PR Title

    • conforms to the style of semantic commits messages¹ supported in Wire's Github Workflow²
    • contains a reference JIRA issue number like SQPIT-764
    • answers the question: If merged, this PR will: ... ³
  • The PR Description

    • is free of optional paragraphs and you have filled the relevant parts to the best of your ability

What's new in this PR?

Issues

We are somehow blind in some places regarding sync

Causes (Optional)

Difficulty to troubleshoot sync problems, and no metrics regarding this, like we have in other places for example for events.

Solutions

  • Create a wrapper class for handling formatted logs for sync manager
  • Adds metrics handling data, like id and duration of sync jobs
  • Call from Slow and Incremental sync to these logs
  • Incremental sync needs to handle foreground case and background cases, that's why the state change handles the ids and started time of job across coroutine collections using .runningFold

Testing

Test Coverage (Optional)

  • I have added automated test to this contribution

How to Test

Interact with the app and see logs formatted in Datadog (not available if you don't have local setup of credentials)

Notes (Optional)

Dashboards in DD will follow.
https://app.datadoghq.eu/dashboard/crc-suh-fq6/android-sync-manager-performance?fromUser=false&refresh_mode=sliding&from_ts=1730463823807&to_ts=1730478223807&live=true


PR Post Submission Checklist for internal contributors (Optional)

  • Wire's Github Workflow has automatically linked the PR to a JIRA issue

PR Post Merge Checklist for internal contributors

  • If any soft of configuration variable was introduced by this PR, it has been added to the relevant documents and the CI jobs have been updated.

References
  1. https://sparkbox.com/foundry/semantic_commit_messages
  2. https://github.com/wireapp/.github#usage
  3. E.g. feat(conversation-list): Sort conversations by most emojis in the title #SQPIT-764.

…3086)

* feat: add base for metrics, implement in slow sync

* feat: add base for metrics, implement in slow sync

* feat: add metrics for slow sync and improve json log

* feat: incremental sync logs

* feat: incremental sync logs

* feat: incremental sync logs, improv for foreground

* feat: refactor some naming to clarify

* feat: refactor some naming to clarify

* feat: docs
Copy link

sonarqubecloud bot commented Nov 5, 2024

@yamilmedina yamilmedina enabled auto-merge November 5, 2024 17:16
Copy link
Contributor

github-actions bot commented Nov 5, 2024

Test Results

0 tests   - 3 252   0 ✅  - 3 145   0s ⏱️ - 4m 9s
0 suites  -   555   0 💤  -   107 
0 files    -   555   0 ❌ ±    0 

Results for commit ec50a87. ± Comparison against base commit 85c189c.

♻️ This comment has been updated with latest results.

@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 95.45455% with 2 lines in your changes missing coverage. Please review.

Project coverage is 52.60%. Comparing base (85c189c) to head (ec50a87).

Files with missing lines Patch % Lines
...in/com/wire/kalium/logic/sync/SyncManagerLogger.kt 93.93% 2 Missing ⚠️
Additional details and impacted files
@@                  Coverage Diff                  @@
##           release/candidate    #3090      +/-   ##
=====================================================
+ Coverage              52.57%   52.60%   +0.03%     
=====================================================
  Files                   1319     1320       +1     
  Lines                  51475    51515      +40     
  Branches                4778     4779       +1     
=====================================================
+ Hits                   27065    27102      +37     
- Misses                 22449    22451       +2     
- Partials                1961     1962       +1     
Files with missing lines Coverage Δ
...m/logic/sync/incremental/IncrementalSyncManager.kt 86.59% <100.00%> (+0.57%) ⬆️
...com/wire/kalium/logic/sync/slow/SlowSyncManager.kt 95.18% <100.00%> (+0.18%) ⬆️
...in/com/wire/kalium/logic/sync/SyncManagerLogger.kt 93.93% <93.93%> (ø)

... and 1 file with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 85c189c...ec50a87. Read the comment docs.

@datadog-wireapp
Copy link

Datadog Report

Branch report: feat/add-metrics-sync-engine-rc
Commit report: 0846f98
Test service: kalium-jvm

✅ 0 Failed, 3145 Passed, 107 Skipped, 30.89s Total Time

Comment on lines +79 to +82
internal enum class SyncStatus {
STARTED,
COMPLETED
}
Copy link
Member

Choose a reason for hiding this comment

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

No failed status ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup, we don't need for the metrics we want to get, and as well the job cancellation (coroutine failure) can happen in another layer different from this.

What we want to achieve with this, is to measure and answer the questions:

  • How much it takes to perform a sync? By type
  • How many syncs started and never ended ? (this is the path we are trying to investigate and includes implicitly failures as well)

@yamilmedina yamilmedina added this pull request to the merge queue Nov 7, 2024
Merged via the queue into release/candidate with commit b7bdcea Nov 7, 2024
21 checks passed
@yamilmedina yamilmedina deleted the feat/add-metrics-sync-engine-rc branch November 7, 2024 08:11
@echoes-hq echoes-hq bot added the echoes: unplanned Any work item that isn’t part of the product or technical roadmap. label Nov 7, 2024
@MohamadJaara MohamadJaara added echoes: technical-roadmap Work contributing to the Technical Roadmap, to improve our velocity or reduce the technical debt. and removed echoes: unplanned Any work item that isn’t part of the product or technical roadmap. labels Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DO NOT CHERRY PICK echoes: technical-roadmap Work contributing to the Technical Roadmap, to improve our velocity or reduce the technical debt. 👕 size: M type: feature ✨
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants