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

Exp2 exp3 exp refactor #637

Merged
merged 31 commits into from
May 12, 2017
Merged

Exp2 exp3 exp refactor #637

merged 31 commits into from
May 12, 2017

Conversation

Dieterbe
Copy link
Contributor

@Dieterbe Dieterbe commented May 12, 2017

replaces #622 #628 #631(and #625), i.e. expr2, expr3 and refactoring to make the planning/execution cleaner, which got messy after expr2.

by using a shim of smartSummarize, which also introduces bool support
so that functions can express that they only want an integer,
and so that they don't have to deal with verifying the float
has no decimals, conversion to int, etc.
which requires a new argType "integers" and utility function extractMetric
* provide more extensive argument types, which can take care of setting
the right values, so the function just has to declare them
* add an elegant validation system, removing Init() from functions
* merge optional and mandatory arguments into one list for convenience
* allow specifying argument names for mandatory args as well. 2 reasons:
  1) nice to mention name when showing an error for an invalid arg
  2) consider this from graphite docs:
      smartSummarize(seriesList, intervalString, func='sum',
      alignToFrom=False)
     -> graphite conflates name and type. we can name it interval with
     type string

* make functions stateful, so we don't need to copy / redo same work
this saves us the hassle of coordinating the pipeline, getting outputs,
feeding them from level into level, etc.
also Exec can just return a []models.Series, that should be ok I think
graphite only allows a single, but why not, this is convienent
* make them methods of expr
* rename silly j variable to pos, and k to key
* handle seenKwargs stuff in caller
not sure why the tests didn't trip on this prior to the refactor :?
expr/funcs.go Outdated
float // number potentially with decimals
str // string
)

type Func interface {
Copy link
Member

Choose a reason for hiding this comment

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

this still needs to be renamed. You already refer to these functions as GraphiteFuncs https://github.com/raintank/metrictank/blob/12830b0b3b025bc5f4e66e7252ddab9c73fe4637/expr/types.go#L4

@Dieterbe Dieterbe merged commit e94e3d5 into master May 12, 2017
@Dieterbe Dieterbe deleted the exp2-exp3-exp-refactor branch September 18, 2018 09:00
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.

2 participants