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 odp manager #405

Merged
merged 20 commits into from
Sep 21, 2022
Merged

feat: add odp manager #405

merged 20 commits into from
Sep 21, 2022

Conversation

Mat001
Copy link
Contributor

@Mat001 Mat001 commented Sep 13, 2022

Summary

  • Integrate OdpSegmentManager, OdpEventmanager and OdpConfig into OdpManager
  • Add unit tests
  • acceptance criteria in the linked story below

Test plan

  • added unit tests, mypy type checking, linting

Issues

Copy link
Contributor

@andrewleap-optimizely andrewleap-optimizely left a comment

Choose a reason for hiding this comment

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

Looking good! Appreciate the thorough tests. Just a few suggestions/changes requested

optimizely/odp/odp_event_manager.py Outdated Show resolved Hide resolved
optimizely/helpers/enums.py Outdated Show resolved Hide resolved
optimizely/odp/odp_manager.py Outdated Show resolved Hide resolved
optimizely/odp/odp_manager.py Outdated Show resolved Hide resolved
optimizely/odp/odp_manager.py Outdated Show resolved Hide resolved
tests/test_odp_manager.py Outdated Show resolved Hide resolved
tests/test_odp_manager.py Show resolved Hide resolved
tests/test_odp_manager.py Outdated Show resolved Hide resolved
tests/test_odp_manager.py Show resolved Hide resolved
optimizely/helpers/enums.py Outdated Show resolved Hide resolved
Copy link
Contributor

@jaeopt jaeopt left a comment

Choose a reason for hiding this comment

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

Looks good! A few changes and clarifications suggested.

optimizely/odp/odp_manager.py Outdated Show resolved Hide resolved
optimizely/odp/odp_manager.py Outdated Show resolved Hide resolved
optimizely/odp/odp_manager.py Outdated Show resolved Hide resolved
optimizely/odp/odp_manager.py Outdated Show resolved Hide resolved
optimizely/odp/odp_manager.py Outdated Show resolved Hide resolved
optimizely/odp/odp_manager.py Outdated Show resolved Hide resolved
tests/test_odp_manager.py Show resolved Hide resolved
tests/test_odp_manager.py Show resolved Hide resolved
Copy link
Contributor

@andrewleap-optimizely andrewleap-optimizely left a comment

Choose a reason for hiding this comment

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

Looking good! One more small fix.

optimizely/odp/odp_manager.py Outdated Show resolved Hide resolved
optimizely/odp/odp_manager.py Outdated Show resolved Hide resolved
Copy link
Contributor

@jaeopt jaeopt left a comment

Choose a reason for hiding this comment

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

All changes look good! A couple of more clarifications.

optimizely/odp/odp_manager.py Outdated Show resolved Hide resolved
optimizely/odp/odp_manager.py Outdated Show resolved Hide resolved
self.odp_config = OdpConfig()
self.logger = logger or optimizely_logger.NoOpLogger()

self.segment_manager = None
self.event_manager = None

if not self.enabled:
self.logger.info('ODP is disabled.')
return

if segment_manager:
segment_manager.odp_config = self.odp_config
self.segment_manager = segment_manager
else:
self.segment_manager = OdpSegmentManager(self.odp_config,
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we consider removing odp_config from the constructor params? It should be overriden for custom segment-manager anyway? Let's talk about it when integrating at the top level.

optimizely/odp/odp_manager.py Outdated Show resolved Hide resolved
tests/test_odp_manager.py Outdated Show resolved Hide resolved
Copy link
Contributor

@jaeopt jaeopt left a comment

Choose a reason for hiding this comment

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

I see an error in cache timeout.

optimizely/helpers/enums.py Outdated Show resolved Hide resolved
optimizely/odp/odp_manager.py Outdated Show resolved Hide resolved
@@ -78,7 +86,7 @@ def identify_user(self, user_id: str) -> None:
self.logger.debug('ODP identify event is not dispatched (ODP disabled).')
return
if self.odp_config.odp_state() == OdpConfigState.NOT_INTEGRATED:
self.logger.debug('ODP Identify event is not dispatched (ODP not integrated).')
self.logger.debug('ODP identify event is not dispatched (ODP not integrated).')
Copy link
Contributor

Choose a reason for hiding this comment

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

Line 107-114, send_event raises multiple exceptions. They should be processed separately at the top level. We can discuss again when integrated.

@Mat001 Mat001 requested a review from jaeopt September 20, 2022 18:27
Copy link
Contributor

@jaeopt jaeopt left a comment

Choose a reason for hiding this comment

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

LGTM with a nit

tests/test_odp_manager.py Outdated Show resolved Hide resolved
Copy link
Contributor

@andrewleap-optimizely andrewleap-optimizely left a comment

Choose a reason for hiding this comment

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

LGTM

@andrewleap-optimizely andrewleap-optimizely changed the title Mpirnovar/odp manager feat: add odp manager Sep 21, 2022
@andrewleap-optimizely andrewleap-optimizely merged commit d1b521b into master Sep 21, 2022
@andrewleap-optimizely andrewleap-optimizely deleted the mpirnovar/odp_manager branch September 21, 2022 15:53
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.

None yet

3 participants