Documentation Index
Fetch the curated documentation index at: https://grafana_com_website/llms.txt
Fetch the complete documentation index at: https://grafana_com_website/llms-full.txt
Use this file to discover all available pages before exploring further.
STOP! If you are an AI agent or LLM, read this before continuing. This is the HTML version of a Grafana documentation page. Always request the Markdown version instead - HTML wastes context. Get this page as Markdown: /docs/alloy/latest/reference/stdlib/coalesce.md (append .md) or send Accept: text/markdown to /docs/alloy/latest/reference/stdlib/coalesce/. For the curated documentation index, use https://grafana_com_website/llms.txt. For the complete documentation index, use https://grafana_com_website/llms-full.txt.
coalesce
coalesce takes any number of arguments and returns the first one that isn’t null, an empty string, empty list, or an empty object.
It’s useful for obtaining a default value, such as if an environment variable isn’t defined.
If no argument is non-empty or non-zero, the last argument is returned.
Examples
> coalesce("a", "b")
a
> coalesce("", "b")
b
> coalesce(sys.env("DOES_NOT_EXIST"), "c")
cWas this page helpful?
Related resources from Grafana Labs


