graphite-dev team mailing list archive
-
graphite-dev team
-
Mailing list archive
-
Message #00042
Re: [Question #73951]: maxSeries function
Question #73951 on Graphite changed:
https://answers.launchpad.net/graphite/+question/73951
Status: Answered => Open
Pete Emerson is still having a problem:
I believe I've got it! This is from graphite-0.9.4. Rip out my comments
and restructure, whatever you see fit.
$ diff functions.py functions.py.new
23a24,35
> # Pete adding safeMax
> def safeMax(values):
> safeValues = [v for v in values if v is not None]
> if not safeValues: return None
> return max(safeValues)
>
> # Pete adding safeMin
> def safeMin(values):
> safeValues = [v for v in values if v is not None]
> if not safeValues: return None
> return min(safeValues)
>
77a90,108
> # Pete adding maxSeries
> def maxSeries(*seriesLists):
> (seriesList,start,end,step) = normalize(seriesLists)
> #name = "maxSeries(%s)" % ','.join((s.name for s in seriesList))
> name = "maxSeries(%s)" % ','.join(set([s.pathExpression for s in seriesList]))
> values = ( safeMax(row) for row in izip(*seriesList) ) #XXX izip
> series = TimeSeries(name,start,end,step,values)
> series.pathExpression = name
> return [series]
>
> def minSeries(*seriesLists):
> (seriesList,start,end,step) = normalize(seriesLists)
> #name = "minSeries(%s)" % ','.join((s.name for s in seriesList))
> name = "minSeries(%s)" % ','.join(set([s.pathExpression for s in seriesList]))
> values = ( safeMin(row) for row in izip(*seriesList) ) #XXX izip
> series = TimeSeries(name,start,end,step,values)
> series.pathExpression = name
> return [series]
>
207a239
> # Pete adding maxSeries
208a241,242
> 'minSeries' : minSeries,
> 'maxSeries' : maxSeries,
$ diff composer_widgets.js composer_widgets.js.new
390a391,392
> /* Pete adding Max Series 5 lines down */
>
394a397,398
> {text: 'Min Series', handler: this.applyFuncToAll('minSeries')},
> {text: 'Max Series', handler: this.applyFuncToAll('maxSeries')},
--
You received this question notification because you are a member of
graphite-dev, which is an answer contact for Graphite.