Skip to content
This repository was archived by the owner on Aug 23, 2023. It is now read-only.

summarize function returning incorrect results #903

Closed
woodsaj opened this issue May 2, 2018 · 6 comments
Closed

summarize function returning incorrect results #903

woodsaj opened this issue May 2, 2018 · 6 comments
Milestone

Comments

@woodsaj
Copy link
Member

woodsaj commented May 2, 2018

If i send a request for 3months of data, summarized into 30day averages

target: summarize(metrictank.aggstats.1-mtqa.tank.metrics_active.gauge32, '30day', 'avg', false)
from: 1517414400
until: 1525104059
format: json

i get back

[  
  {  
    "target":"summarize(metrictank.aggstats.1-mtqa.tank.metrics_active.gauge32, \"30day\", \"avg\")",
    "tags":{  
      "name":"metrictank.aggstats.1-mtqa.tank.metrics_active.gauge32",
      "summarize":"30day",
      "summarizeFunction":"avg"
    },
    "datapoints":[  
      [  
        66.50059255122777,
        1516320000
      ]
    ]
  }
]

As well as there being only 1 datapoint returned instead of the expected 3, the timestamp of the returned datapoint is for 12days before the requested From.

If a add a keepLastValue() function to the query, forcing the query to be handed off to Graphite, i get the correct results.

This looks to be a fairly recent bug, as a number of queries that were working last month are not working today.

@Dieterbe
Copy link
Contributor

Dieterbe commented May 3, 2018

This looks to be a fairly recent bug, as a number of queries that were working last month are not working today.

native summarize() support in MT was merged on march 8 via #837, likely there is a bug in it

@DanCech
Copy link
Contributor

DanCech commented May 3, 2018

It seems like the issue may be in the calculation of numPoints, the go code has it as the number of expected output points, where in the python code it's the number of input points.

https://github.com/grafana/metrictank/blob/master/expr/func_summarize.go#L90

https://github.com/graphite-project/graphite-web/blob/master/webapp/graphite/render/functions.py#L4789-L4794

@shanson7
Copy link
Collaborator

shanson7 commented May 3, 2018

Also, should it be end-start rather than start-end in the go code?

@shanson7
Copy link
Collaborator

shanson7 commented May 3, 2018

Should summarize be resetting the consolidation function?
https://github.com/grafana/metrictank/blob/master/expr/func_summarize.go#L36

Seems like the python version doesn't do this.

@Dieterbe Dieterbe added this to the 0.9.1 milestone May 16, 2018
Dieterbe added a commit that referenced this issue May 17, 2018
it is known to be buggy. see #903
Dieterbe added a commit that referenced this issue May 17, 2018
it is known to be buggy. see #903
@Dieterbe
Copy link
Contributor

Dieterbe commented Jun 4, 2018

Should summarize be resetting the consolidation function?
https://github.com/grafana/metrictank/blob/master/expr/func_summarize.go#L36
Seems like the python version doesn't do this.

yes, see https://github.com/grafana/metrictank/blob/master/expr/NOTES#L73

@Dieterbe
Copy link
Contributor

Dieterbe commented Jun 4, 2018

FWIW interval is 10:

mt-index-cat --prefix metrictank.aggstats.1-mtqa.tank.metrics_active.gauge32 cass -timeout 30s -keyspace \$MT_CASSANDRA_IDX_KEYSPACE -hosts \$MT_CASSANDRA_IDX_HOSTS '{{.Id}} {{.OrgId}} {{.Name}} {{.Interval}} {{.LastUpdate}} {{.Partition}}\n'"
1.2c908409650e626115cf8bf5c74331a0 1 metrictank.aggstats.1-mtqa.tank.metrics_active.gauge32 10 1528101600 4

@Dieterbe Dieterbe modified the milestones: 1.1, 0.10.0 Dec 12, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants