-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
Clean up top_metric
's internal API
#71738
Conversation
This changes `top_metrics`'s implementation of `getProperty` and `value` to be a bit more consisntent which shold make it easier to integrate into transform. We expect `value` to return `NaN` when the value isn't a number or is null but was throwing exceptions in both that cases. `getProperty` was throwing exceptions on null and non-numeric values as well. Now it returns `null` or `BytesRef`.
} | ||
return metric.numberValue(); | ||
return metric.getValue().getKey(); |
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.
This'll return a BytesRef
if you fetch from a keyword
or ip
or bytes
field. Would it be more useful to you if I formatted it? Or do you want the raw bytes?
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.
In my local version I have a valueAsString
method, I don't think I need this interface.
I will ping you on my PR once I have it ready.
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.
LGTM
Pinging @elastic/es-analytics-geo (Team:Analytics) |
This changes `top_metrics`'s implementation of `getProperty` and `value` to be a bit more consisntent which shold make it easier to integrate into transform. We expect `value` to return `NaN` when the value isn't a number or is null but was throwing exceptions in both that cases. `getProperty` was throwing exceptions on null and non-numeric values as well. Now it returns `null` or `BytesRef`.
This changes `top_metrics`'s implementation of `getProperty` and `value` to be a bit more consisntent which shold make it easier to integrate into transform. We expect `value` to return `NaN` when the value isn't a number or is null but was throwing exceptions in both that cases. `getProperty` was throwing exceptions on null and non-numeric values as well. Now it returns `null` or `BytesRef`.
This changes
top_metrics
's implementation ofgetProperty
andvalue
to be a bit more consisntent which shold make it easier to integrate
into transform. We expect
value
to returnNaN
when the value isn't anumber or is null but was throwing exceptions in both that cases.
getProperty
was throwing exceptions on null and non-numeric values aswell. Now it returns
null
orBytesRef
.