Skip to content

Add support for numeric metrics #129

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 3 commits into from
Jul 31, 2017
Merged

Add support for numeric metrics #129

merged 3 commits into from
Jul 31, 2017

Conversation

vraja2
Copy link
Contributor

@vraja2 vraja2 commented Jul 15, 2017

@optimizely/fullstack-devs

@vraja2 vraja2 requested a review from mikeproeng37 July 15, 2017 23:20
@vraja2 vraja2 assigned wangjoshuah and unassigned wangjoshuah Jul 15, 2017
Double eventValue = null;
if (eventTags.containsKey(ReservedEventKey.VALUE.toString())) {
Object rawValue = eventTags.get(ReservedEventKey.VALUE.toString());
if (rawValue instanceof Double) {
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 reasonable to let this be anything that implements Number IMO. I think this will lead to confusing behavior

Copy link
Contributor

Choose a reason for hiding this comment

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

+1

Copy link
Contributor Author

Choose a reason for hiding this comment

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

makes sense, the opposite case is the one that we should be wary of (truncating floating-point values)

eventMetrics.add(new EventMetric(EventMetric.REVENUE_METRIC_TYPE, revenueValue));
}

Double numericMetricValue = EventTagUtils.getNumericValue(eventTags);
Copy link
Contributor

Choose a reason for hiding this comment

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

@vraja2 can there only be one numeric metric value?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, it will correspond to the event being tracked.

public boolean equals(Object other) {
if (!(other instanceof EventMetric))
return false;
public boolean equals(Object o) {
Copy link
Contributor

Choose a reason for hiding this comment

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

please don't name variables single characters

Copy link
Contributor Author

Choose a reason for hiding this comment

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

intellij auto-generated, will change to obj

Copy link
Contributor

@aliabbasrizvi aliabbasrizvi left a comment

Choose a reason for hiding this comment

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

Request you to go through the prescribed review process.

@wangjoshuah wangjoshuah self-requested a review July 31, 2017 20:51
@wangjoshuah
Copy link
Contributor

@vraja2 will add docs to explain why they should send us floats or doubles instead of int/long

@vraja2 vraja2 merged commit 40ead9a into master Jul 31, 2017
@vraja2 vraja2 deleted the vignesh/METRIC-118 branch July 31, 2017 21:03
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