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

Commit

Permalink
add devdocs about how we handle render requests
Browse files Browse the repository at this point in the history
  • Loading branch information
Dieterbe committed May 8, 2018
1 parent 82dfea5 commit 33a6041
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions devdocs/render-request-handling.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
## Render (data) requests are handled like so

`/render` maps to `Server.renderMetrics` which has these main sections/steps:

* `expr.parseMany` validates the target strings (queries) and parses them grammatically.

* `expr.NewPlan` sets up the needed processing functions, their arguments (validates input to match the signature) and lets function adjust the context as it flows between the processing steps
note: context holds from/to timestamp (may change across processing pipeline, e.g. to handle movingAverage queries) and consolidateBy setting, see NOTES in expr directory.
this. future version: allow functions to mark safe to pre-aggregate using consolidateBy or not
* handle cases like when we need graphite proxying (if we don't support needed functions, etc)
* `executePlan`:
* finds all series by fanning out the query patterns to all other shards.
this gives basically idx.Node back. has the path, leaf, metricdefinition, schema/aggregation(rollup) settings, for each series, as well as on which node it can be found.
* construct models.Req objects for each serie. this uses the MKey to identify series, also sets from/to, maxdatapoints, etc.
* `alignRequests`: this looks at all models.Req objects and aligns them to a common step.
it selects the archive to use, consolidator settings etc (see NOTES in expr directory for more info)
* `getTargets`: gets the data from the local node and peer nodes based on the models.Req objects
* `mergeSeries`: if there's multiple series with same name/tags, from, to and consolidator (e.g. because there's multiple series because users switched intervals), merge them together into one series
* Sort each merged series so that the output of a function is well-defined and repeatable.
* `plan.Run`: invoke all function processing, followed by runtime consolidation as necessary

0 comments on commit 33a6041

Please sign in to comment.