Skip to content

Commit

Permalink
Flow reuse updates (grafana#2368)
Browse files Browse the repository at this point in the history
* Created new folder structure for flow reuse

* Added shared blocks

* Revert "Created new folder structure for flow reuse"

This reverts commit 19971ce.

Co-authored-by: Robert Fratto <robertfratto@gmail.com>
  • Loading branch information
karengermond and rfratto committed Oct 17, 2022
1 parent 99be164 commit db43e16
Show file tree
Hide file tree
Showing 15 changed files with 156 additions and 255 deletions.
75 changes: 5 additions & 70 deletions docs/sources/flow/reference/components/discovery.kubernetes.md
Original file line number Diff line number Diff line change
Expand Up @@ -289,88 +289,23 @@ selectors][] to learn more about the possible filters that can be used.

### http_client_config block

The `http_client_config` block configures settings used to connect to the
Kubernetes API server.

Name | Type | Description | Default | Required
---- | ---- | ----------- | ------- | --------
`bearer_token` | `secret` | Bearer token to authenticate with. | | no
`bearer_token_file` | `string` | File containing a bearer token to authenticate with. | | no
`proxy_url` | `string` | HTTP proxy to proxy requests through. | | no
`follow_redirects` | `bool` | Whether redirects returned by the server should be followed. | `true` | no
`enable_http_2` | `bool` | Whether HTTP2 is supported for requests. | `true` | no

`bearer_token`, `bearer_token_file`, `basic_auth`, `authorization`, and
`oauth2` are mutually exclusive and only one can be provided inside of a
`http_client_config` block.

The following sub-blocks are supported for `http_client_config`:

Name | Description | Required
---- | ----------- | --------
[`basic_auth`](#basic_auth-block) | Configure basic_auth for authenticating against Kubernetes. | no
[`authorization`](#authorization-block) | Configure generic authorization against Kubernetes. | no
[`oauth2`](#oauth2-block) | Configure OAuth2 for authenticating against Kubernetes. | no
[`tls_config`](#tls_config-block) | Configure TLS settings for connecting to Kubernetes. | no
{{< docs/shared lookup="flow/reference/components/http-client-config-block.md" source="agent" >}}

### basic_auth block

Name | Type | Description | Default | Required
---- | ---- | ----------- | ------- | --------
`username` | `string` | Basic auth username. | | no
`password` | `secret` | Basic auth password. | | no
`password_file` | `string` | File containing the basic auth password. | | no

`password` and `password_file` are mututally exclusive and only one can be
provided inside of a `basic_auth` block.
{{< docs/shared lookup="flow/reference/components/basic-auth-block.md" source="agent" >}}

### authorization block

Name | Type | Description | Default | Required
---- | ---- | ----------- | ------- | --------
`type` | `string` | Authorization type, for example, "Bearer". | | no
`credential` | `secret` | Secret value. | | no
`credentials_file` | `string` | File containing the secret value. | | no

`credential` and `credentials_file` are mututally exclusive and only one can be
provided inside of an `authorization` block.
{{< docs/shared lookup="flow/reference/components/authorization-block.md" source="agent" >}}

### oauth2 block

Name | Type | Description | Default | Required
---- | ---- | ----------- | ------- | --------
`client_id` | `string` | OAuth2 client ID. | | no
`client_secret` | `secret` | OAuth2 client secret. | | no
`client_secret_file` | `string` | File containing the OAuth2 client secret. | | no
`scopes` | `list(string)` | List of scopes to authenticate with. | | no
`token_url` | `string` | URL to fetch the token from. | | no
`endpoint_params` | `map(string)` | Optional parameters to append to the token URL. | | no
`proxy_url` | `string` | Optional proxy URL for OAuth2 requests. | | no

`client_secret` and `client_secret_file` are mututally exclusive and only one
can be provided inside of an `oauth2` block.

The `oauth2` block may also contain its own separate `tls_config` sub-block.
{{< docs/shared lookup="flow/reference/components/oauth2-block.md" source="agent" >}}

### tls_config block

Name | Type | Description | Default | Required
---- | ---- | ----------- | ------- | --------
`ca_file` | `string` | CA certificate to validate the server with. | | no
`cert_file` | `string` | Certificate file for client authentication. | | no
`key_file` | `string` | Key file for client authentication. | | no
`server_name` | `string` | ServerName extension to indicate the name of the server. | | no
`insecure_skip_verify` | `bool` | Disables validation of the server certificate. | | no
`min_version` | `string` | Minimum acceptable TLS version. | | no

When `min_version` is not provided, the minumum acceptable TLS version is
inherited from Go's default minimum version, TLS 1.2. If `min_version` is
provided, it must be set to one of the following strings:

* `"TLS10"` (TLS 1.0)
* `"TLS11"` (TLS 1.1)
* `"TLS12"` (TLS 1.2)
* `"TLS13"` (TLS 1.3)
{{< docs/shared lookup="flow/reference/components/tls-config-block.md" source="agent" >}}

## Exported fields

Expand Down
31 changes: 1 addition & 30 deletions docs/sources/flow/reference/components/discovery.relabel.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,36 +66,7 @@ rule | [rule][] | Relabeling rules to apply to targets. | no

### rule block

The `rule` block contains the definition of any relabeling rules that
can be applied to an input target. If more than one `rule` block is
defined within `discovery.relabel`, the transformations are applied
in top-down order.

The following arguments can be used to configure a `rule` block.
All arguments are optional and any omitted fields take on their default
values.

Name | Type | Description | Default | Required
---- | ---- | ----------- | ------- | --------
`source_labels` | `list(string)` | The list of labels whose values should be selected. Their content is concatenated using the `separator` and matched against `regex`. | | no
`separator` | `string` | The separator used to concatenate the values present in `source_labels`. | `;` | no
`regex` | `string` | A valid RE2 expression with support for parenthesized capture groups. Used to match the extracted value from the combination of the `source_label` and `separator` fields or filter labels during the labelkeep/labeldrop/labelmap actions. | `(.*)` | no
`modulus` | `uint` | A positive integer used to calculate the modulus of the hashed source label values. | | no
`target_label` | `string` | Label to which the resulting value are written to. | | no
`replacement` | `string` | The value against which a regex replace is performed, if the regex matched the extracted value. Supports previously captured groups. | `$1` | no
`action` | `string` | The relabeling action to perform. | `replace` | no

Here's a list of the available actions along with a brief description of their usage.

* `replace` - This action matches `regex` to the concatenated labels. If there's a match, it replaces the content of the `target_label` using the contents of the `replacement` field.
* `keep` - This action only keeps the targets where `regex` matches the string extracted using the `source_labels` and `separator`.
* `drop` - This action drops the targets where `regex` matches the string extracted using the `source_labels` and `separator`.
* `hashmod` - This action hashes the concatenated labels, calculates its modulo `modulus` and writes the result to the `target_label`.
* `labelmap` - This action matches `regex` against all label names. Any labels that match are renamed according to the contents of the `replacement` field.
* `labeldrop` - This action matches `regex` against all label names. Any labels that match are removed from the target's label set.
* `labelkeep` - This action matches `regex` against all label names. Any labels that don't match are removed from the target's label set.

Finally, note that the regex capture groups can be referred to using either the `$1` or `$${1}` notation.
{{< docs/shared lookup="flow/reference/components/rule-block.md" source="agent" >}}

## Exported fields

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ output | [output][] | Configures where to send received telemetry data. | yes

### output block

{{< docs/shared lookup="flow/otelcol/output-block.md" source="agent" >}}
{{< docs/shared lookup="flow/reference/components/output-block.md" source="agent" >}}

## Exported fields

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ Name | Type | Description | Default | Required

### output block

{{< docs/shared lookup="flow/otelcol/output-block.md" source="agent" >}}
{{< docs/shared lookup="flow/reference/components/output-block.md" source="agent" >}}

## Exported fields

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ If `allowed_headers` includes `"*"`, all headers will be permitted.

### output block

{{< docs/shared lookup="flow/otelcol/output-block.md" source="agent" >}}
{{< docs/shared lookup="flow/reference/components/output-block.md" source="agent" >}}

## Exported fields

Expand Down
31 changes: 1 addition & 30 deletions docs/sources/flow/reference/components/prometheus.relabel.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,36 +63,7 @@ rule | [rule][] | Relabeling rules to apply to received metrics. | no

### rule block

The `rule` block contains the definition of any relabeling
rules that can be applied to an input metric. If more than one
`rule` block is defined within `prometheus.relabel`, the
transformations are applied in top-down order.

The following arguments can be used to configure a `rule`.
All arguments are optional. Omitted fields take their default values.

Name | Type | Description | Default | Required
---- | ---- | ----------- | ------- | --------
`source_labels` | `list(string)` | The list of labels whose values are to be selected. Their content is concatenated using the `separator` and matched against `regex`. | | no
`separator` | `string` | The separator used to concatenate the values present in `source_labels`. | ; | no
`regex` | `string` | A valid RE2 expression with support for parenthesized capture groups. Used to match the extracted value from the combination of the `source_label` and `separator` fields or filter labels during the `labelkeep/labeldrop/labelmap` actions. | `(.*)` | no
`modulus` | `uint` | A positive integer used to calculate the modulus of the hashed source label values. | | no
`target_label` | `string` | Label to which the resulting value will be written to. | | no
`replacement` | `string` | The value against which a regex replace is performed, if the regex matches the extracted value. Supports previously captured groups. | $1 | no
`action` | `string` | The relabeling action to perform. | replace | no

Here's a list of the available actions, along with a brief description of their usage.

* `replace` - Matches `regex` to the concatenated labels. If there's a match, it replaces the content of the `target_label` using the contents of the `replacement` field.
* `keep` - Keeps metrics where `regex` matches the string extracted using the `source_labels` and `separator`.
* `drop` - Drops metrics where `regex` matches the string extracted using the `source_labels` and `separator`.
* `hashmod` - Hashes the concatenated labels, calculates its modulo `modulus` and writes the result to the `target_label`.
* `labelmap` - Matches `regex` against all label names. Any labels that match are renamed according to the contents of the `replacement` field.
* `labeldrop` - Matches `regex` against all label names. Any labels that match are removed from the metric's label set.
* `labelkeep` - Matches `regex` against all label names. Any labels that don't match are removed from the metric's label set.

Finally, note that the regex capture groups can be referred to using either the
`$1` or `$${1}` notation.
{{< docs/shared lookup="flow/reference/components/rule-block.md" source="agent" >}}

## Exported fields

Expand Down
66 changes: 5 additions & 61 deletions docs/sources/flow/reference/components/prometheus.remote_write.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,79 +96,23 @@ based on a hash of the endpoint settings.

### http_client_config block

The `http_client_config` block configures the HTTP client used to connect to an
endpoint.

The following arguments are supported:

Name | Type | Description | Default | Required
---- | ---- | ----------- | ------- | --------
`bearer_token` | `secret` | Bearer token to authenticate with. | | no
`bearer_token_file` | `string` | File containing a bearer token to authenticate with. | | no
`proxy_url` | `string` | HTTP proxy to proxy requests through. | | no
`follow_redirects` | `bool` | Whether redirects returned by the server should be followed. | `true` | no
`enable_http_2` | `bool` | Whether HTTP2 is supported for requests. | `true` | no

`bearer_token`, `bearer_token_file`, `basic_auth`, `authorization`, and
`oauth2` are mutually exclusive and only one can be provided inside of a
`http_client_config` block.
{{< docs/shared lookup="flow/reference/components/http-client-config-block.md" source="agent" >}}

### basic_auth block

Name | Type | Description | Default | Required
---- | ---- | ----------- | ------- | --------
`username` | `string` | Basic auth username. | | no
`password` | `secret` | Basic auth password. | | no
`password_file` | `string` | File containing the basic auth password. | | no

`password` and `password_file` are mututally exclusive and only one can be
provided inside of a `basic_auth` block.
{{< docs/shared lookup="flow/reference/components/basic-auth-block.md" source="agent" >}}

### authorization block

Name | Type | Description | Default | Required
---- | ---- | ----------- | ------- | --------
`type` | `string` | Authorization type, for example, "Bearer". | | no
`credential` | `secret` | Secret value. | | no
`credentials_file` | `string` | File containing the secret value. | | no

`credential` and `credentials_file` are mututally exclusive and only one can be
provided inside of an `authorization` block.
{{< docs/shared lookup="flow/reference/components/authorization-block.md" source="agent" >}}

### oauth2 block

Name | Type | Description | Default | Required
---- | ---- | ----------- | ------- | --------
`client_id` | `string` | OAuth2 client ID. | | no
`client_secret` | `secret` | OAuth2 client secret. | | no
`client_secret_file` | `string` | File containing the OAuth2 client secret. | | no
`scopes` | `list(string)` | List of scopes to authenticate with. | | no
`token_url` | `string` | URL to fetch the token from. | | no
`endpoint_params` | `map(string)` | Optional parameters to append to the token URL. | | no
`proxy_url` | `string` | Optional proxy URL for OAuth2 requests. | | no

`client_secret` and `client_secret_file` are mututally exclusive and only one
can be provided inside of an `oauth2` block.
{{< docs/shared lookup="flow/reference/components/oauth2-block.md" source="agent" >}}

### tls_config block

Name | Type | Description | Default | Required
---- | ---- | ----------- | ------- | --------
`ca_file` | `string` | CA certificate to validate the server with. | | no
`cert_file` | `string` | Certificate file for client authentication. | | no
`key_file` | `string` | Key file for client authentication. | | no
`server_name` | `string` | ServerName extension to indicate the name of the server. | | no
`insecure_skip_verify` | `bool` | Disables validation of the server certificate. | | no
`min_version` | `string` | Minimum acceptable TLS version. | | no

When `min_version` is not provided, the minimum acceptable TLS version is
inherited from Go's default minimum version, TLS 1.2. If `min_version` is
provided, it must be set to one of the following strings:

* `"TLS10"` (TLS 1.0)
* `"TLS11"` (TLS 1.1)
* `"TLS12"` (TLS 1.2)
* `"TLS13"` (TLS 1.3)
{{< docs/shared lookup="flow/reference/components/tls-config-block.md" source="agent" >}}

### queue_config block

Expand Down
66 changes: 5 additions & 61 deletions docs/sources/flow/reference/components/prometheus.scrape.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,79 +83,23 @@ an `http_client_config` block.

### http_client_config block

The `http_client_config` block configures the HTTP client used to connect to an
endpoint.

The following arguments are supported:

Name | Type | Description | Default | Required
---- | ---- | ----------- | ------- | --------
`bearer_token` | `secret` | Bearer token to authenticate with. | | no
`bearer_token_file` | `string` | File containing a bearer token to authenticate with. | | no
`proxy_url` | `string` | HTTP proxy to proxy requests through. | | no
`follow_redirects` | `bool` | Whether redirects returned by the server should be followed. | `true` | no
`enable_http_2` | `bool` | Whether HTTP2 is supported for requests. | `true` | no

`bearer_token`, `bearer_token_file`, `basic_auth`, `authorization`, and
`oauth2` are mutually exclusive and only one can be provided inside of a
`http_client_config` block.
{{< docs/shared lookup="flow/reference/components/http-client-config-block.md" source="agent" >}}

### basic_auth block

Name | Type | Description | Default | Required
---- | ---- | ----------- | ------- | --------
`username` | `string` | Basic auth username. | | no
`password` | `secret` | Basic auth password. | | no
`password_file` | `string` | File containing the basic auth password. | | no

`password` and `password_file` are mututally exclusive and only one can be
provided inside of a `basic_auth` block.
{{< docs/shared lookup="flow/reference/components/basic-auth-block.md" source="agent" >}}

### authorization block

Name | Type | Description | Default | Required
---- | ---- | ----------- | ------- | --------
`type` | `string` | Authorization type, for example, "Bearer". | | no
`credential` | `secret` | Secret value. | | no
`credentials_file` | `string` | File containing the secret value. | | no

`credential` and `credentials_file` are mututally exclusive and only one can be
provided inside of an `authorization` block.
{{< docs/shared lookup="flow/reference/components/authorization-block.md" source="agent" >}}

### oauth2 block

Name | Type | Description | Default | Required
---- | ---- | ----------- | ------- | --------
`client_id` | `string` | OAuth2 client ID. | | no
`client_secret` | `secret` | OAuth2 client secret. | | no
`client_secret_file` | `string` | File containing the OAuth2 client secret. | | no
`scopes` | `list(string)` | List of scopes to authenticate with. | | no
`token_url` | `string` | URL to fetch the token from. | | no
`endpoint_params` | `map(string)` | Optional parameters to append to the token URL. | | no
`proxy_url` | `string` | Optional proxy URL for OAuth2 requests. | | no

`client_secret` and `client_secret_file` are mututally exclusive and only one
can be provided inside of an `oauth2` block.
{{< docs/shared lookup="flow/reference/components/oauth2-block.md" source="agent" >}}

### tls_config block

Name | Type | Description | Default | Required
---- | ---- | ----------- | ------- | --------
`ca_file` | `string` | CA certificate to validate the server with. | | no
`cert_file` | `string` | Certificate file for client authentication. | | no
`key_file` | `string` | Key file for client authentication. | | no
`server_name` | `string` | ServerName extension to indicate the name of the server. | | no
`insecure_skip_verify` | `bool` | Disables validation of the server certificate. | | no
`min_version` | `string` | Minimum acceptable TLS version. | | no

When `min_version` is not provided, the minimum acceptable TLS version is
inherited from Go's default minimum version, TLS 1.2. If `min_version` is
provided, it must be set to one of the following strings:

* `"TLS10"` (TLS 1.0)
* `"TLS11"` (TLS 1.1)
* `"TLS12"` (TLS 1.2)
* `"TLS13"` (TLS 1.3)
{{< docs/shared lookup="flow/reference/components/tls-config-block.md" source="agent" >}}

## Exported fields

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
aliases:
- /docs/agent/shared/flow/reference/components/authorization-block/
headless: true
---

Name | Type | Description | Default | Required
---- | ---- | ----------- | ------- | --------
`type` | `string` | Authorization type, for example, "Bearer". | | no
`credential` | `secret` | Secret value. | | no
`credentials_file` | `string` | File containing the secret value. | | no

`credential` and `credentials_file` are mututally exclusive and only one can be
provided inside of an `authorization` block.
14 changes: 14 additions & 0 deletions docs/sources/shared/flow/reference/components/basic-auth-block.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
aliases:
- /docs/agent/shared/flow/reference/components/basic-auth-block/
headless: true
---

Name | Type | Description | Default | Required
---- | ---- | ----------- | ------- | --------
`username` | `string` | Basic auth username. | | no
`password` | `secret` | Basic auth password. | | no
`password_file` | `string` | File containing the basic auth password. | | no

`password` and `password_file` are mututally exclusive and only one can be
provided inside of a `basic_auth` block.
Loading

0 comments on commit db43e16

Please sign in to comment.