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

for MPP-3755: use Thread to send event data to GA async #4633

Merged
merged 2 commits into from
Apr 23, 2024

Conversation

groovecoder
Copy link
Member

@groovecoder groovecoder commented Apr 22, 2024

This PR is for #MPP-3755.

How to test:

  1. Run pytest
  2. Inspect the Relay extension to capture a network request to /metrics-event endpoint
  3. Use the "Copy as cURL" command to copy it
  4. Paste the curl command to your command-line
  5. Change the https://relay.firefox.com to http://127.0.0.1:8000
    • It should work!

Checklist:

  • [x] l10n changes have been submitted to the l10n repository, if any.
  • I've added a unit test to test for potential regressions of this bug.
  • [x] I've added or updated relevant docs in the docs/ directory.
  • [x] All UI revisions follow the coding standards, and use Protocol tokens where applicable (see /frontend/src/styles/tokens.scss).
  • Commits in this PR are minimal and have descriptive commit messages.

@jwhitlock
Copy link
Member

I verified this locally with curl -v http://127.0.0.1:8000/metrics-event --json '{"ga_uuid": "test"}'. The view returns, and then the thread runs and sends the message.

It did not run in pytest, because it doesn't have a chance while all the tests are running, and daemon threads are terminated even if not completed. I considered some options, and decided to mock the thread entirely and call the function on thread.start. This allows normal test assertions.

Copy link
Member

@jwhitlock jwhitlock left a comment

Choose a reason for hiding this comment

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

Thanks @groovecoder. Feel free to review my changes and merge when ready.

Copy link
Member Author

@groovecoder groovecoder left a comment

Choose a reason for hiding this comment

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

Great, thanks for the extra testing!

@groovecoder groovecoder added this pull request to the merge queue Apr 23, 2024
Merged via the queue into main with commit b1c96b0 Apr 23, 2024
28 checks passed
@groovecoder groovecoder deleted the make-metrics-event-async-mpp-3755 branch April 23, 2024 16:42
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.

2 participants