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

fix(logs): Fixing log messages for Targeted Rollouts #268

Merged
merged 11 commits into from
Jun 18, 2020

Conversation

aliabbasrizvi
Copy link
Contributor

@aliabbasrizvi aliabbasrizvi commented May 27, 2020

With this change we are introducing targeted rollout specific log messages.

Since, rules right now do not have a "name", I am proposing to use rule's index in the log message.

@aliabbasrizvi aliabbasrizvi marked this pull request as ready for review June 2, 2020 21:33
@aliabbasrizvi aliabbasrizvi requested a review from a team as a code owner June 2, 2020 21:33
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.

There are conflicts with master that need to be resolved.

Comment on lines 22 to 23
def does_user_meet_audience_conditions(
config, audience_conditions, experiment_or_rollout_rule, logging_key, attributes, logger):
Copy link

Choose a reason for hiding this comment

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

There are a lot of arguments - it might be easier to read at the call site if some or all were keyword arguments.

optimizely/helpers/audience.py Outdated Show resolved Hide resolved
@aliabbasrizvi aliabbasrizvi force-pushed the ali/update_logs_for_tr branch from 040472a to 0e69287 Compare June 17, 2020 23:42
@aliabbasrizvi aliabbasrizvi requested a review from mjc1283 June 17, 2020 23:42
@@ -131,10 +132,6 @@ def bucket(self, project_config, experiment, user_id, bucketing_id):
variation_id = self.find_bucket(project_config, bucketing_id, experiment.id, experiment.trafficAllocation)
if variation_id:
variation = project_config.get_variation_from_id(experiment.key, variation_id)
project_config.logger.info(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These log messages have been moved to the call site, akin to how log messages are generated for rollouts.

@aliabbasrizvi aliabbasrizvi removed their assignment Jun 17, 2020
@aliabbasrizvi aliabbasrizvi force-pushed the ali/update_logs_for_tr branch from 712ddea to 55a7261 Compare June 18, 2020 17:42
@coveralls
Copy link

coveralls commented Jun 18, 2020

Coverage Status

Coverage increased (+0.005%) to 97.091% when pulling d8b6e62 on ali/update_logs_for_tr into b7475e4 on master.

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.

One request before merging - a few changed files did not get 2020 added in their license header years. Otherwise LGTM.

Added a non-blocking comment. I am fine with the implementation as-is but wanted to share this as a potential follow up.

bucketing_id: ID to be used for bucketing the user.
Args:
project_config: Instance of ProjectConfig.
experiment: Object representing the experiment or rollout rule in which user is to be bucketed.
Copy link

Choose a reason for hiding this comment

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

Nit: maybe rename experiment to experiment_or_rule?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think I will keep it like this for now, given it is the Experiment entity.

Args:
config: project_config.ProjectConfig object representing the project.
audience_conditions: Audience conditions corresponding to the experiment or rollout rule.
experiment_or_rollout_rule: String representing whether entity being evaluated is experiment or rollout rule.
Copy link

Choose a reason for hiding this comment

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

I think this could be cleaner if:

  • audience_logs was an argument, rather than experiment_or_rollout_rule
  • The association between rollout rule/experiment and the corresponding logs was abstracted by the Experiment entity class, and internally represented by a dict, or class property/method (maybe make rollout rule its own entity class?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will adopt the audience_logs change now.

maybe make rollout rule its own entity class

I was thinking about that, but in light of more incoming product changes where this terminology will change a lot, I am hoping that we make the transition then. Let me know if that sounds ok.

@aliabbasrizvi aliabbasrizvi merged commit a34b8a8 into master Jun 18, 2020
@aliabbasrizvi aliabbasrizvi deleted the ali/update_logs_for_tr branch June 18, 2020 19:58
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