Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move "configuration language" section to "concepts" #6033

Merged
merged 4 commits into from
Jan 4, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions docs/sources/flow/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,12 @@ This feature is experimental, and it doesn't support all River components.
* Learn about the core [Concepts][] of {{< param "PRODUCT_NAME" >}}.
* Follow our [Getting started][] guides for {{< param "PRODUCT_NAME" >}}.
* Follow our [Tutorials][] to get started with {{< param "PRODUCT_NAME" >}}.
* Learn how to use the [Configuration language][].
* Check out our [Reference][] documentation to find specific information you
might be looking for.

[Install]: {{< relref "./setup/install/" >}}
[Concepts]: {{< relref "./concepts/" >}}
[Getting started]: {{< relref "./getting-started/" >}}
[Tutorials]: {{< relref "./tutorials/ ">}}
[Configuration language]: {{< relref "./config-language/" >}}
[Reference]: {{< relref "./reference" >}}

Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
---
aliases:
- /docs/grafana-cloud/agent/flow/concepts/config-language/
- /docs/grafana-cloud/monitor-infrastructure/agent/flow/concepts/config-language/
- /docs/grafana-cloud/monitor-infrastructure/integrations/agent/flow/concepts/config-language/
- /docs/grafana-cloud/send-data/agent/flow/concepts/config-language/
- configuration-language/ # /docs/agent/latest/flow/concepts/configuration-language/
# Previous page aliases for backwards compatibility:
- /docs/grafana-cloud/agent/flow/config-language/
- /docs/grafana-cloud/monitor-infrastructure/agent/flow/config-language/
- /docs/grafana-cloud/monitor-infrastructure/integrations/agent/flow/config-language/
- /docs/grafana-cloud/send-data/agent/flow/config-language/
- configuration-language/
canonical: https://grafana.com/docs/agent/latest/flow/config-language/
- ../configuration-language/ # /docs/agent/latest/flow/configuration-language/
canonical: https://grafana.com/docs/agent/latest/flow/concepts/config-language/
description: Learn about the configuration language
title: Configuration language
weight: 400
weight: 10
---

# Configuration language
Expand Down Expand Up @@ -42,7 +48,13 @@ BLOCK_NAME {
}
```

[River][RFC] is similar to HCL, the language Terraform and other Hashicorp projects use.
[River is designed][RFC] with the following requirements in mind:
thampiotr marked this conversation as resolved.
Show resolved Hide resolved

* _Fast_: The configuration language must be fast so the component controller can quickly evaluate changes.
* _Simple_: The configuration language must be easy to read and write to minimize the learning curve.
* _Debuggable_: The configuration language must give detailed information when there's a mistake in the configuration file.

River is similar to HCL, the language Terraform and other Hashicorp projects use.
It's a distinct language with custom syntax and features, such as first-class functions.

* Blocks are a group of related settings and usually represent creating a component.
Expand All @@ -54,6 +66,57 @@ It's a distinct language with custom syntax and features, such as first-class fu
River is declarative, so ordering components, blocks, and attributes within a block isn't significant.
The relationship between components determines the order of operations.

## Attributes

You use _Attributes_ to configure individual settings.
Attributes always take the form of `ATTRIBUTE_NAME = ATTRIBUTE_VALUE`.

The following example shows how to set the `log_level` attribute to `"debug"`.

```river
log_level = "debug"
```

## Expressions

You use expressions to compute the value of an attribute.
The simplest expressions are constant values like `"debug"`, `32`, or `[1, 2, 3, 4]`.
River supports complex expressions, for example:

* Referencing the exports of components: `local.file.password_file.content`
* Mathematical operations: `1 + 2`, `3 * 4`, `(5 * 6) + (7 + 8)`
* Equality checks: `local.file.file_a.content == local.file.file_b.content`
* Calling functions from River's standard library: `env("HOME")` retrieves the value of the `HOME` environment variable.

You can use expressions for any attribute inside a component definition.

### Referencing component exports

The most common expression is to reference the exports of a component, for example, `local.file.password_file.content`.
You form a reference to a component's exports by merging the component's name (for example, `local.file`),
label (for example, `password_file`), and export name (for example, `content`), delimited by a period.

## Blocks

You use _Blocks_ to configure components and groups of attributes.
Each block can contain any number of attributes or nested blocks.

```river
prometheus.remote_write "default" {
endpoint {
url = "http://localhost:9009/api/prom/push"
}
}
```

The preceding example has two blocks:

* `prometheus.remote_write "default"`: A labeled block which instantiates a `prometheus.remote_write` component.
The label is the string `"default"`.
* `endpoint`: An unlabeled block inside the component that configures an endpoint to send metrics to.
This block sets the `url` attribute to specify the endpoint.


## Tooling

You can use one or all of the following tools to help you write configuration files in River.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
---
aliases:
- ../configuration-language/components/
- ../configuration-language/components/ # /docs/agent/latest/flow/concepts/configuration-language/components/
- /docs/grafana-cloud/agent/flow/concepts/config-language/components/
- /docs/grafana-cloud/monitor-infrastructure/agent/flow/concepts/config-language/components/
- /docs/grafana-cloud/monitor-infrastructure/integrations/agent/flow/concepts/config-language/components/
- /docs/grafana-cloud/send-data/agent/flow/concepts/config-language/components/
# Previous page aliases for backwards compatibility:
- ../../configuration-language/components/ # /docs/agent/latest/flow/configuration-language/components/
- /docs/grafana-cloud/agent/flow/config-language/components/
- /docs/grafana-cloud/monitor-infrastructure/agent/flow/config-language/components/
- /docs/grafana-cloud/monitor-infrastructure/integrations/agent/flow/config-language/components/
- /docs/grafana-cloud/send-data/agent/flow/config-language/components/
canonical: https://grafana.com/docs/agent/latest/flow/config-language/components/
canonical: https://grafana.com/docs/agent/latest/flow/concepts/config-language/components/
description: Learn about the components configuration language
title: Components configuration language
weight: 300
Expand Down Expand Up @@ -93,6 +99,6 @@ The value is type-checked and substituted into `prometheus.scrape.default`, wher
[components]: "/docs/grafana-cloud/ -> /docs/grafana-cloud/send-data/agent/flow/reference/components"
[controller]: "/docs/agent/ -> /docs/agent/<AGENT_VERSION>/flow/concepts/component_controller"
[controller]: "/docs/grafana-cloud/ -> /docs/grafana-cloud/send-data/agent/flow/concepts/component_controller"
[type]: "/docs/agent/ -> /docs/agent/<AGENT_VERSION>/flow/config-language/expressions/types_and_values"
[type]: "/docs/grafana-cloud/ -> /docs/grafana-cloud/send-data/agent/flow/config-language/expressions/types_and_values"
[type]: "/docs/agent/ -> /docs/agent/<AGENT_VERSION>/flow/concepts/config-language/expressions/types_and_values"
[type]: "/docs/grafana-cloud/ -> /docs/grafana-cloud/send-data/agent/flow/concepts/config-language/expressions/types_and_values"
{{% /docs/reference %}}
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
---
aliases:
- ../configuration-language/expressions/
- ../configuration-language/expressions/ # /docs/agent/latest/flow/concepts/configuration-language/expressions/
- /docs/grafana-cloud/agent/flow/concepts/config-language/expressions/
- /docs/grafana-cloud/monitor-infrastructure/agent/flow/concepts/config-language/expressions/
- /docs/grafana-cloud/monitor-infrastructure/integrations/agent/flow/concepts/config-language/expressions/
- /docs/grafana-cloud/send-data/agent/flow/concepts/config-language/expressions/
# Previous page aliases for backwards compatibility:
- ../../configuration-language/expressions/ # /docs/agent/latest/flow/configuration-language/expressions/
- /docs/grafana-cloud/agent/flow/config-language/expressions/
- /docs/grafana-cloud/monitor-infrastructure/agent/flow/config-language/expressions/
- /docs/grafana-cloud/monitor-infrastructure/integrations/agent/flow/config-language/expressions/
- /docs/grafana-cloud/send-data/agent/flow/config-language/expressions/
canonical: https://grafana.com/docs/agent/latest/flow/config-language/expressions/
canonical: https://grafana.com/docs/agent/latest/flow/concepts/config-language/expressions/
description: Learn about expressions
title: Expressions
weight: 400
Expand All @@ -23,10 +29,10 @@ All component arguments have an underlying [type][].
River checks the expression type before assigning the result to an attribute.

{{% docs/reference %}}
[refer to values]: "/docs/agent/ -> /docs/agent/<AGENT_VERSION>/flow/config-language/expressions/referencing_exports"
[refer to values]: "/docs/grafana-cloud/ -> /docs/grafana-cloud/send-data/agent/flow/config-language/expressions/referencing_exports"
[call functions]: "/docs/agent/ -> /docs/agent/<AGENT_VERSION>/flow/config-language/expressions/function_calls"
[call functions]: "/docs/grafana-cloud/ -> /docs/grafana-cloud/send-data/agent/flow/config-language/expressions/function_calls"
[type]: "/docs/agent/ -> /docs/agent/<AGENT_VERSION>/flow/config-language/expressions/types_and_values"
[type]: "/docs/grafana-cloud/ -> /docs/grafana-cloud/send-data/agent/flow/config-language/expressions/types_and_values"
[refer to values]: "/docs/agent/ -> /docs/agent/<AGENT_VERSION>/flow/concepts/config-language/expressions/referencing_exports"
[refer to values]: "/docs/grafana-cloud/ -> /docs/grafana-cloud/send-data/agent/flow/concepts/config-language/expressions/referencing_exports"
[call functions]: "/docs/agent/ -> /docs/agent/<AGENT_VERSION>/flow/concepts/config-language/expressions/function_calls"
[call functions]: "/docs/grafana-cloud/ -> /docs/grafana-cloud/send-data/agent/flow/concepts/config-language/expressions/function_calls"
[type]: "/docs/agent/ -> /docs/agent/<AGENT_VERSION>/flow/concepts/config-language/expressions/types_and_values"
[type]: "/docs/grafana-cloud/ -> /docs/grafana-cloud/send-data/agent/flow/concepts/config-language/expressions/types_and_values"
{{% /docs/reference %}}
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
---
aliases:
- ../../configuration-language/expressions/function-calls/
- ../../configuration-language/expressions/function-calls/ # /docs/agent/latest/flow/concepts/configuration-language/expressions/function-calls/
- /docs/grafana-cloud/agent/flow/concepts/config-language/expressions/function_calls/
- /docs/grafana-cloud/monitor-infrastructure/agent/flow/concepts/config-language/expressions/function_calls/
- /docs/grafana-cloud/monitor-infrastructure/integrations/agent/flow/concepts/config-language/expressions/function_calls/
- /docs/grafana-cloud/send-data/agent/flow/concepts/config-language/expressions/function_calls/
# Previous page aliases for backwards compatibility:
- ../../../configuration-language/expressions/function-calls/ # /docs/agent/latest/flow/configuration-language/expressions/function-calls/
- /docs/grafana-cloud/agent/flow/config-language/expressions/function_calls/
- /docs/grafana-cloud/monitor-infrastructure/agent/flow/config-language/expressions/function_calls/
- /docs/grafana-cloud/monitor-infrastructure/integrations/agent/flow/config-language/expressions/function_calls/
- /docs/grafana-cloud/send-data/agent/flow/config-language/expressions/function_calls/
canonical: https://grafana.com/docs/agent/latest/flow/config-language/expressions/function_calls/
canonical: https://grafana.com/docs/agent/latest/flow/concepts/config-language/expressions/function_calls/
description: Learn about function calls
title: Function calls
weight: 400
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
---
aliases:
- ../../configuration-language/expressions/operators/
- ../../configuration-language/expressions/operators/ # /docs/agent/latest/flow/concepts/configuration-language/expressions/operators/
- /docs/grafana-cloud/agent/flow/concepts/config-language/expressions/operators/
- /docs/grafana-cloud/monitor-infrastructure/agent/flow/concepts/config-language/expressions/operators/
- /docs/grafana-cloud/monitor-infrastructure/integrations/agent/flow/concepts/config-language/expressions/operators/
- /docs/grafana-cloud/send-data/agent/flow/concepts/config-language/expressions/operators/
# Previous page aliases for backwards compatibility:
- ../../../configuration-language/expressions/operators/ # /docs/agent/latest/flow/configuration-language/expressions/operators/
- /docs/grafana-cloud/agent/flow/config-language/expressions/operators/
- /docs/grafana-cloud/monitor-infrastructure/agent/flow/config-language/expressions/operators/
- /docs/grafana-cloud/monitor-infrastructure/integrations/agent/flow/config-language/expressions/operators/
- /docs/grafana-cloud/send-data/agent/flow/config-language/expressions/operators/
canonical: https://grafana.com/docs/agent/latest/flow/config-language/expressions/operators/
canonical: https://grafana.com/docs/agent/latest/flow/concepts/config-language/expressions/operators/
description: Learn about operators
title: Operators
weight: 300
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
---
aliases:
- ../../configuration-language/expressions/referencing-exports/
- ../../configuration-language/expressions/referencing-exports/ # /docs/agent/latest/flow/concepts/configuration-language/expressions/referencing-exports/
- /docs/grafana-cloud/agent/flow/concepts/config-language/expressions/referencing_exports/
- /docs/grafana-cloud/monitor-infrastructure/agent/flow/concepts/config-language/expressions/referencing_exports/
- /docs/grafana-cloud/monitor-infrastructure/integrations/agent/flow/concepts/config-language/expressions/referencing_exports/
- /docs/grafana-cloud/send-data/agent/flow/concepts/config-language/expressions/referencing_exports/
# Previous page aliases for backwards compatibility:
- ../../../configuration-language/expressions/referencing-exports/ # /docs/agent/latest/flow/configuration-language/expressions/referencing-exports/
- /docs/grafana-cloud/agent/flow/config-language/expressions/referencing_exports/
- /docs/grafana-cloud/monitor-infrastructure/agent/flow/config-language/expressions/referencing_exports/
- /docs/grafana-cloud/monitor-infrastructure/integrations/agent/flow/config-language/expressions/referencing_exports/
- /docs/grafana-cloud/send-data/agent/flow/config-language/expressions/referencing_exports/
canonical: https://grafana.com/docs/agent/latest/flow/config-language/expressions/referencing_exports/
canonical: https://grafana.com/docs/agent/latest/flow/concepts/config-language/expressions/referencing_exports/
description: Learn about referencing component exports
title: Referencing component exports
weight: 200
Expand Down Expand Up @@ -55,6 +61,6 @@ 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.

{{% docs/reference %}}
[type]: "/docs/agent/ -> /docs/agent/<AGENT_VERSION>/flow/config-language/expressions/types_and_values"
[type]: "/docs/grafana-cloud/ -> /docs/grafana-cloud/send-data/agent/flow/config-language/expressions/types_and_values"
[type]: "/docs/agent/ -> /docs/agent/<AGENT_VERSION>/flow/concepts/config-language/expressions/types_and_values"
[type]: "/docs/grafana-cloud/ -> /docs/grafana-cloud/send-data/agent/flow/concepts/config-language/expressions/types_and_values"
{{% /docs/reference %}}
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
---
aliases:
- ../../configuration-language/expressions/types-and-values/
- ../../configuration-language/expressions/types-and-values/ # /docs/agent/latest/flow/concepts/configuration-language/expressions/types-and-values/
- /docs/grafana-cloud/agent/flow/concepts/config-language/expressions/types_and_values/
- /docs/grafana-cloud/monitor-infrastructure/agent/flow/concepts/config-language/expressions/types_and_values/
- /docs/grafana-cloud/monitor-infrastructure/integrations/agent/flow/concepts/config-language/expressions/types_and_values/
- /docs/grafana-cloud/send-data/agent/flow/concepts/config-language/expressions/types_and_values/
# Previous page aliases for backwards compatibility:
- ../../../configuration-language/expressions/types-and-values/ # /docs/agent/latest/flow/configuration-language/expressions/types-and-values/
- /docs/grafana-cloud/agent/flow/config-language/expressions/types_and_values/
- /docs/grafana-cloud/monitor-infrastructure/agent/flow/config-language/expressions/types_and_values/
- /docs/grafana-cloud/monitor-infrastructure/integrations/agent/flow/config-language/expressions/types_and_values/
- /docs/grafana-cloud/send-data/agent/flow/config-language/expressions/types_and_values/
canonical: https://grafana.com/docs/agent/latest/flow/config-language/expressions/types_and_values/
canonical: https://grafana.com/docs/agent/latest/flow/concepts/config-language/expressions/types_and_values/
description: Learn about the River types and values
title: Types and values
weight: 100
Expand Down Expand Up @@ -161,7 +167,7 @@ If the key isn't a valid identifier, you must wrap it in double quotes like a st
}
```

{{% admonition type="Note" %}}
{{% admonition type="note" %}}
Don't confuse objects with blocks.

* An _object_ is a value assigned to an [Attribute][]. You **must** use commas between key-value pairs on separate lines.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
---
aliases:
- ../configuration-language/files/
- ../configuration-language/files/ # /docs/agent/latest/flow/concepts/configuration-language/files/
- /docs/grafana-cloud/agent/flow/concepts/config-language/files/
- /docs/grafana-cloud/monitor-infrastructure/agent/flow/concepts/config-language/files/
- /docs/grafana-cloud/monitor-infrastructure/integrations/agent/flow/concepts/config-language/files/
- /docs/grafana-cloud/send-data/agent/flow/concepts/config-language/files/
# Previous page aliases for backwards compatibility:
- ../../configuration-language/files/ # /docs/agent/latest/flow/configuration-language/files/
- /docs/grafana-cloud/agent/flow/config-language/files/
- /docs/grafana-cloud/monitor-infrastructure/agent/flow/config-language/files/
- /docs/grafana-cloud/monitor-infrastructure/integrations/agent/flow/config-language/files/
- /docs/grafana-cloud/send-data/agent/flow/config-language/files/
canonical: https://grafana.com/docs/agent/latest/flow/config-language/files/
canonical: https://grafana.com/docs/agent/latest/flow/concepts/config-language/files/
description: Learn about River files
title: Files
weight: 100
Expand Down
Loading