-
Notifications
You must be signed in to change notification settings - Fork 32
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
Conversation
Double eventValue = null; | ||
if (eventTags.containsKey(ReservedEventKey.VALUE.toString())) { | ||
Object rawValue = eventTags.get(ReservedEventKey.VALUE.toString()); | ||
if (rawValue instanceof Double) { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this 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.
@vraja2 will add docs to explain why they should send us floats or doubles instead of int/long |
@optimizely/fullstack-devs