graphite-project / graphite-web

A highly scalable real-time graphing system
http://graphite.readthedocs.org/
Apache License 2.0
5.9k stars 1.26k forks source link

[Q] Why there are no diffSeriesLists, sumSeriesLists, multiplySeriesLists? #2645

Closed alikhtag closed 3 years ago

alikhtag commented 4 years ago

I would like to ask why does graphite-web only supports divideSeriesLists() function that is able to divide different lists of series?

One would assume having divideSeriesLists() there should be similar operation for subtraction -> diffSeriesLists(), addition -> sumSeriesLists() and lastly for multiplication -> multiplySeriesLists().

Is there workaround I did not find to have similar logic for diff, sum, and multiply as

divideSeriesLists(carbon.{graphite, diamond}.price, carbon.{graphite, diamond}.quantity) 
which produces 
divideSeriesLists(carbon.graphite.price, carbon.graphite.quantity) 
divideSeriesLists(carbon.diamond.price, carbon.diamond.quantity) 

?

P.S I can contribute my time to write these functions, if you would like to have these functions explicitly in graphite-web.

piotr1212 commented 4 years ago

Probably because nobody created them. Looks like the divideSeriesLists() can be generalised easy to support all other operations. PR's are welcome.

deniszh commented 4 years ago

@alikhtag : Indeed, divideSeriesLists() was implemented by @leoleovich in https://github.com/graphite-project/graphite-web/pull/1928 And as @piotr1212 said - code could be generalized quite easily. Good issue for #hacktoberfest2020

DanCech commented 4 years ago

For commutative operations you can also use the groupByNodes function

alikhtag commented 4 years ago

For commutative operations you can also use the groupByNodes function

True that can be used. But our use case is not very cumulative, I know the example I gave may not reflect it perfectly, but we have 2 queries in Grafana with completely different paths and having something that can do mathematical operations besides division on lists would be nice. (There some multi value variables we want to display in same panel as separate metric )