go-graphite / carbonapi

Implementation of graphite API (graphite-web) in golang
Other
308 stars 140 forks source link

Group function does not appear to match Graphite web #714

Open carrieedwards opened 2 years ago

carrieedwards commented 2 years ago

Describe the bug The current implementation of the Graphite web group() function does not appear to match Graphite web's implementation, or the definition of the function defined in the documentation. The documentation states:

group(*seriesLists)
Takes an arbitrary number of seriesLists and adds them to a single seriesList. This is used to pass multiple seriesLists to a function which only takes one

The implementation in Graphite web and the function test show that multiple series are accepted as arguments, and a single list of values are returned. CarbonAPI's current implementation appears to return multiple series without consolidating the values.

There is also no test for this function in CarbonAPI, so a test should be added to check the functionality matches graphite web.

CarbonAPI Version What's the CarbonAPI version you are running? Does this issue reproducible on current master?

Logs If applicable, add logs (please use log level debug) that shows the whole duration of the request. Request can be identified by UUID if needed.

CarbonAPI Configuration: Please include carbonapi config file that you are using (please replace all information you don't want to share, like domain names or IP addresses).

Simplified query (if applicable) Please provide a query that triggered the issue, ideally narrowed down to smallest possible set of functions.

If you have a complex query like someFunction(otherFunction(yetAnotherFunction(metric.name), some_paramters), some.other.metric.name) it is very helpful to try to remove some of the functions around the metric.name and check which one triggers the problem.

Backend metric retention and aggregation schemas Please provide backend's schema (most important thing - if query cross retention period or not), aggregation function, xFilesFactor (if applicable).

Backend response (if possible) If that's possible - please share some sample set of backend responses. Most important thing here:

  1. Are all backend responses the same? If not, what's the difference?
  2. Do they contain special values, like Inf/NaN values?
  3. Do all of them have same step?

To get the backend response, you can send request for the same metrics towards the backend:

  1. You should remove all the functions from the request as most backends do not support any of them
  2. You might need to convert relative time offsets to unix time, e.x. if you have "from=-1h" you might need to pass from={current-timestamp}-3600&until={current-timestamp} where {current timestamp} should be replaced by actual value. On some systems you can use command line to get current timestamp date +%s or even you can ask for a timestamp that was 1 hour ago: date +%s --date="1 hour ago"

Additional context Add any other context about the problem here. Like version of a backend.