-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Timefilter API weirdness and inconsistencies #64125
Comments
Hi @JacobBrandt, thanks for reaching out. First a quick question to make sure - did you mean version 7.6? 6.6 is pretty old and we won't do changes there anymore.
That's not the case -
Maybe you confused it with the return value of
Individual apps have their own internal logic of handling their state and they are not guaranteed to be 100% consistent. The "source of truth" here is the
That's not the case - (see the reasoning above) - (the
When calling The way the individual apps work is not guaranteed to be consistent.
Always query the timefilter, it will contain the right value in a consistent way. If you just care about building queries, the I hope that helped somehow, let me know if you have further questions. |
Pinging @elastic/kibana-app-arch (Team:AppArch) |
I did mean 6.6. I should have looked at what I was seeing more closely. It's never a moment object like I thought. However, I still am correct that: timefilter.getTime().from/to: Will both be now/w. Thus representing a single point in time
It actually is the case. The roundUp option is not something you provide to timefilter. So timefilter .getTime().from/to are indeed returning this:
Yep found that out and that's exactly my point of this ticket.
If you want the range and are not using the datemath library and only using the timefilter object don't use timefilter.getTime().from/to because those values don't always give you a range. |
Kibana version:
6.6
Describe the bug:
The behavior of the API and it's values is not consistent.
On Discover page there is this method:
When 'This week' is selected on the Discover page as a time range the timefilter.getTime().from/to values are moment objects. Thus one would look at this method and say ok this is how I parse time filters for my own visualizations time ranges. However, on a dashboard when 'This week' is selected as a time range the from and to values are the same value and are NOT a moment object but a string "now/w". Thus the calculation doesn't work because from and to are the same value for some odd reason.
This kind of inconsistency is really disturbing. How is someone suppose to know that the same time range state does not return the same values from timefilter (in this case not even the same type of object for the value) depending on the page you are on.
The next issue is with the API. from/to are suppose to represent a range. However, on a dashboard they have the exact same value when the time selected is 'This week'. Thus the API itself is returning inconsistent values when it is in this state.
Time range state on a dashboard: This week
timefilter.getTime().from/to: Will both be now/w. Thus representing a single point in time
timefilter.getBounds().min/max : Will be two different moment objects whose range is a week
Expected behavior:
I would expect that the time range I select on pages would be represented in the timefilter values the same on all pages and not sometimes a string and sometimes a moment object for the exact same time range.
I also would expect know matter which part of the API is called to provide the same information.
The text was updated successfully, but these errors were encountered: