Skip to content

Commit 402c012

Browse files
General updates and validation of config blocks documentation (#3722) (#3760)
* Updage and align config blocks doc style * Fix broken links * Update sorting of log levels * Update docs/sources/reference/config-blocks/remotecfg.md --------- (cherry picked from commit 84c4a53) Co-authored-by: Sam DeHaan <[email protected]>
1 parent 32cef50 commit 402c012

File tree

13 files changed

+415
-345
lines changed

13 files changed

+415
-345
lines changed

docs/sources/reference/config-blocks/argument.md

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
11
---
22
canonical: https://grafana.com/docs/alloy/latest/reference/config-blocks/argument/
33
description: Learn about the argument configuration block
4-
menuTitle: argument
5-
title: argument block
4+
labels:
5+
stage: general-availability
6+
products:
7+
- oss
8+
title: argument
69
---
710

8-
# argument block
11+
# `argument`
912

1013
`argument` is an optional configuration block used to specify parameterized input to a [custom component][].
1114
`argument` blocks must be given a label which determines the name of the argument.
1215

1316
The `argument` block may only be specified inside the definition of [a `declare` block][declare].
1417

15-
## Example
18+
## Usage
1619

1720
```alloy
18-
argument "ARGUMENT_NAME" {}
21+
argument "<ARGUMENT_NAME>" {}
1922
```
2023

2124
## Arguments
@@ -25,13 +28,13 @@ For clarity, "argument" in this section refers to arguments which can be given t
2528
"Module argument" refers to the argument being defined for a module, determined by the label of the argument block.
2629
{{< /admonition >}}
2730

28-
The following arguments are supported:
31+
You can use the following arguments with `argument`:
2932

30-
Name | Type | Description | Default | Required
31-
-----------|----------|--------------------------------------|---------|---------
32-
`comment` | `string` | Description for the argument. | `false` | no
33-
`default` | `any` | Default value for the argument. | `null` | no
34-
`optional` | `bool` | Whether the argument may be omitted. | `false` | no
33+
| Name | Type | Description | Default | Required |
34+
| ---------- | -------- | ------------------------------------ | ------- | -------- |
35+
| `comment` | `string` | Description for the argument. | `""` | no |
36+
| `default` | `any` | Default value for the argument. | `null` | no |
37+
| `optional` | `bool` | Whether the argument may be omitted. | `false` | no |
3538

3639
By default, all module arguments are required.
3740
The `optional` argument can be used to mark the module argument as optional.
@@ -41,9 +44,9 @@ When `optional` is `true`, the initial value for the module argument is specifie
4144

4245
The following fields are exported and can be referenced by other components:
4346

44-
Name | Type | Description
45-
--------|-------|-----------------------------------
46-
`value` | `any` | The current value of the argument.
47+
| Name | Type | Description |
48+
| ------- | ----- | ---------------------------------- |
49+
| `value` | `any` | The current value of the argument. |
4750

4851
If you use a custom component, you are responsible for determining the values for arguments.
4952
Other expressions within a custom component may use `argument.ARGUMENT_NAME.value` to retrieve the value you provide.

docs/sources/reference/config-blocks/declare.md

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
11
---
22
canonical: https://grafana.com/docs/alloy/latest/reference/config-blocks/declare/
33
description: Learn about the declare configuration block
4-
menuTitle: declare
5-
title: declare block
4+
labels:
5+
stage: general-availability
6+
products:
7+
- oss
8+
title: declare
69
---
710

8-
# declare block
11+
# `declare`
912

1013
`declare` is an optional configuration block used to define a new [custom component][].
1114
`declare` blocks must be given a label that determines the name of the custom component.
1215

13-
## Example
16+
## Usage
1417

1518
```alloy
16-
declare "COMPONENT_NAME" {
17-
COMPONENT_DEFINITION
19+
declare "<COMPONENT_NAME>" {
20+
<COMPONENT_DEFINITION>
1821
}
1922
```
2023

@@ -24,10 +27,10 @@ The `declare` block has no predefined schema for its arguments.
2427
The body of the `declare` block is used as the component definition.
2528
The body can contain the following:
2629

27-
* [argument][] blocks
28-
* [export][] blocks
29-
* [declare][] blocks
30-
* [import][] blocks
30+
* [`argument`][argument] blocks
31+
* [`export`][export] blocks
32+
* [`declare`][declare] blocks
33+
* [`import`][import] blocks
3134
* Component definitions (either built-in or custom components)
3235

3336
The `declare` block may not contain any configuration blocks that aren't listed above.
@@ -63,7 +66,7 @@ self_collect "example" {
6366
6467
prometheus.remote_write "example" {
6568
endpoint {
66-
url = REMOTE_WRITE_URL
69+
url = <REMOTE_WRITE_URL>
6770
}
6871
}
6972
```

docs/sources/reference/config-blocks/export.md

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,35 @@
11
---
22
canonical: https://grafana.com/docs/alloy/latest/reference/config-blocks/export/
33
description: Learn about the export configuration block
4-
menuTitle: export
5-
title: export block
4+
labels:
5+
stage: general-availability
6+
products:
7+
- oss
8+
title: export
69
---
710

8-
# export block
11+
# `export`
912

1013
`export` is an optional configuration block used to specify an emitted value of a [custom component][].
1114
`export` blocks must be given a label which determine the name of the export.
1215

1316
The `export` block may only be specified inside the definition of [a `declare` block][declare].
1417

15-
## Example
18+
## Usage
1619

1720
```alloy
18-
export "ARGUMENT_NAME" {
19-
value = ARGUMENT_VALUE
21+
export "<ARGUMENT_NAME>" {
22+
value = <ARGUMENT_VALUE>
2023
}
2124
```
2225

2326
## Arguments
2427

25-
The following arguments are supported:
28+
You can use the following arguments with `export`:
2629

27-
Name | Type | Description | Default | Required
28-
--------|-------|------------------|---------|---------
29-
`value` | `any` | Value to export. | | yes
30+
| Name | Type | Description | Default | Required |
31+
| ------- | ----- | ---------------- | ------- | -------- |
32+
| `value` | `any` | Value to export. | | yes |
3033

3134
The `value` argument determines what the value of the export is.
3235
To expose an exported field of another component, set `value` to an expression that references that exported value.
@@ -46,7 +49,7 @@ declare "pods_and_nodes" {
4649
}
4750
4851
discovery.kubernetes "nodes" {
49-
role = "nodes"
52+
role = "node"
5053
}
5154
5255
export "kubernetes_resources" {

docs/sources/reference/config-blocks/foreach.md

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
---
2-
canonical: https://grafana.com/docs/alloy/latest/reference/stdlib/foreach/
3-
description: Learn about foreach
2+
canonical: https://grafana.com/docs/alloy/latest/reference/config-blocks/foreach/
3+
description: Learn about the foreach configuration block
44
labels:
55
stage: experimental
6+
products:
7+
- oss
68
menuTitle: foreach
79
title: foreach
810
---
911

10-
# foreach
12+
# `foreach`
1113

1214
{{< docs/shared lookup="stability/experimental_feature.md" source="alloy" version="<ALLOY_VERSION>" >}}
1315

@@ -68,29 +70,28 @@ This results in component paths like the following:
6870
/foreach.pods/foreach_app-2_1/component.default
6971
```
7072

71-
If the collection item is not a object or the specified field doesn't exist, it falls back to using the entire item for identification.
73+
If the collection item isn't an object or the specified field doesn't exist, it falls back to using the entire item for identification.
7274
{{< /admonition >}}
7375

74-
[types]: ../../../get-started/configuration-syntax/expressions/types_and_values
76+
[types]: ../../../get-started/configuration-syntax/expressions/types_and_values/
7577

7678
## Blocks
7779

78-
You can use the following blocks with `foreach`:
80+
You can use the following block with `foreach`:
7981

80-
| Block | Description | Required |
81-
| ------------ | ---------------------------- | -------- |
82-
| [template][] | A component pipeline to run. | yes |
82+
| Block | Description | Required |
83+
| ---------------------- | ---------------------------- | -------- |
84+
| [`template`][template] | A component pipeline to run. | yes |
8385

8486
[template]: #template
8587

8688
### `template`
8789

88-
The `template` block contains the definition of {{< param "PRODUCT_NAME" >}} components which will be ran for every item in the collection.
89-
The contents of the block look like a normal {{< param "PRODUCT_NAME" >}} configuration file,
90-
except that you can use the keyword defined in `var` to refer to the current item in the collection.
90+
The `template` block contains the definition of {{< param "PRODUCT_NAME" >}} components used for every item in the collection.
91+
The contents of the block look like a normal {{< param "PRODUCT_NAME" >}} configuration file, except that you can use the keyword defined in `var` to refer to the current item in the collection.
9192

9293
Components inside the `template` block can use exports of components defined outside of the `foreach` block.
93-
However, components outside of the `foreach` cannot use exports from components defined inside the `template` block of a `foreach`.
94+
However, components outside of the `foreach` can't use exports from components defined inside the `template` block of a `foreach`.
9495

9596
## Example
9697

0 commit comments

Comments
 (0)