-
Notifications
You must be signed in to change notification settings - Fork 104
Conversation
By making sure the user has their agg settings in proper order: 1) we make their lives easier because come on seriously 2) we avoid the need to sort in alignRequests 3) alignRequests can print archive numbers (1,2,3,... being the archive in a list of sorted archives) that always match the index of the archive in the config
84aaf61
to
54fef31
Compare
54fef31
to
631f67b
Compare
@woodsaj or @replay if you have some time, mind taking a look? this covers step 1 of #463 (comment) |
api/query_engine.go
Outdated
} | ||
lcm := util.Lcm(keys) | ||
|
||
options := make([]narchive, 0, len(aggSettings.Aggs)+1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of []narchive
you could just use narchives
api/query_engine.go
Outdated
// potentially making the "raw interval" > first rollup interval, so that | ||
// raw archive might be ordered after a rollup, and where the archive | ||
// itself knows which one it is, instead of having to rely on index lookup table. | ||
func getOptionsLikeGraphite(reqs []models.Req, aggSettings mdata.AggSettings, tsRange uint32) ([]narchive, map[uint32]struct{}) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could just use narchives
instead of []narchive
if the type is already defined anyway
api/query_engine.go
Outdated
} | ||
|
||
if LogLevel < 2 { | ||
options[selected].chosen = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even though this saves an operation in prod, I wouldn't modify such an important data structure under a condition that depends on the loglevel even if at the moment it isn't used at any other critical location (not considering narchive.String()
critical) because I think it's too easy for somebody to use that .chosen
flag for something else without being aware that it's correctness depends on such an arbitrary setting like the log level.
api/query_engine.go
Outdated
// number 0 = raw archive, number 1,2,..N = aggregation 1,2..N | ||
// this allows you to reorder narchives and still keep track of which is which | ||
type narchive struct { | ||
i int |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some explanatory name and a more extensive comment that explains why it's necessary to "keep track of which is which" would be helpful
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, with some minor comments
This seems to be way more complicated then it should be. We are simplifying our code, so there should be more lines of code deleted then new lines being added.
|
I think there should be a grace period between introducing the new code and getting rid of the old.
no. user should specify them in the right order. it's for their own good (see also the commit msg of 6dc62be)
no. we also need to deal with multiple different raw intervals (and how their lcm may be > 1st rollup) and with the per-aggsetting ready parameter. I think I can replace the ready filtering in |
the old code is broken and returns incorrect data, get rid of it.
that is not how graphite handles queries. The only information used for selecting the rollup is the request "from" time. Users sending data with an interval less frequent then the first rollup is an edge case we dont need to support right now. that will be solved by supporting storeage-schema config (ie per series aggSettings) |
api/query_engine.go
Outdated
// represents a numbered data "archive", i.e. the raw one, or an aggregated series | ||
// number 0 = raw archive, number 1,2,..N = aggregation 1,2..N | ||
// this allows you to reorder narchives and still keep track of which is which | ||
type narchive struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does narchive mean? In general just dont use abbreviations.
api/query_engine.go
Outdated
type narchive struct { | ||
i int | ||
interval uint32 | ||
pointCount uint32 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not used anywhere except in the String() method
api/query_engine.go
Outdated
// note: it is assumed that all requests have the same from, to and maxdatapoints! | ||
// this function ignores the TTL values. it is assumed that you've set sensible TTL's | ||
func alignRequests(reqs []models.Req, aggSettings mdata.AggSettings) ([]models.Req, error) { | ||
// represents a numbered data "archive", i.e. the raw one, or an aggregated series |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are there 2 almost identical data structures (archive and narchive). Surely you can just add the position variable (i) to archive and remove narchive. Just because it is defined doesnt mean it has to be used.
* remove support for old reading method * remove support for raw LCM interval > first rollup interval, see #534 (comment) * since the logic is now very obvious and transparant, no more need to do debug logging on different options, pointcounts, etc so, can remove the archive type.
I removed the old approach as requested, and simplified more. (see last commit above) EDIT: now with chart: https://snapshot.raintank.io/dashboard/snapshot/yEc5WKGRsxFbJXOPqdRrBhkD3gILYej3 |
* remove support for old reading method * remove support for raw LCM interval > first rollup interval, see #534 (comment) * since the logic is now very obvious and transparant, no more need to do debug logging on different options, pointcounts, etc so, can remove the archive type.
@woodsaj PTAL and merge if you like. |
33399b4
to
68e2e25
Compare
looks great @Dieterbe We can likely reduce the query times by enabling gzip compression on the data sent between MT and graphite. https://go-macaron.com/docs/middlewares/gzip Ill open a separate issue for that. |
No description provided.