grafana / river

HCL-inspired configuration built for Grafana Agent

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Deprecation notice: River has been moved to the Grafana Alloy repository under the "syntax" submodule, and is now called the "Grafana Alloy configuration syntax."

For more information, read our blog posts about Alloy and how to easily migrate from Agent to Alloy:

River

Go Reference

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.

About

HCL-inspired configuration built for Grafana Agent

License:Apache License 2.0


Languages

Language:Go 100.0%Language:Makefile 0.0%