# README
River
River is an HCL-inspired configuration language originally written for Grafana Agent flow mode with the following goals:
- Fast: River is intended to be used in applications that may evaluate River expression multiple times a second.
- Simple: River must be easy to read and write to minimize the learning curve of yet another configuration language.
- Debuggable: River must give detailed information when there's a mistake in configuration.
// Discover Kubernetes pods to collect metrics from.
discovery.kubernetes "pods" {
role = "pod"
}
// Collect metrics from Kubernetes pods.
prometheus.scrape "default" {
targets = discovery.kubernetes.pods.targets
forward_to = [prometheus.remote_write.default.receiver]
}
// Get an API key from disk.
local.file "apikey" {
filename = "/var/data/my-api-key.txt"
is_secret = true
}
// Send metrics to a Prometheus remote_write endpoint.
prometheus.remote_write "default" {
endpoint {
url = "http://localhost:9009/api/prom/push"
basic_auth {
username = "MY_USERNAME"
password = local.file.apikey.content
}
}
}
For more information on how to use River, see our Go documentation.
# Packages
Package ast exposes AST elements used by River.
No description provided by the author
Package diag exposes error types used throughout River and a method to pretty-print them to the screen.
No description provided by the author
Package parser implements utilities for parsing River configuration files.
Package printer contains utilities for pretty-printing River ASTs.
No description provided by the author
Package scanner implements a lexical scanner for River source files.
Package token defines the lexical elements of a River config and utilities surrounding their position.
Package vm provides a River expression evaluator.
# Functions
Marshal returns the pretty-printed encoding of v as a River configuration file.
MarshalValue returns the pretty-printed encoding of v as a River value.
NewDecoder returns a new Decoder which reads configuration from r.
NewEncoder returns a new Encoder which writes configuration to w.
Unmarshal converts the River configuration file specified by in and stores it in the struct value pointed to by v.
UnmarshalValue converts the River configuration file specified by in and stores it in the value pointed to by v.
# Variables
ErrNoConversion is returned by implementations of ConvertibleFromCapsule and ConvertibleToCapsule when a conversion with a specific type is unavailable.
# Interfaces
Capsule is an interface marker which tells River that a type should always be treated as a "capsule type" instead of the default type River would assign.
ConvertibleFromCapsule is a Capsule which supports custom conversion from any Go type which is not the same as the capsule type.
ConvertibleIntoCapsule is a Capsule which supports custom conversion into any Go type which is not the same as the capsule type.
The Defaulter interface allows a type to implement default functionality in River evaluation.
The Unmarshaler interface allows a type to hook into River decoding and decode into another type or provide pre-decoding logic.
The Validator interface allows a type to implement validation functionality in River evaluation.