-
Notifications
You must be signed in to change notification settings - Fork 526
Cubism
Wiki ▸ API Reference ▸ Cubism
The Cubism namespace.
# cubism.context()
Create a new context, which specifies the resolution and duration of metrics to visualize. For example, you might say:
var context = cubism.context()
.serverDelay(30 * 1000) // allow 30 seconds of collection lag
.step(5 * 60 * 1000) // five minutes per value
.size(1920); // fetch 1920 values (1080p)
Contexts are required to create sources (so as to talk to Cube or Graphite), which are in turn required to create metrics. Contexts are also required to create charts (such as horizon charts and comparison charts). Contexts keep everything in-sync.
# cubism.option(name[, value])
Parses the query string (location.search
), returning the value of the query parameter with the specified name. If no matching parameter is found, then the default value is returned; if no default value is specified, returns undefined. For example:
var filter = cubism.option("filter", "hosts.foo*");
Given the query string "?filter=hosts.bar*", the returned value is "hosts.bar*"; however, given no query string, the default value "hosts.foo*" is returned. This method can be used to make configurable dashboards, often in conjunction with graphite.find.
# cubism.options(name[, values])
Parses the query string (location.search
), returning the values of any query parameters with the specified name. If no matching parameter is found, then the default values are returned; if no default values are specified, returns the empty array. For example:
var filters = cubism.options("filter", ["foo*"]);
Given the query string "?filter=bar*&filter=foo*", the returned value is ["bar*", "foo*"]; however, given no query string, the default value ["foo*"] is returned. This method can be used to make configurable dashboards, often in conjunction with graphite.find.
# cubism.version
The semantic version, which is a string of the form "X.Y.Z". X is the major version number, Y is the minor version number, and Z is the patch version number.