<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Expressions on Grafana Labs</title><link>https://grafana.com/docs/agent/v0.41/flow/concepts/config-language/expressions/</link><description>Recent content in Expressions on Grafana Labs</description><generator>Hugo -- gohugo.io</generator><language>en</language><atom:link href="/docs/agent/v0.41/flow/concepts/config-language/expressions/index.xml" rel="self" type="application/rss+xml"/><item><title>Types and values</title><link>https://grafana.com/docs/agent/v0.41/flow/concepts/config-language/expressions/types_and_values/</link><pubDate>Wed, 12 Mar 2025 11:45:31 +0100</pubDate><guid>https://grafana.com/docs/agent/v0.41/flow/concepts/config-language/expressions/types_and_values/</guid><content><![CDATA[&lt;h1 id=&#34;types-and-values&#34;&gt;Types and values&lt;/h1&gt;
&lt;p&gt;River uses the following types for its values:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;number&lt;/code&gt;: Any numeric value, like &lt;code&gt;3&lt;/code&gt; or &lt;code&gt;3.14&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;string&lt;/code&gt;: A sequence of Unicode characters representing text, like &lt;code&gt;&amp;quot;Hello, world!&amp;quot;&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;bool&lt;/code&gt;: A boolean value, either &lt;code&gt;true&lt;/code&gt; or &lt;code&gt;false&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;array&lt;/code&gt;: A sequence of values, like &lt;code&gt;[1, 2, 3]&lt;/code&gt;. Elements within the list are indexed by whole numbers, starting with zero.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;object&lt;/code&gt;: A group of values identified by named labels, like &lt;code&gt;{ name = &amp;quot;John&amp;quot; }&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;function&lt;/code&gt;: A value representing a routine that runs with arguments to compute another value, like &lt;code&gt;env(&amp;quot;HOME&amp;quot;)&lt;/code&gt;.
Functions take zero or more arguments as input and always return a single value as output.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;null&lt;/code&gt;: A type that has no value.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;naming-convention&#34;&gt;Naming convention&lt;/h2&gt;
&lt;p&gt;In addition to the preceding types, the [component reference][] documentation uses the following conventions for referring to types:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;any&lt;/code&gt;: A value of any type.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;map(T)&lt;/code&gt;: an &lt;code&gt;object&lt;/code&gt; with the value type &lt;code&gt;T&lt;/code&gt;.
For example, &lt;code&gt;map(string)&lt;/code&gt; is an object where all the values are strings.
The key type of an object is always a string or an identifier converted into a string.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;list(T)&lt;/code&gt;: an &lt;code&gt;array&lt;/code&gt; with the value type&lt;code&gt;T&lt;/code&gt;.
For example, &lt;code&gt;list(string)&lt;/code&gt; is an array where all the values are strings.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;duration&lt;/code&gt;: a &lt;code&gt;string&lt;/code&gt; denoting a duration of time, such as &lt;code&gt;&amp;quot;1d&amp;quot;&lt;/code&gt;, &lt;code&gt;&amp;quot;1h30m&amp;quot;&lt;/code&gt;, &lt;code&gt;&amp;quot;10s&amp;quot;&lt;/code&gt;.
Valid units are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;d&lt;/code&gt; for days.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;h&lt;/code&gt; for hours.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;m&lt;/code&gt; for minutes.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;s&lt;/code&gt; for seconds.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ms&lt;/code&gt; for milliseconds.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ns&lt;/code&gt; for nanoseconds.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You can combine values of descending units to add their values together. For example, &lt;code&gt;&amp;quot;1h30m&amp;quot;&lt;/code&gt; is the same as &lt;code&gt;&amp;quot;90m&amp;quot;&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;numbers&#34;&gt;Numbers&lt;/h2&gt;
&lt;p&gt;River handles integers, unsigned integers, and floating-point values as a single &amp;rsquo;number&amp;rsquo; type, simplifying writing and reading River configuration files.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Alloy&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-alloy&#34;&gt;3    == 3.00     // true
5.0  == (10 / 2) // true
1e&amp;#43;2 == 100      // true
2e-3 == 0.002    // true&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;strings&#34;&gt;Strings&lt;/h2&gt;
&lt;p&gt;Strings are represented by sequences of Unicode characters surrounded by double quotes &lt;code&gt;&amp;quot;&amp;quot;&lt;/code&gt;.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Alloy&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-alloy&#34;&gt;&amp;#34;Hello, world!&amp;#34;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;A &lt;code&gt;\&lt;/code&gt; in a string starts an escape sequence to represent a special character.
The following table shows the supported escape sequences.&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Sequence&lt;/th&gt;
              &lt;th&gt;Replacement&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;\\&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The &lt;code&gt;\&lt;/code&gt; character &lt;code&gt;U&#43;005C&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;\a&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The alert or bell character &lt;code&gt;U&#43;0007&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;\b&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The backspace character &lt;code&gt;U&#43;0008&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;\f&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The formfeed character &lt;code&gt;U&#43;000C&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;\n&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The newline character &lt;code&gt;U&#43;000A&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;\r&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The carriage return character &lt;code&gt;U&#43;000D&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;\t&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The horizontal tab character &lt;code&gt;U&#43;0009&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;\v&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The vertical tab character &lt;code&gt;U&#43;000B&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;\&#39;&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The &lt;code&gt;&#39;&lt;/code&gt; character &lt;code&gt;U&#43;0027&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;\&amp;quot;&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The &lt;code&gt;&amp;quot;&lt;/code&gt; character &lt;code&gt;U&#43;0022&lt;/code&gt;, which prevents terminating the string&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;\NNN&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;A literal byte (NNN is three octal digits)&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;\xNN&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;A literal byte (NN is two hexadecimal digits)&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;\uNNNN&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;A Unicode character from the basic multilingual plane (NNNN is four hexadecimal digits)&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;\UNNNNNNNN&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;A Unicode character from supplementary planes (NNNNNNNN is eight hexadecimal digits)&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h2 id=&#34;raw-strings&#34;&gt;Raw strings&lt;/h2&gt;
&lt;p&gt;Raw strings are represented by sequences of Unicode characters surrounded by backticks &lt;code&gt;``&lt;/code&gt;.
Raw strings don&amp;rsquo;t support any escape sequences.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Alloy&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-alloy&#34;&gt;`Hello, &amp;#34;world&amp;#34;!`&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Within the backticks, any character may appear except a backtick.
You can include a backtick by concatenating a double-quoted string that contains a backtick using &lt;code&gt;&#43;&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;A multiline raw string is interpreted exactly as written.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Alloy&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-alloy&#34;&gt;`Hello,
&amp;#34;world&amp;#34;!`&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The preceding multiline raw string is interpreted as a string with the following value.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;string&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-string&#34;&gt;Hello,
&amp;#34;world&amp;#34;!&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;bools&#34;&gt;Bools&lt;/h2&gt;
&lt;p&gt;Bools are represented by the symbols &lt;code&gt;true&lt;/code&gt; and &lt;code&gt;false&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id=&#34;arrays&#34;&gt;Arrays&lt;/h2&gt;
&lt;p&gt;You construct arrays with a sequence of comma-separated values surrounded by square brackets &lt;code&gt;[]&lt;/code&gt;.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Alloy&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-alloy&#34;&gt;[0, 1, 2, 3]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;You can place values in array elements on separate lines for readability.
A comma after the final value must be present if the closing bracket &lt;code&gt;]&lt;/code&gt; is on a different line than the final value.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Alloy&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-alloy&#34;&gt;[
  0,
  1,
  2,
]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;objects&#34;&gt;Objects&lt;/h2&gt;
&lt;p&gt;You construct objects with a sequence of comma-separated key-value pairs surrounded by curly braces &lt;code&gt;{}&lt;/code&gt;.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Alloy&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-alloy&#34;&gt;{
  first_name = &amp;#34;John&amp;#34;,
  last_name  = &amp;#34;Doe&amp;#34;,
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;You can omit the comma after the final key-value pair if the closing curly brace &lt;code&gt;}&lt;/code&gt; is on the same line as the final pair.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Alloy&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-alloy&#34;&gt;{ name = &amp;#34;John&amp;#34; }&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;If the key isn&amp;rsquo;t a valid identifier, you must wrap it in double quotes like a string.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Alloy&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-alloy&#34;&gt;{
  &amp;#34;app.kubernetes.io/name&amp;#34;     = &amp;#34;mysql&amp;#34;,
  &amp;#34;app.kubernetes.io/instance&amp;#34; = &amp;#34;mysql-abcxyz&amp;#34;,
  namespace                    = &amp;#34;default&amp;#34;,
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;Don&amp;rsquo;t confuse objects with blocks.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;An &lt;em&gt;object&lt;/em&gt; is a value assigned to an &lt;a href=&#34;../../syntax/#Attributes&#34;&gt;Attribute&lt;/a&gt;. You &lt;strong&gt;must&lt;/strong&gt; use commas between key-value pairs on separate lines.&lt;/li&gt;
&lt;li&gt;A &lt;a href=&#34;../../syntax/#Blocks&#34;&gt;Block&lt;/a&gt; is a named structural element composed of multiple attributes. You &lt;strong&gt;must not&lt;/strong&gt; use commas between attributes.&lt;/li&gt;
&lt;/ul&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;h2 id=&#34;functions&#34;&gt;Functions&lt;/h2&gt;
&lt;p&gt;You can&amp;rsquo;t construct function values. You can call functions from the standard library or export them from a component.&lt;/p&gt;
&lt;h2 id=&#34;null&#34;&gt;Null&lt;/h2&gt;
&lt;p&gt;The null value is represented by the symbol &lt;code&gt;null&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id=&#34;special-types&#34;&gt;Special types&lt;/h2&gt;
&lt;h4 id=&#34;secrets&#34;&gt;Secrets&lt;/h4&gt;
&lt;p&gt;A &lt;code&gt;secret&lt;/code&gt; is a special type of string that&amp;rsquo;s never displayed to the user.
You can assign &lt;code&gt;string&lt;/code&gt; values to an attribute expecting a &lt;code&gt;secret&lt;/code&gt;, but never the inverse.
It&amp;rsquo;s impossible to convert a secret to a string or assign a secret to an attribute expecting a string.&lt;/p&gt;
&lt;h4 id=&#34;capsules&#34;&gt;Capsules&lt;/h4&gt;
&lt;p&gt;A &lt;code&gt;capsule&lt;/code&gt; is a special type that represents a category of &lt;em&gt;internal&lt;/em&gt; types used by Grafana Agent Flow.
Each capsule type has a unique name and is represented to the user as &lt;code&gt;capsule(&amp;quot;&amp;lt;SOME_INTERNAL_NAME&amp;gt;&amp;quot;)&lt;/code&gt;.
You can&amp;rsquo;t construct capsule values. You can use capsules in expressions as any other type.
Capsules aren&amp;rsquo;t inter-compatible, and an attribute expecting a capsule can only be given a capsule of the same internal type.
If an attribute expects a &lt;code&gt;capsule(&amp;quot;prometheus.Receiver&amp;quot;)&lt;/code&gt;, you can only assign a &lt;code&gt;capsule(&amp;quot;prometheus.Receiver&amp;quot;)&lt;/code&gt; type.
The specific type of capsule expected is explicitly documented for any component that uses or exports them.&lt;/p&gt;
&lt;p&gt;In the following example, the &lt;code&gt;prometheus.remote_write&lt;/code&gt; component exports a &lt;code&gt;receiver&lt;/code&gt;, which is a &lt;code&gt;capsule(&amp;quot;prometheus.Receiver&amp;quot;)&lt;/code&gt; type.
You can use this capsule in the &lt;code&gt;forward_to&lt;/code&gt; attribute of &lt;code&gt;prometheus.scrape&lt;/code&gt;, which expects an array of &lt;code&gt;capsule(&amp;quot;prometheus.Receiver&amp;quot;)&lt;/code&gt;.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Alloy&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-alloy&#34;&gt;prometheus.remote_write &amp;#34;default&amp;#34; {
  endpoint {
    url = &amp;#34;http://localhost:9090/api/v1/write&amp;#34;
  }
}

prometheus.scrape &amp;#34;default&amp;#34; {
  targets    = [/* ... */]
  forward_to = [prometheus.remote_write.default.receiver]
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
]]></content><description>&lt;h1 id="types-and-values">Types and values&lt;/h1>
&lt;p>River uses the following types for its values:&lt;/p>
&lt;ul>
&lt;li>&lt;code>number&lt;/code>: Any numeric value, like &lt;code>3&lt;/code> or &lt;code>3.14&lt;/code>.&lt;/li>
&lt;li>&lt;code>string&lt;/code>: A sequence of Unicode characters representing text, like &lt;code>&amp;quot;Hello, world!&amp;quot;&lt;/code>.&lt;/li>
&lt;li>&lt;code>bool&lt;/code>: A boolean value, either &lt;code>true&lt;/code> or &lt;code>false&lt;/code>.&lt;/li>
&lt;li>&lt;code>array&lt;/code>: A sequence of values, like &lt;code>[1, 2, 3]&lt;/code>. Elements within the list are indexed by whole numbers, starting with zero.&lt;/li>
&lt;li>&lt;code>object&lt;/code>: A group of values identified by named labels, like &lt;code>{ name = &amp;quot;John&amp;quot; }&lt;/code>.&lt;/li>
&lt;li>&lt;code>function&lt;/code>: A value representing a routine that runs with arguments to compute another value, like &lt;code>env(&amp;quot;HOME&amp;quot;)&lt;/code>.
Functions take zero or more arguments as input and always return a single value as output.&lt;/li>
&lt;li>&lt;code>null&lt;/code>: A type that has no value.&lt;/li>
&lt;/ul>
&lt;h2 id="naming-convention">Naming convention&lt;/h2>
&lt;p>In addition to the preceding types, the [component reference][] documentation uses the following conventions for referring to types:&lt;/p></description></item><item><title>Referencing component exports</title><link>https://grafana.com/docs/agent/v0.41/flow/concepts/config-language/expressions/referencing_exports/</link><pubDate>Fri, 31 May 2024 15:06:20 +0000</pubDate><guid>https://grafana.com/docs/agent/v0.41/flow/concepts/config-language/expressions/referencing_exports/</guid><content><![CDATA[&lt;h1 id=&#34;referencing-component-exports&#34;&gt;Referencing component exports&lt;/h1&gt;
&lt;p&gt;Referencing exports enables River to configure and connect components dynamically using expressions.
While components can work in isolation, they&amp;rsquo;re more useful when one component&amp;rsquo;s behavior and data flow are bound to the exports of another,
building a dependency relationship between the two.&lt;/p&gt;
&lt;p&gt;Such references can only appear as part of another component&amp;rsquo;s arguments or a configuration block&amp;rsquo;s fields.
Components can&amp;rsquo;t reference themselves.&lt;/p&gt;
&lt;h2 id=&#34;using-references&#34;&gt;Using references&lt;/h2&gt;
&lt;p&gt;You build references by combining the component&amp;rsquo;s name, label, and named export with dots.&lt;/p&gt;
&lt;p&gt;For example, you can reference the contents of a file exported by the &lt;code&gt;local.file&lt;/code&gt; component labeled &lt;code&gt;target&lt;/code&gt; as &lt;code&gt;local.file.target.content&lt;/code&gt;.
Similarly, a &lt;code&gt;prometheus.remote_write&lt;/code&gt; component instance labeled &lt;code&gt;onprem&lt;/code&gt; exposes its receiver for metrics on &lt;code&gt;prometheus.remote_write.onprem.receiver&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The following example shows some references.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Alloy&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-alloy&#34;&gt;local.file &amp;#34;target&amp;#34; {
  filename = &amp;#34;/etc/agent/target&amp;#34;
}

prometheus.scrape &amp;#34;default&amp;#34; {
  targets    = [{ &amp;#34;__address__&amp;#34; = local.file.target.content }]
  forward_to = [prometheus.remote_write.onprem.receiver]
}

prometheus.remote_write &amp;#34;onprem&amp;#34; {
  endpoint {
    url = &amp;#34;http://prometheus:9009/api/prom/push&amp;#34;
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;In the preceding example, you wired together a very simple pipeline by writing a few River expressions.&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;/media/docs/agent/flow_referencing_exports_diagram.svg&#34;
  alt=&#34;Flow of example pipeline&#34;/&gt;&lt;/p&gt;
&lt;p&gt;After the value is resolved, it must match the 
    &lt;a href=&#34;/docs/agent/v0.41/flow/concepts/config-language/expressions/types_and_values/&#34;&gt;type&lt;/a&gt; of the attribute it is assigned to.
While you can only configure attributes using the basic River types,
the exports of components can take on special internal River types, such as Secrets or Capsules, which expose different functionality.&lt;/p&gt;
]]></content><description>&lt;h1 id="referencing-component-exports">Referencing component exports&lt;/h1>
&lt;p>Referencing exports enables River to configure and connect components dynamically using expressions.
While components can work in isolation, they&amp;rsquo;re more useful when one component&amp;rsquo;s behavior and data flow are bound to the exports of another,
building a dependency relationship between the two.&lt;/p></description></item><item><title>Operators</title><link>https://grafana.com/docs/agent/v0.41/flow/concepts/config-language/expressions/operators/</link><pubDate>Fri, 31 May 2024 15:06:20 +0000</pubDate><guid>https://grafana.com/docs/agent/v0.41/flow/concepts/config-language/expressions/operators/</guid><content><![CDATA[&lt;h1 id=&#34;operators&#34;&gt;Operators&lt;/h1&gt;
&lt;p&gt;River uses a common set of operators.
All operations follow the standard &lt;a href=&#34;https://en.wikipedia.org/wiki/Order_of_operations&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;PEMDAS&lt;/a&gt; order of mathematical operations.&lt;/p&gt;
&lt;h2 id=&#34;arithmetic-operators&#34;&gt;Arithmetic operators&lt;/h2&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Operator&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;&#43;&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Adds two numbers.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;-&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Subtracts two numbers.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;*&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Multiplies two numbers.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;/&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Divides two numbers.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;%&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Computes the remainder after dividing two numbers.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;^&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Raises the number to the specified power.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h2 id=&#34;string-operators&#34;&gt;String operators&lt;/h2&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Operator&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;&#43;&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Concatenate two strings.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h2 id=&#34;comparison-operators&#34;&gt;Comparison operators&lt;/h2&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Operator&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;==&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;true&lt;/code&gt; when two values are equal.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;!=&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;true&lt;/code&gt; when two values aren&amp;rsquo;t equal.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;&amp;lt;&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;true&lt;/code&gt; when the left value is less than the right value.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;&amp;lt;=&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;true&lt;/code&gt; when the left value is less than or equal to the right value.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;&amp;gt;&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;true&lt;/code&gt; when the left value is greater than the right value.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;&amp;gt;=&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;true&lt;/code&gt; when the left value is greater or equal to the right value.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;You can apply the equality operators &lt;code&gt;==&lt;/code&gt; and &lt;code&gt;!=&lt;/code&gt; to any operands.&lt;/p&gt;
&lt;p&gt;The two operands in ordering operators &lt;code&gt;&amp;lt;&lt;/code&gt; &lt;code&gt;&amp;lt;=&lt;/code&gt; &lt;code&gt;&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;gt;=&lt;/code&gt;  must both be &lt;em&gt;orderable&lt;/em&gt; and of the same type.
The results of the comparisons are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Boolean values are equal if they&amp;rsquo;re either both true or both false.&lt;/li&gt;
&lt;li&gt;Numerical (integer and floating-point) values are orderable in the usual way.&lt;/li&gt;
&lt;li&gt;String values are orderable lexically byte-wise.&lt;/li&gt;
&lt;li&gt;Objects are equal if all their fields are equal.&lt;/li&gt;
&lt;li&gt;Array values are equal if their corresponding elements are equal.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;logical-operators&#34;&gt;Logical operators&lt;/h2&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Operator&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;&amp;amp;&amp;amp;&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;true&lt;/code&gt; when the both left &lt;em&gt;and&lt;/em&gt; right value are &lt;code&gt;true&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;||&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;true&lt;/code&gt; when the either left &lt;em&gt;or&lt;/em&gt; right value are &lt;code&gt;true&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;!&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Negates a boolean value.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;Logical operators apply to boolean values and yield a boolean result.&lt;/p&gt;
&lt;h2 id=&#34;assignment-operator&#34;&gt;Assignment operator&lt;/h2&gt;
&lt;p&gt;River uses &lt;code&gt;=&lt;/code&gt; as its assignment operator.&lt;/p&gt;
&lt;p&gt;An assignment statement may only assign a single value.
Each value must be &lt;em&gt;assignable&lt;/em&gt; to the attribute or object key.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;You can assign &lt;code&gt;null&lt;/code&gt; to any attribute.&lt;/li&gt;
&lt;li&gt;You can assign numerical, string, boolean, array, function, capsule, and object types to attributes of the corresponding type.&lt;/li&gt;
&lt;li&gt;You can assign numbers to string attributes with an implicit conversion.&lt;/li&gt;
&lt;li&gt;You can assign strings to numerical attributes if they represent a number.&lt;/li&gt;
&lt;li&gt;You can&amp;rsquo;t assign blocks.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;brackets&#34;&gt;Brackets&lt;/h2&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Brackets&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;{ }&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Defines blocks and objects.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;( )&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Groups and prioritizes expressions.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;[ ]&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Defines arrays.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;The following example uses curly braces and square brackets to define an object and an array.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Alloy&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-alloy&#34;&gt;obj = { app = &amp;#34;agent&amp;#34;, namespace = &amp;#34;dev&amp;#34; }
arr = [1, true, 7 * (1&amp;#43;1), 3]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;access-operators&#34;&gt;Access operators&lt;/h2&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Operator&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;[ ]&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Access a member of an array or object.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;.&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Access a named member of an object or an exported field of a component.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;You can access arbitrarily nested values with River&amp;rsquo;s access operators.
You can use square brackets to access zero-indexed array indices and object fields by enclosing the field name in double quotes.
You can use the dot operator to access object fields without double quotes and component exports.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Alloy&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-alloy&#34;&gt;obj[&amp;#34;app&amp;#34;]
arr[1]

obj.app
local.file.token.content&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;If you use the &lt;code&gt;[ ]&lt;/code&gt; operator to access a member of an object where the member doesn&amp;rsquo;t exist, the resulting value is &lt;code&gt;null&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;If you use the &lt;code&gt;.&lt;/code&gt; operator to access a named member of an object where the named member doesn&amp;rsquo;t exist, an error is generated.&lt;/p&gt;
]]></content><description>&lt;h1 id="operators">Operators&lt;/h1>
&lt;p>River uses a common set of operators.
All operations follow the standard &lt;a href="https://en.wikipedia.org/wiki/Order_of_operations" target="_blank" rel="noopener noreferrer">PEMDAS&lt;/a> order of mathematical operations.&lt;/p>
&lt;h2 id="arithmetic-operators">Arithmetic operators&lt;/h2>
&lt;section class="expand-table-wrapper">&lt;div class="button-div">
&lt;button class="expand-table-btn">Expand table&lt;/button>
&lt;/div>&lt;div class="responsive-table-wrapper">
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Operator&lt;/th>
&lt;th>Description&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>&lt;code>+&lt;/code>&lt;/td>
&lt;td>Adds two numbers.&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>-&lt;/code>&lt;/td>
&lt;td>Subtracts two numbers.&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>*&lt;/code>&lt;/td>
&lt;td>Multiplies two numbers.&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>/&lt;/code>&lt;/td>
&lt;td>Divides two numbers.&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>%&lt;/code>&lt;/td>
&lt;td>Computes the remainder after dividing two numbers.&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>^&lt;/code>&lt;/td>
&lt;td>Raises the number to the specified power.&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;/div>
&lt;/section>&lt;h2 id="string-operators">String operators&lt;/h2>
&lt;section class="expand-table-wrapper">&lt;div class="button-div">
&lt;button class="expand-table-btn">Expand table&lt;/button>
&lt;/div>&lt;div class="responsive-table-wrapper">
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Operator&lt;/th>
&lt;th>Description&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>&lt;code>+&lt;/code>&lt;/td>
&lt;td>Concatenate two strings.&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;/div>
&lt;/section>&lt;h2 id="comparison-operators">Comparison operators&lt;/h2>
&lt;section class="expand-table-wrapper">&lt;div class="button-div">
&lt;button class="expand-table-btn">Expand table&lt;/button>
&lt;/div>&lt;div class="responsive-table-wrapper">
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Operator&lt;/th>
&lt;th>Description&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>&lt;code>==&lt;/code>&lt;/td>
&lt;td>&lt;code>true&lt;/code> when two values are equal.&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>!=&lt;/code>&lt;/td>
&lt;td>&lt;code>true&lt;/code> when two values aren&amp;rsquo;t equal.&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>&amp;lt;&lt;/code>&lt;/td>
&lt;td>&lt;code>true&lt;/code> when the left value is less than the right value.&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>&amp;lt;=&lt;/code>&lt;/td>
&lt;td>&lt;code>true&lt;/code> when the left value is less than or equal to the right value.&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>&amp;gt;&lt;/code>&lt;/td>
&lt;td>&lt;code>true&lt;/code> when the left value is greater than the right value.&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>&amp;gt;=&lt;/code>&lt;/td>
&lt;td>&lt;code>true&lt;/code> when the left value is greater or equal to the right value.&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;/div>
&lt;/section>&lt;p>You can apply the equality operators &lt;code>==&lt;/code> and &lt;code>!=&lt;/code> to any operands.&lt;/p></description></item><item><title>Function calls</title><link>https://grafana.com/docs/agent/v0.41/flow/concepts/config-language/expressions/function_calls/</link><pubDate>Fri, 31 May 2024 15:06:20 +0000</pubDate><guid>https://grafana.com/docs/agent/v0.41/flow/concepts/config-language/expressions/function_calls/</guid><content><![CDATA[&lt;h1 id=&#34;function-calls&#34;&gt;Function calls&lt;/h1&gt;
&lt;p&gt;You can use River function calls to build richer expressions.&lt;/p&gt;
&lt;p&gt;Functions take zero or more arguments as their input and always return a single value as their output.
You can&amp;rsquo;t construct functions. You can call functions from River&amp;rsquo;s standard library or export them from a component.&lt;/p&gt;
&lt;p&gt;If a function fails, the expression isn&amp;rsquo;t evaluated, and an error is reported.&lt;/p&gt;
&lt;h2 id=&#34;standard-library-functions&#34;&gt;Standard library functions&lt;/h2&gt;
&lt;p&gt;River contains a 
    &lt;a href=&#34;/docs/agent/v0.41/flow/reference/stdlib/&#34;&gt;standard library&lt;/a&gt; of functions.
Some functions enable interaction with the host system, for example, reading from an environment variable.
Some functions allow for more complex expressions, for example, concatenating arrays or decoding JSON strings into objects.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Alloy&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-alloy&#34;&gt;env(&amp;#34;HOME&amp;#34;)
json_decode(local.file.cfg.content)[&amp;#34;namespace&amp;#34;]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
]]></content><description>&lt;h1 id="function-calls">Function calls&lt;/h1>
&lt;p>You can use River function calls to build richer expressions.&lt;/p>
&lt;p>Functions take zero or more arguments as their input and always return a single value as their output.
You can&amp;rsquo;t construct functions. You can call functions from River&amp;rsquo;s standard library or export them from a component.&lt;/p></description></item></channel></rss>