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 listener for tracking event emitted signal #305

Closed

Conversation

Ian2012
Copy link
Contributor

@Ian2012 Ian2012 commented Jun 5, 2023

Description: Add consumer code for the TRACKING_EVENT_EMITTED signal openedx/openedx-events#230

Dependencies: openedx/openedx-events#230, openedx/event-tracking#225

Merge deadline:

Installation instructions: List any non-trivial installation
instructions.

Testing instructions:

  1. Open page A
  2. Do thing B
  3. Expect C to happen
  4. If D happened instead - check failed.

Merge checklist:

  • All reviewers approved
  • CI build is green
  • Version bumped
  • Changelog record added
  • Documentation updated (not only docstrings)
  • Commits are squashed

Post merge:

  • Create a tag
  • Check new version is pushed to PyPI after tag-triggered build is
    finished.

Author concerns: List any concerns about this PR - inelegant
solutions, hacks, quick-and-dirty implementations, concerns about
migrations, etc.

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Jun 5, 2023
@openedx-webhooks
Copy link

openedx-webhooks commented Jun 5, 2023

Thanks for the pull request, @Ian2012! Please note that it may take us up to several weeks or months to complete a review and merge your PR.

Feel free to add as much of the following information to the ticket as you can:

  • supporting documentation
  • Open edX discussion forum threads
  • timeline information ("this must be merged by XX date", and why that is)
  • partner information ("this is a course on edx.org")
  • any other information that can help Product understand the context for the PR

All technical communication about the code itself will be done via the GitHub pull request interface. As a reminder, our process documentation is here.

This is currently a draft pull request. When it is ready for our review and all tests are green, click "Ready for Review", or remove "WIP" from the title, as appropriate.

@Ian2012 Ian2012 force-pushed the cag/add-consumer-for-tracking-logs branch from 51656fa to f420d7d Compare June 5, 2023 21:46
@Ian2012 Ian2012 changed the title feat: add consumer for tracking event emitted signal feat: add listener for tracking event emitted signal Jun 5, 2023
@Ian2012 Ian2012 force-pushed the cag/add-consumer-for-tracking-logs branch from f420d7d to f103064 Compare June 5, 2023 21:47
"""
event = kwargs['tracking_log']

## TODO: Should we ignore events that we don't care about here or in the event routing backend config?
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@bmtcril Please read my comments

Copy link
Contributor

Choose a reason for hiding this comment

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

It's possible to ignore events at the tracking log configuration level, which may be enough for this and is probably better for overall system performance.

Comment on lines +35 to +42
#if SEND_TRACKING_EVENT_EMITTED_SIGNAL.is_enabled():
# get_producer().send(
# signal=TRACKING_EVENT_EMITTED,
# topic='analytics',
# event_key_field='tracking_log.name',
# event_data={'tracking_log': kwargs['tracking_log']},
# event_metadata=kwargs['metadata']
# )
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@bmtcril I guess we would need to write the code for the event-bus consumer, but how will we send queued events in batch to the event bus?

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think there's any additional code needed for the consumer. Running the consume_events command inside a configured edx-platform container will read events off the event bus and fire off this signal for events that match. The batching capability is in my current PR: https://github.com/openedx/event-routing-backends/pull/301/files#diff-f24cf45168ff0c054647f2bf8c504fef13b9acf37fd97eedfd7410cc61c06458R112

You would need to create an EventsRouter with the processors defined in configuration just like the AsyncRouter does (note: not like the management command does, it does not use the processors). Then you can call bulk_send on that and it will find all of the configured LRSs and POST the batch to them.

@robrap robrap added the waiting on author PR author needs to resolve review requests, answer questions, fix tests, etc. label Sep 26, 2023
@mphilbrick211
Copy link

Hi @Ian2012! Just checking in to see if you plan to pursue this pull request?

@mphilbrick211 mphilbrick211 added the inactive PR author has been unresponsive for several months label Oct 3, 2023
@mphilbrick211 mphilbrick211 added closed inactivity PR was closed because the author abandoned it and removed waiting on author PR author needs to resolve review requests, answer questions, fix tests, etc. inactive PR author has been unresponsive for several months labels Oct 24, 2023
@mphilbrick211
Copy link

Closing this due to inactivity.

@openedx-webhooks
Copy link

@Ian2012 Even though your pull request wasn’t merged, please take a moment to answer a two question survey so we can improve your experience in the future.

1 similar comment
@openedx-webhooks
Copy link

@Ian2012 Even though your pull request wasn’t merged, please take a moment to answer a two question survey so we can improve your experience in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed inactivity PR was closed because the author abandoned it open-source-contribution PR author is not from Axim or 2U
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants