Skip to content

feat(Audience Evaluation): Use log messages to explain the outcome of audience evaluation #210

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 10 commits into from
Feb 8, 2019

Conversation

mfahadahmed
Copy link
Contributor

@mfahadahmed mfahadahmed commented Jan 23, 2019

Summary

This adds logging for audience evaluation.

@coveralls
Copy link

coveralls commented Jan 23, 2019

Coverage Status

Coverage increased (+0.1%) to 97.582% when pulling ef3db22 on fahad/audience-logging into b8791d4 on master.

@msohailhussain msohailhussain requested a review from a team January 28, 2019 05:44
Copy link
Contributor

@nchilada nchilada left a comment

Choose a reason for hiding this comment

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

Thanks for the great start! I've added a number of suggestions but hopefully they're fairly straightforward!

Copy link
Contributor

@nchilada nchilada left a comment

Choose a reason for hiding this comment

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

Updates look good. Just a couple last requests!

var result = conditionTreeEvaluator.evaluate(audience.conditions, evaluateConditionWithUserAttributes);
var resultText = result === null ? 'UNKNOWN' : sprintf('%s', result);
logger.log(LOG_LEVEL.DEBUG, sprintf(LOG_MESSAGES.AUDIENCE_EVALUATION_RESULT, MODULE_NAME, audienceId, resultText));
var resultText = result === null ? 'UNKNOWN' : result.toString().toUpperCase();
Copy link
Contributor

Choose a reason for hiding this comment

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

result.toString() only works if result isn't null or undefined, but I guess we should be okay in this case. 👍

}

if (!fns.isFinite(userValue)) {
logger.log(LOG_LEVEL.WARNING, sprintf(LOG_MESSAGES.UNEXPECTED_TYPE, MODULE_NAME, JSON.stringify(condition), conditionName, userValue));
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for changing this! Looks like you also fixed the order of the last two arguments. I'm guessing the test case¹ was failing and we just hadn't noticed yet?

¹ should log and return null if the user-provided value is of a different type than the condition value

Copy link
Contributor

@nchilada nchilada left a comment

Choose a reason for hiding this comment

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

A couple more suggestions, but almost there. Thanks again! 😊

Copy link
Contributor

@nchilada nchilada left a comment

Choose a reason for hiding this comment

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

This looks great. Thanks so much for bearing with me!

@nchilada nchilada changed the title feat(Audience Evaluation): Audience Logging feat(Audience Evaluation): Use log messages to explain the outcome of audience evaluation Feb 8, 2019
@nchilada nchilada merged commit de83b9b into master Feb 8, 2019
@nchilada nchilada deleted the fahad/audience-logging branch February 8, 2019 19:05
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.

4 participants