backport sortByName() to 0.9.X

Backporting PR #522 to the 0.9.x branch. This seems to have been in at one point; because the original patch for master (a different PR) was upported from 0.9.x. While testing 10.0-alpha with Grafana; the sortByName() Function did just that..function. When reverting back to the latest 0.9.x source; the function caused all of my grafana panels to go blank. Panel was calling for a function that's not in 0.9.x.

see (https://github.com/grafana/grafana/issues/690) for more details.


sortByMinima() / sortByMoxima() sorts by the Values. sortByName sorts by
the Metric Name. ex: Production.Servers.ABServer.LogicalDisk.C.FreeSpace;
Production.Servers.CDServer.LogicalDisk.C.FreeSpace.

Production.Servers are hard coded into the Agg. ABServer/CDServer is the
1st Metric Name.... with the sortByName Function; it would sort it
AlphaNuma so AB would display 1st. This comes in VERY USEFUL when you are
have 300 Servers in 1 graph (100 Hyper-V Windows GO Agent Servers, 100
VMWare Windows GO Agent Servers, and 100 Linux GO Agent Servers.) In our
case, PRDSLHWGOAxxx, PRDSLSLGOAxxx, PRDSLVWGOAxxx; where xxx is a number

On Thu, Sep 11, 2014 at 9:35 AM, Denis Zhdanov <notifications@github.com>
wrote:

> In webapp/graphite/render/functions.py:
>
> > @@ -1557,6 +1557,18 @@ def limit(requestContext, seriesList, n):
> >    """
> >    return seriesList[0:n]
> >
> > +def sortByName(requestContext, seriesList):
> > +  """
> > +  Takes one metric or a wildcard seriesList.
> > +
> > +  Sorts the list of metrics by the metric name.
> > +  """
> > +  def compare(x,y):
> > +    return cmp(x.name, y.name)
>
> As far as I understand, it was done the same way as sortByMinima() and
> sortByMaxima() did. Do we need to collapse all 3 or left it as is?
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/graphite-project/graphite-web/pull/831/files#r17428141>
> .
>



-- 
Bryce T. Walter