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.