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

Consider supporting sorting by label value #414

Closed
juliusv opened this Issue Dec 2, 2014 · 9 comments

Comments

Projects
None yet
5 participants
@juliusv
Copy link
Member

juliusv commented Dec 2, 2014

Mainly for display reasons (tabular view), it would be sometimes useful to not sort by the value of timeseries, but by a given label value.

Example: list all apps in a PaaS and their memory usage. It would be nice to be able to sort by application name ("app" label).

/cc @grobie

@brian-brazil

This comment has been minimized.

Copy link
Member

brian-brazil commented Dec 2, 2014

The console templates already support sorting by label with the sortByLabel function, and a sortByValue would make sense too.

I'm not sure it makes sense for prometheus API itself to offer this, as this is a presentation issue rather than a calculation. It gets into questions about what ordering properties the various operators and functions should have.

@juliusv

This comment has been minimized.

Copy link
Member

juliusv commented Dec 2, 2014

@brian-brazil The reason why I'd prefer this as a query-language function so far, is:

  • console template functions don't help people who are running ad-hoc queries, like @grobie was doing (the mentioned example)
  • it would be quite a specialized feature, so adding buttons/fields in the UI for it would yield a very low ratio of "usefulness to the average query" / "cost of always having those UI elements there".
@brian-brazil

This comment has been minimized.

Copy link
Member

brian-brazil commented Dec 3, 2014

What was he running the ad-hoc query with? The output of the /query interface isn't human-readable.

@juliusv

This comment has been minimized.

Copy link
Member

juliusv commented Dec 3, 2014

@brian-brazil He was using the tabular view under /graph.

@brian-brazil

This comment has been minimized.

Copy link
Member

brian-brazil commented Dec 3, 2014

I think there should be an ordering on the table output on /graph (e.g. sort the full name of the metric), done in say the JS.

@brian-brazil

This comment has been minimized.

Copy link
Member

brian-brazil commented Dec 26, 2014

See #432

@RichiH

This comment has been minimized.

Copy link
Member

RichiH commented Jan 20, 2016

Sorry, I looked for dups, but didn't see this one.

I agree with the discussion in #432 that this should be in one layer only. As you don't know where further consumption of the results happens, e.g. Grafana, via HTTP API, etc, I do think that this should be done in PromQL itself as that opens one canonical way of sorting for all further processing methods.

@brian-brazil

This comment has been minimized.

Copy link
Member

brian-brazil commented Apr 6, 2016

@gouthamve

This comment has been minimized.

Copy link
Member

gouthamve commented Jun 14, 2017

This is the default in 2.0. I think this issue can be closed @brian-brazil @fabxc

simonpasquier pushed a commit to simonpasquier/prometheus that referenced this issue Oct 12, 2017

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