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

support consolidateBy #641

Merged
merged 9 commits into from
May 23, 2017
Merged

support consolidateBy #641

merged 9 commits into from
May 23, 2017

Conversation

Dieterbe
Copy link
Contributor

after some thinking and experimentation, I think I came up with a pretty elegant approach.
@woodsaj @DanCech please have a look at expr/NOTES, read it carefully and let me know whether you agree with every sentence. I think it describes a pretty elegant approach that will address a lot of our shortcomings.

@Dieterbe Dieterbe force-pushed the consolidateBy branch 3 times, most recently from efc17c0 to 4d674a4 Compare May 18, 2017 11:05
@DanCech
Copy link
Contributor

DanCech commented May 18, 2017

I like this a lot, the only issue I see right now is that queries will operate differently if they can be fully answered by MT vs being passed off to graphite. It could be interesting to look at extending graphite to have the same concept of an aggregation method for each TimeSeries, though I'm not sure how much work that would entail.

@Dieterbe Dieterbe force-pushed the consolidateBy branch 3 times, most recently from 263f619 to c26c03c Compare May 22, 2017 10:04
useful for functions that need normalizing (currently none, see NOTES)
and consolidation when generating the final response
and some more comments to make things clearer
this way you can issue requests like
target=foo&target=consolidateBy(foo,"sum")
which would previously get merged.
@Dieterbe Dieterbe changed the title WIP: ConsolidateBy support consolidateBy May 22, 2017
@Dieterbe Dieterbe requested review from woodsaj and replay May 22, 2017 10:56
if len(in) == cleanLen {
out = in[0:outLen]
out_i := 0
var next_i int
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

both out_i and next_i are initialized to 0. let's keep declaration consistent.

outLen += 1
out = in[0:outLen]
out_i := 0
var next_i int
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

both out_i and next_i are initialized to 0. let's keep declaration consistent.

outLen := len(in) / num
var out []schema.Point
cleanLen := num * outLen // what the len of input slice would be if it was a perfect fit
if len(in) == cleanLen {
Copy link
Member

@woodsaj woodsaj May 22, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not obvious that the purpose of the the 2 code paths is simply to handle aggNum dividing into len(in) evenly or not.
Can you add some more comments.

var next_i int
for in_i := 0; in_i < cleanLen; in_i = next_i {
next_i = in_i + num
out[out_i] = schema.Point{Val: aggFunc(in[in_i:next_i]), Ts: in[next_i-1].Ts}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is the output using the timestamp of the last point, and not the first? When graphite normalizes data, it use the TS of the first point.
https://github.com/graphite-project/graphite-web/blob/master/webapp/graphite/render/functions.py#L145-L147

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when measurements need to be consolidated, and those measurements contain a spike in the signal for example, than it would be incorrect to move that spike to an earlier timestamp than when it actually occured. when troubleshooting and correlating, people expect that the signal may be delayed, but if it can also move back into time things get confusing and unreliable.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants