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

add metrics coroutine scope #6255

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jeddai
Copy link
Member

@jeddai jeddai commented May 28, 2024

Pull Request checklist

  • Breaking changes: This PR follows our breaking change policy
    • This PR follows the breaking change policy:
      • This PR has no breaking API changes, or
      • There are corresponding PRs for our consumer applications that resolve the breaking changes and have been approved
  • Quality: This PR builds and tests run cleanly
    • Note:
      • For changes that need extra cross-platform testing, consider adding [ci full] to the PR title.
      • If this pull request includes a breaking change, consider cutting a new release after merging.
  • Tests: This PR includes thorough tests or an explanation of why it does not
  • Changelog: This PR includes a changelog entry in CHANGELOG.md or an explanation of why it does not need one
    • Any breaking changes to Swift or Kotlin binding APIs are noted explicitly
  • Dependencies: This PR follows our dependency management guidelines
    • Any new dependencies are accompanied by a summary of the due diligence applied in selecting them.

Branch builds: add [firefox-android: branch-name] to the PR title.

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 50.85%. Comparing base (be2d22f) to head (2318e4e).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6255   +/-   ##
=======================================
  Coverage   50.85%   50.85%           
=======================================
  Files         112      112           
  Lines       11811    11811           
=======================================
  Hits         6006     6006           
  Misses       5805     5805           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@travis79 travis79 left a comment

Choose a reason for hiding this comment

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

One small code suggestion in-line. My biggest concern here is that this doesn't fundamentally change when the recording is happening by putting it into a serial coroutine scope. Glean is actually already doing this same thing with its internal dispatcher and I don't think that's going to prevent the need to load geckoview as soon as the coroutine scope executes the Job. You may be able to work around this with what you have by putting a blocking coroutine into your serial execution scope first, and have that coroutine wait on engine-gecko to load before it returns. Since you are using a serial executor, this should hold up any metric/glean interactions that are in the queue behind the "wait for gecko" Job until gecko (and Glean) are loaded.

}
recordExperimentTelemetryEvents(events)
recordExperimentTelemetryEvents(events!!)
Copy link
Member

Choose a reason for hiding this comment

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

I'd avoid the bang bang (!!) here, on the off chance that events was null this would throw an exception.
If you can try using the safe unwrap operators and patterns, I think it would avoid this altogether.

Suggested change
recordExperimentTelemetryEvents(events!!)
events?.let {
recordExperimentTelemetryEvents(it)
}

@jeddai
Copy link
Member Author

jeddai commented Jun 6, 2024

You may be able to work around this with what you have by putting a blocking coroutine into your serial execution scope first, and have that coroutine wait on engine-gecko to load before it returns

That was ultimately what I planned to do in the Fenix code, I'm just not familiar with the gecko parts of Fenix so I'm not sure what exactly I need to be blocking on.

@travis79
Copy link
Member

travis79 commented Jun 6, 2024

You may be able to work around this with what you have by putting a blocking coroutine into your serial execution scope first, and have that coroutine wait on engine-gecko to load before it returns

That was ultimately what I planned to do in the Fenix code, I'm just not familiar with the gecko parts of Fenix so I'm not sure what exactly I need to be blocking on.

That's probably best asked of the Fenix folks, but I think you should probably target something at the end of the "visual completeness queue" around here: https://searchfox.org/mozilla-central/source/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/FenixApplication.kt#459

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants