-
Notifications
You must be signed in to change notification settings - Fork 240
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
feat(discovery): Add a remote_relabel component #1368
Open
simonswine
wants to merge
1
commit into
grafana:main
Choose a base branch
from
simonswine:20240722_add-discovery.remote_relabel
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
126 changes: 126 additions & 0 deletions
126
docs/sources/reference/components/discovery/discovery.remote_relabel.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,126 @@ | ||||||
--- | ||||||
canonical: https://grafana.com/docs/alloy/latest/reference/components/discovery/discovery.remote_relabel/ | ||||||
description: Learn about discovery.remote_relabel | ||||||
title: discovery.remote_relabel | ||||||
--- | ||||||
|
||||||
<span class="badge docs-labels__stage docs-labels__item">Experimental</span> | ||||||
|
||||||
# discovery.remote_relabel | ||||||
|
||||||
{{< docs/shared lookup="stability/experimental.md" source="alloy" version="<ALLOY_VERSION>" >}} | ||||||
|
||||||
`discovery.remote_relabel` accepts relabeling rules from a remote control server using Pyroscope's [settings API]. | ||||||
Additionally it is also possible for the control server to request the targets that are received by this component in order to show the effects of the rules at the central control server. | ||||||
|
||||||
Multiple `discovery.remote_relabel` components can be specified by giving them different labels. | ||||||
|
||||||
## Usage | ||||||
|
||||||
```alloy | ||||||
discovery.relabel "LABEL" { | ||||||
targets = TARGET_LIST | ||||||
websocket { | ||||||
url = "ws://localhost:4040/settings.v1.SettingsService/GetCollectionRules?scope=alloy" | ||||||
} | ||||||
} | ||||||
``` | ||||||
|
||||||
## Arguments | ||||||
|
||||||
The following arguments are supported: | ||||||
|
||||||
| Name | Type | Description | Default | Required | | ||||||
| --------- | ------------------- | ------------------ | ------- | -------- | | ||||||
| `targets` | `list(map(string))` | Targets to relabel | | yes | | ||||||
|
||||||
## Blocks | ||||||
|
||||||
The following blocks are supported inside the definition of `pyroscope.write`: | ||||||
|
||||||
| Hierarchy | Block | Description | Required | | ||||||
| ---------------------- | -------------- | --------------------------------------------------------- | -------- | | ||||||
| websocket | [websocket][] | Control server settingss to. | yes | | ||||||
| websocket > basic_auth | [basic_auth][] | Configure basic_auth for authenticating to the websocket. | no | | ||||||
|
||||||
[websocket]:#websocket-block | ||||||
[basic_auth]:#basic_auth-block | ||||||
|
||||||
### websocket block | ||||||
|
||||||
The `websocket` block describes a single command and control server. Only one `websocket` block can ben provided. | ||||||
|
||||||
The following arguments are supported: | ||||||
|
||||||
| Name | Type | Description | Default | Required | | ||||||
| --------------------- | ---------- | ------------------------------------------------------------------ | --------- | -------- | | ||||||
| `url` | `string` | Full URL to the websocket server. Needs to start with ws:// wss:// | | yes | | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| `keep_alive` | `duration` | How often to sent keep alive pings. 0 to disable. | `"295s"` | no | | ||||||
| `min_backoff_period` | `duration` | Initial backoff time between retries. | `"500ms"` | no | | ||||||
| `max_backoff_period` | `duration` | Maximum backoff time between retries. | `"5m"` | no | | ||||||
| `max_backoff_retries` | `int` | Maximum number of retries. 0 to retry infinitely. | `10` | no | | ||||||
|
||||||
### basic_auth block | ||||||
|
||||||
{{< docs/shared lookup="reference/components/basic-auth-block.md" source="alloy" version="<ALLOY_VERSION>" >}} | ||||||
|
||||||
## Exported fields | ||||||
|
||||||
The following fields are exported and can be referenced by other components: | ||||||
|
||||||
| Name | Type | Description | | ||||||
| -------- | ------------------- | --------------------------------------------- | | ||||||
| `output` | `list(map(string))` | The set of targets after applying relabeling. | | ||||||
| `rules` | `RelabelRules` | The currently configured relabeling rules. | | ||||||
|
||||||
## Component health | ||||||
|
||||||
`discovery.remote_relabel` is only reported as unhealthy when the websocket is not connected. | ||||||
|
||||||
## Debug information | ||||||
|
||||||
| Name | Type | Description | | ||||||
| --------------------------- | ----------- | -------------------------------------------------------- | | ||||||
| `websocket_status` | `string` | Status of the websocket connection. | | ||||||
| `websocket_connected_since` | `time.Time` | The currently configured relabeling rules. | | ||||||
| `websocket_last_error` | `string` | What was the last error when reconnecting the websocket. | | ||||||
|
||||||
## Example | ||||||
|
||||||
```alloy | ||||||
discovery.remote_relabel "control_profiles" { | ||||||
targets = [ | ||||||
{ "__meta_foo" = "foo", "__address__" = "localhost", "instance" = "one", "app" = "backend" }, | ||||||
{ "__meta_bar" = "bar", "__address__" = "localhost", "instance" = "two", "app" = "database" }, | ||||||
{ "__meta_baz" = "baz", "__address__" = "localhost", "instance" = "three", "app" = "frontend" }, | ||||||
] | ||||||
websocket { | ||||||
url = "wss://profiles-prod-001.grafana.net/settings.v1.SettingsService/GetCollectionRules?scope=alloy" | ||||||
basic_auth { | ||||||
username = env("PROFILECLI_USERNAME") | ||||||
password = env("PROFILECLI_PASSWORD") | ||||||
} | ||||||
} | ||||||
} | ||||||
``` | ||||||
|
||||||
[settings API]: https://github.com/grafana/pyroscope/blob/main/api/settings/v1/setting.proto | ||||||
|
||||||
<!-- START GENERATED COMPATIBLE COMPONENTS --> | ||||||
|
||||||
## Compatible components | ||||||
|
||||||
`discovery.remote_relabel` can accept arguments from the following components: | ||||||
|
||||||
- Components that export [Targets](../../../compatibility/#targets-exporters) | ||||||
|
||||||
`discovery.remote_relabel` has exports that can be consumed by the following components: | ||||||
|
||||||
- Components that consume [Targets](../../../compatibility/#targets-consumers) | ||||||
|
||||||
{{< admonition type="note" >}} | ||||||
Connecting some components may not be sensible or components may require further configuration to make the connection work correctly. | ||||||
Refer to the linked documentation for more details. | ||||||
{{< /admonition >}} | ||||||
|
||||||
<!-- END GENERATED COMPATIBLE COMPONENTS --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.