cmd/bosun: series func to create series from scalars #1667

Merged
merged 2 commits into from Mar 14, 2016

Projects

None yet

2 participants

@kylebrandt
Member

Also fix nv() so it creates a result when the entire set is empty

$now = epoch()
$hourAgo =  $now-d("1h")
$s = merge(series("foo=bar", $hourAgo, 5, $now, 10), series("foo=bar2", $hourAgo, 6, $now, 11))
kylebrandt added some commits Mar 14, 2016
@kylebrandt kylebrandt cmd/bosun: series func to create series from scalars c883ed7
@kylebrandt kylebrandt cmd/bosun: promote empty results with nv()
Fixes #1666
2acf8e5
@kylebrandt
Member

Also fixes #1655

@captncraig captncraig commented on the diff Mar 14, 2016
cmd/bosun/expr/parse/parse.go
@@ -31,13 +31,14 @@ type Tree struct {
}
type Func struct {
- Args []models.FuncType
- Return models.FuncType
- Tags func([]Node) (Tags, error)
- F interface{}
- VArgs bool
- VArgsPos int
- Check func(*Tree, *FuncNode) error
+ Args []models.FuncType
+ Return models.FuncType
+ Tags func([]Node) (Tags, error)
+ F interface{}
+ VArgs bool
+ VArgsPos int
+ VArgsOmit bool
@captncraig
captncraig Mar 14, 2016 Contributor

What does VArgsOmit do?

@kylebrandt
kylebrandt Mar 14, 2016 Member

@captncraig Makes it so the vargs are optional. You are allowed to omit them.

@captncraig
captncraig Mar 14, 2016 Contributor

How about inverting it. Maybe VArgsRequired or even MinVArgs would be clearer.

@kylebrandt
kylebrandt Mar 14, 2016 Member

Most of the time it isn't true. So when defining funcs you don't have to
include it. So false is a better default

On Mon, Mar 14, 2016 at 1:19 PM, Craig Peterson notifications@github.com
wrote:

In cmd/bosun/expr/parse/parse.go
#1667 (comment):

@@ -31,13 +31,14 @@ type Tree struct {
}

type Func struct {

  • Args []models.FuncType
  • Return models.FuncType
  • Tags func([]Node) (Tags, error)
  • F interface{}
  • VArgs bool
  • VArgsPos int
  • Check func(*Tree, *FuncNode) error
  • Args []models.FuncType
  • Return models.FuncType
  • Tags func([]Node) (Tags, error)
  • F interface{}
  • VArgs bool
  • VArgsPos int
  • VArgsOmit bool

How about inverting it. Maybe VArgsRequired or even MinVArgs would be
clearer.


Reply to this email directly or view it on GitHub
https://github.com/bosun-monitor/bosun/pull/1667/files#r56038601.

@kylebrandt kylebrandt merged commit 2acf8e5 into master Mar 14, 2016

2 checks passed

bosun All checks Passed!
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@kylebrandt kylebrandt deleted the seriesFunc branch Mar 16, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment