Caution
Grafana Alloy is the new name for our distribution of the OTel collector. Grafana Agent has been deprecated and is in Long-Term Support (LTS) through October 31, 2025. Grafana Agent will reach an End-of-Life (EOL) on November 1, 2025. Read more about why we recommend migrating to Grafana Alloy.
Important: This documentation is about an older version. It's relevant only to the release noted, many of the features and functions have been updated or replaced. Please view the current version.
Function calls
Function calls is one more River feature that lets users build richer expressions.
Functions take zero or more arguments as their input and always return a single value as their output. Functions cannot be constructed by users, but can be either called from River’s standard library, or when exported by a component.
In case a function fails, the expression will not be evaluated and an error will be reported.
Standard library functions
River contains a standard library of useful functions. Some enable interaction with the host system (e.g. reading from an environment variable), or allow for more complex expressions (e.g. concatenating arrays or decoding JSON strings into objects).
env("HOME")
json_decode(local.file.cfg.content)["namespace"]