Documentation ¶
Overview ¶
Package dsl is the Domain Specific Language for the series query. Presently it mostly mimics the Graphite API functions. The parser used for the language is Go standard lib parser.ParseExpr(), which basically means the syntax is Go, and so the user of this package might need to ensure to wrap series names in quotes, etc.
For example, consider
scale(foo.bar.baz, 2)
is a valid Go expression. foo.bar.baz is called a selector expression. However,
scale(foo.1bar.baz, 2)
is not valid because an identifier cannot begin with a digit. In any case,
scale("foo.1bar.b*", 2)
is always valid, and is the preferred method.
Tgres DSL also supports function chaining, e.g.:
group("foo.*").scale(2)
Internally this is done by taking the return value of the preceeding function and inserting it as the first argument to the current one, thus the above expression is equivalent to:
scale(group("foo.*", 2))
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewNamedDSFetcher ¶
func NewNamedDSFetcher(db dsFetcherSearcher, dsc watcher, lruCap int) *namedDsFetcher
Returns a new instance of a NamedDSFetcher. The current implementation will re-fetch all series names any time a series cannot be found. TODO: Make this better.
func NewNamedDSFetcherMap ¶
func NewNamedDSFetcherMap(dss map[string]rrd.DataSourcer) *namedDsFetcher
Creates a NamedDsFetcher from a map of DataSourcers. This is useful to bootstrap a DSL Context without any database.
Types ¶
type AliasSeries ¶
type AliasSeries interface { series.Series // With argument sets the alias. Returns the alias. Alias(s ...string) string }
A Series which supports Alias()
type FsFindNode ¶
type NamedDSFetcher ¶
type NamedDSFetcher interface {
// contains filtered or unexported methods
}
A NamedDSFetcher is a serde.Fetcher which also implements a method for finding DS's by its dotted name using filepath.Match-like syntax.
type NamedDsFetcherStats ¶
type SeriesMap ¶
type SeriesMap map[string]AliasSeries
SeriesMap is a map and should not be confused with series.SeriesSlice. The key distinction is that you cannot "see" beyond a SeriesSlice, it encapsulates and hides all Series within it. E.g. when we compute avg(a, b), we end up with a new series and no longer have access to a or b. This is done by way of SeriesSlice.
The test is whether a "new" series is created. E.g. scale() is given a bunch of series, and returns a bunch of series, so it should use SeriesMap. avg() takes a bunch of series and returns only one series, so it's a SeriesSlice.
SeriesSlice
- based on []Series
- satisfies Series interface
- aligns Series' within it to match on group by
- series in it are not associated with a name (key)
- it's a "mix of series" that can be treated as a series
- supports duplicates
SeriesMap
- alias for map[string]Series
- does NOT implement Series, it's a container of series, but not a series
- is how we give Series names - the key is the name
- does not support duplicates - same series would need different names