grafana / explore-logs

Repo for the Loki log exploration app
GNU Affero General Public License v3.0
236 stars 7 forks source link

Value breakdowns: sort by calculated values #479

Closed matyax closed 1 week ago

matyax commented 1 week ago

Sorting, descending, by different criteria such as standard deviation, min, max, range, diff, etc. The available operations have been taken from those that are used for transformations.

For a given series, we can access calculations using doStandardCalcs() and transformations like stdDev. With that, we offer the user different sorting options.

Demo:

https://github.com/grafana/explore-logs/assets/1069378/2d9fb0dd-0399-4331-b273-3a6e2d6c0a69

Part of https://github.com/grafana/explore-logs/issues/316

matryer commented 1 week ago

Ohh this is exciting!

matyax commented 1 week ago

I was just looking at that. Some low hanging criteria could be:

matyax commented 1 week ago

I'm now working on adding a Select with a few sorting options, and direction (asc, desc).

stevendungan commented 1 week ago

This looks really great!!! A few questions I had @matyax:

  1. From the video, I assume this is addressing sorting of the graphs, but the UI suggests it is sorting of the Data source - I assume at this point the user has determined their data source image

Do we think it's best here to:

  1. Do we think "UNSORTED" is a bit of a distraction/papercut? I think we can replace "UNSORTED" with "SORTED BY [x]" (whatever our opinionated way that default should be)
gtk-grafana commented 1 week ago

is this supposed to be open for review, looks like it's still a WIP?

matyax commented 1 week ago

is this supposed to be open for review, looks like it's still a WIP?

Today I removed the PoC part and moved on to implement the sorting criteria and direction. Will ping back when it's ready for review.

matyax commented 1 week ago

This should be ready to take a second look, now with more options for sorting, and direction. Ran out of time to add coverage, but will do tomorrow.

gtk-grafana commented 1 week ago

Notes from our call earlier:

Not enough space, shrink search bar?

Pasted Graphic

Sort has no impact on single view:

Pasted Graphic 1

Add calculated value to UI somewhere (e.g. the legend)

matyax commented 1 week ago

Made it bigger and added a tooltip.

imagen

If you don't mind, I'd prefer to take care of the other items in a follow-up PR.

matyax commented 1 week ago

Merging these changes to continue in follow UP prs.