Skip to content
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

Ability to customize the display of duration fields #11706

Closed
sy43165 opened this issue May 10, 2017 · 11 comments · Fixed by #100540
Closed

Ability to customize the display of duration fields #11706

sy43165 opened this issue May 10, 2017 · 11 comments · Fixed by #100540

Comments

@sy43165
Copy link

sy43165 commented May 10, 2017

When a numeric field is defined as duration, there is a dropdown for several format options but none of them met my need of displaying the duration as Minutes:Seconds. I would like the option to further customize the display format. e.g. mm:ss or hh:mm:ss. Other formats could be helpful too but those would meet my needs.

@TraderApophis
Copy link

TraderApophis commented Jul 21, 2017

I would also like to be able to convert milliseconds to an accurate human readable duration which would be dynamic depending on its size. Much like the Human Readable version of the Duration format but with far more accuracy than it currently provides.

SNMP Timeticks are in centiseconds (which there is also no input option for under Duration Format requiring it to be converted before indexing).

TimeTick Value: 559231234

Converting to Millis: 559231234 x 10 = 5592312340 milliseconds

Resulting Format in Kibana: 64 days, 17:25:12.34

It would be good if this was as customizable as possible with the option to expand the values to years, months, weeks, days etc. As I'm sure there are others with use cases other than what have been mentioned here. If these values are converted to time duration strings and stored then proper sorting order in Kibana breaks. Thanks

@Pravin117
Copy link

I am looking for the same. Actually we are measuring DB up-time stats. We have uptime values in milliseconds and we are trying to show it up in DD:HH:MM:SS format.
Example.
We have uptime like this : 286481100 milliseconds
this should show as 3.31 days or 3 days:some hour: some minutes
Early response is appreciated.
Pravin

@timroes timroes added Team:Visualizations Visualization editors, elastic-charts and infrastructure and removed :Management DO NOT USE labels Nov 27, 2018
@kovas6
Copy link

kovas6 commented Apr 9, 2019

Same here, I need Duration to be displayed in HH:mm:ss format, any ETA on this Kibana enhancement?

@montanaflynn
Copy link

This would be very welcome!

The current human readable option isn't very useful for small durations as it just says a few seconds which isn't even accurate when dealing with milliseconds.

Screen Shot 2020-01-20 at 19 07 50

@jottorice
Copy link

I too would really value more configurability for duration fields, and/or for the "Human Readable" setting to do a more sensible job. IMHO, the current "Human Readable" output is far too vague.

@wylieconlon
Copy link
Contributor

I'm trying to add a clearer list of expectations to some of these formatting-related issues, and it seems like there are multiple options here. I see some different things being discussed:

  • There are some standard ways of displaying dates in terms of HH:mm:ss, and we aren't using them in the duration formatter
  • Only the human-readable format shows the units, but this format is not precise

To address the first one, I would point out that there is a workaround. If your numbers represent seconds, and only seconds, you can use numeraljs instead of our duration formatter. Numeraljs supports the following two formats:

00:00:00 is equivalent to hh:mm:ss
00:00 is equivalent to mm:ss

We should obviously build this into Kibana in a more generic way, and one option is the moment-duration-format plugin. I really like the default templates: https://github.com/jsmreese/moment-duration-format#default-template-function

moment.duration(100, "milliseconds").format();
// "100 milliseconds"
moment.duration(100, "seconds").format();
// "1:40"
moment.duration(100, "days").format();
// "3 months, 9 days"
moment.duration(100, "weeks").format();
// "1 year, 10 months, 30 days"
moment.duration(100, "months").format();
// "8 years, 4 months"

This library also solves the precision issue by providing an argument to round to the nearest unit, such as hours: https://github.com/jsmreese/moment-duration-format#precision

It seems like the next step would be to investigate how we can show accurate durations while keeping the setup as easy as possible.

@jottorice
Copy link

@wylieconlon , I agree with your assessment that concerns here can be split into two. Personally, I'm most interested in a "smarter" human-readable option which could pick a "reasonably"-precise output, along the lines of the following examples: "100ms", "30s", "3m20s", "4h16m", "1d8h12m" - that sort of thing. So, something which decides what the largest relevant unit is, but then allows the user to decide on the precision after that - e.g., for an input of 3.11 hours, do you want that as just "3h", or "3h7m", or "3h6m36s"? Perhaps to keep this simple, the default setup could be to allow user selection of "low", "medium", or "high" precision for this? Maybe that plugin which you mentioned doe something like this? I'll take a look at it. Anyway, whatever love you can give this issue, that's great. Thanks for taking a look.

@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app-arch (Team:AppArch)

@VimCommando
Copy link

A big +1 from me too.

The current Human Readable duration has very limited usefulness. If you have any value smaller than "a minute" it quickly becomes worthless. The data set I am currently working with can very accurately range from nanoseconds to literally days and still be valid information.

I'd love to see it just move up the time unit scale, and keep a defined number of decimal places; just like the bytes format.

Example keeping 2 places past the decimal:

320,000ns =>  0.32ms
1480ms    => 14.80s
315s      =>  5.75m
470m      =>  7.83h
48h       =>  2.00d

"A few seconds" is very misleading and very broken when even 0 milliseconds is "rounded" to this, and the hover or tool-tips don't show the raw data.

image

@bijipadhy
Copy link

Hi Guys,

Is there any solution to this issue yet? I have a numeric field which has duration in seconds. Need to show this value is the format of HH:MM:SS. Is there any alternate way which can be done by the painless script?

Its kind of urgent. Looking for a quick response. Thank you! :)

@jodinathan
Copy link

Hi Guys,

Is there any solution to this issue yet? I have a numeric field which has duration in seconds. Need to show this value is the format of HH:MM:SS. Is there any alternate way which can be done by the painless script?

Its kind of urgent. Looking for a quick response. Thank you! :)

you can set it as number and add the format 00:00:00.
it is not optimal but maybe can help

for other formats see http://numeraljs.com/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet