Skip to content

feat(notification-center): Added LogEvent notification and integration. #197

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

Merged
merged 4 commits into from
Sep 6, 2019

Conversation

rashidsp
Copy link
Contributor

Summary

  • Introduced LogEvent notification in notification_center.rb.
  • Integrated it in batch_event_dispatcher.rb and forwarding_event_processor.rb.
  • Added notification_count in notification_center.rb and integrated into Optimizely for notification types ACTIVATE and TRACK.

Test plan

  • Added unit tests for LogEvent in notification_center_spec.rb, batch_event_dispatcher_spec.rb and forwarding_event_processor_spec.rb.
  • Updated Optimizely's unit tests for LogEvent and notification_count.

@coveralls
Copy link

coveralls commented Aug 29, 2019

Coverage Status

Coverage increased (+0.02%) to 99.441% when pulling 4375ff7 on rashid/Batch-EP-add-logEvent into 2df63ad on master.

NotificationCenter::NOTIFICATION_TYPES[:TRACK],
event_key, user_id, attributes, event_tags, log_event
)
if @notification_center.notification_count(NotificationCenter::NOTIFICATION_TYPES[:TRACK]).positive?
Copy link

Choose a reason for hiding this comment

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

What do we gain by checking notification count, as opposed to just sending notifications regardless of count?

Copy link
Contributor Author

@rashidsp rashidsp Sep 5, 2019

Choose a reason for hiding this comment

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

This validates that the listener has already been added before sending the notification.
Please view java-sdk as a reference: https://github.com/optimizely/java-sdk/blob/master/core-api/src/main/java/com/optimizely/ab/Optimizely.java#L304

@@ -36,10 +36,11 @@ class BatchEventProcessor < EventProcessor

def initialize(
event_queue: SizedQueue.new(DEFAULT_QUEUE_CAPACITY),
event_dispatcher:,
event_dispatcher: Optimizely::EventDispatcher.new,
Copy link

Choose a reason for hiding this comment

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

Why are we adding a default value here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is not related to LogEvent, therefore moved to PR: #200

@@ -144,6 +151,16 @@ def run

add_to_batch(item) if item.is_a? Optimizely::UserEvent
end
rescue SignalException
Copy link

Choose a reason for hiding this comment

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

This seems like an important change, but it isn't discussed in the summary. Could you explain this change? If this isn't related to LogEvent notification, then I think it should be in its own separate PR.

Copy link
Contributor Author

@rashidsp rashidsp Sep 5, 2019

Choose a reason for hiding this comment

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

Moved changes into PR: #200.

@rashidsp rashidsp requested a review from mjc1283 September 5, 2019 12:22
Copy link

@mjc1283 mjc1283 left a comment

Choose a reason for hiding this comment

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

LGTM

@rashidsp rashidsp requested a review from mjc1283 September 5, 2019 17:20
@mjc1283 mjc1283 merged commit a34512a into master Sep 6, 2019
@rashidsp rashidsp deleted the rashid/Batch-EP-add-logEvent branch September 18, 2019 17:54
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