Documentation ¶
Overview ¶
Package flow implements the Flow component graph system. Flow configuration files are parsed from River, which contain a listing of components to run.
Components ¶
Each component has a set of arguments (River attributes and blocks) and optionally a set of exported fields. Components can reference the exports of other components using River expressions.
See the top-level component package for more information on components, and subpackages for defined components.
Component Health ¶
A component will have various health states during its lifetime:
- Unknown: The initial health state for new components.
- Healthy: A healthy component
- Unhealthy: An unhealthy component.
- Exited: A component which is no longer running.
Health states are paired with a time for when the health state was generated and a message providing more detail for the health state.
Components can report their own health states. The health state reported by a component is merged with the Flow-level health of that component: an error when evaluating the configuration for a component will always be reported as unhealthy until the next successful evaluation.
Component Evaluation ¶
The process of converting the River block associated with a component into the appropriate Go struct is called "component evaluation."
Components are only evaluated after all components they reference have been evaluated; cyclic dependencies are invalid.
If a component updates its Exports at runtime, other components which directly or indirectly reference the updated component will have their Arguments re-evaluated.
The arguments and exports for a component will be left in their last valid state if a component shuts down or is given an invalid config. This prevents a domino effect of a single failed component taking down other components which are otherwise healthy.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type File ¶
type File struct { Name string // File name given to ReadFile. Node *ast.File // Raw File node. Logging logging.Options // Components holds the list of raw River AST blocks describing components. // The Flow controller can interpret them. Components []*ast.BlockStmt }
File holds the contents of a parsed Flow file.
type Flow ¶
type Flow struct {
// contains filtered or unexported fields
}
Flow is the Flow system.
func (*Flow) ConfigHandler ¶
func (f *Flow) ConfigHandler() http.HandlerFunc
ConfigHandler returns an http.HandlerFunc which will render the most recently loaded configuration file as River.
func (*Flow) GraphHandler ¶
func (f *Flow) GraphHandler() http.HandlerFunc
GraphHandler returns an http.HandlerFunc which renders the current graph's DAG as an SVG. Graphviz must be installed for this function to work.
func (*Flow) LoadFile ¶
LoadFile synchronizes the state of the controller with the current config file. Components in the graph will be marked as unhealthy if there was an error encountered during Load.
The controller will only start running components after Load is called once without any configuration errors.
func (*Flow) ScopeHandler ¶ added in v0.27.0
func (f *Flow) ScopeHandler() http.HandlerFunc
ScopeHandler returns an http.HandlerFunc which will render the scope used for variable references throughout River expressions.
type Options ¶
type Options struct { // Logger for components to use. A no-op logger will be created if this is // nil. Logger *logging.Logger // Directory where components can write data. Components will create // subdirectories for component-specific data. DataPath string // Reg is the prometheus register to use Reg prometheus.Registerer }
Options holds static options for a flow controller.
Directories ¶
Path | Synopsis |
---|---|
Package componenttest provides utilities for testing Flow components.
|
Package componenttest provides utilities for testing Flow components. |
internal
|
|
dag
Package dag defines a Directed Acyclic Graph.
|
Package dag defines a Directed Acyclic Graph. |
graphviz
Package graphviz implements some graphviz utilities.
|
Package graphviz implements some graphviz utilities. |
testcomponents
Package testcomponents contains components useful for testing.
|
Package testcomponents contains components useful for testing. |