octant icon indicating copy to clipboard operation
octant copied to clipboard

add a component.NewDuration(time.Duration)

Open jstrachan opened this issue 4 years ago • 4 comments

it would be great to be able to add a duration column to a table. e.g. to visualise the duration of a pipeline / job.

So something like the component.NewTimestamp(time.Time) would be great: component.NewDuration(time.Duration)

jstrachan avatar Apr 24 '20 09:04 jstrachan

actually I found a workaround by just converting the duration into a relative time from now...

func NewDuration(d time.Duration) component.Component {
	t := time.Now().Add(d * -1)
	return component.NewTimestamp(t)
}

Wonder if its worth adding this helper function to octant?

jstrachan avatar Apr 27 '20 05:04 jstrachan

I think this is a great candidate for some documentation. We'll think about adding it as a helper as well.

wwitzel3 avatar Apr 27 '20 14:04 wwitzel3

I think It'd be very helpful to have this as a helper, also, doc about it is needed, I can do it

ftovaro avatar Aug 10 '21 21:08 ftovaro

Want to consider where a helper like this would live, how it would be documented, and tested. Any helper we expose now becomes part of our API that users expect.

This was my motivation for merely documenting it vs. provided a concrete implementation.

wwitzel3 avatar Aug 11 '21 13:08 wwitzel3