-
Notifications
You must be signed in to change notification settings - Fork 537
feat: pyroscope.enrich component #4797
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
171 changes: 171 additions & 0 deletions
171
docs/sources/reference/components/pyroscope/pyroscope.enrich.md
This file contains hidden or 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,171 @@ | ||
| --- | ||
| canonical: https://grafana.com/docs/alloy/latest/reference/components/pyroscope/pyroscope.enrich/ | ||
| description: Learn about pyroscope.enrich | ||
| labels: | ||
| stage: experimental | ||
| products: | ||
| - oss | ||
| tags: | ||
| - text: Community | ||
| tooltip: This component is developed, maintained, and supported by the Alloy user community. | ||
| title: pyroscope.enrich | ||
| --- | ||
|
|
||
| # `pyroscope.enrich` | ||
|
|
||
| {{< docs/shared lookup="stability/community.md" source="alloy" version="<ALLOY_VERSION>" >}} | ||
|
|
||
| {{< docs/shared lookup="stability/experimental.md" source="alloy" version="<ALLOY_VERSION>" >}} | ||
AndreZiviani marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| `pyroscope.enrich` enriches profiles with additional labels from service discovery targets. | ||
| It matches a label from incoming profiles against a label from discovered targets, and copies specified labels from the matched target to the profile. | ||
|
|
||
| ## Usage | ||
|
|
||
| ```alloy | ||
| pyroscope.enrich "<LABEL>" { | ||
| targets = <DISCOVERY_COMPONENT>.targets | ||
| target_match_label = "<LABEL>" | ||
| forward_to = [<RECEIVER_LIST>] | ||
| } | ||
| ``` | ||
|
|
||
| ## Arguments | ||
|
|
||
| You can use the following arguments with `pyroscope.enrich`: | ||
|
|
||
| | Name | Type | Description | Default | Required | | ||
| | ---------------------- | ------------------------ | --------------------------------------------------------------------------------------------- | ------- | -------- | | ||
| | `forward_to` | `list(ProfilesReceiver)` | List of receivers to send enriched profiles to. | | yes | | ||
| | `target_match_label` | `string` | The label from discovered targets to match against. | | yes | | ||
| | `targets` | `list(Target)` | List of targets from a discovery component. | | yes | | ||
| | `labels_to_copy` | `list(string)` | List of labels to copy from discovered targets to profiles. If empty, all labels are copied. | | no | | ||
| | `profiles_match_label` | `string` | The label from incoming profiles to match against discovered targets. | | no | | ||
|
|
||
| If `profiles_match_label` isn't provided, the component uses `target_match_label` for matching profile labels. | ||
|
|
||
| ## Blocks | ||
|
|
||
| `pyroscope.enrich` doesn't support any blocks. | ||
| Configure this component with arguments. | ||
|
|
||
| ## Exported fields | ||
|
|
||
| The following fields are exported and can be referenced by other components: | ||
|
|
||
| | Name | Type | Description | | ||
| | ---------- | -------------------- | ----------------------------------- | | ||
| | `receiver` | `ProfilesReceiver` | The receiver for profiles. | | ||
|
|
||
| ## Component health | ||
|
|
||
| `pyroscope.enrich` is only reported as unhealthy if given an invalid configuration. | ||
|
|
||
| ## Debug information | ||
AndreZiviani marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| `pyroscope.enrich` doesn't expose debug information. | ||
|
|
||
| ## Debug metrics | ||
|
|
||
| `pyroscope.enrich` doesn't expose additional metrics. | ||
|
|
||
| ## Example | ||
|
|
||
| This example enriches profiles received over HTTP with metadata from Kubernetes service discovery: | ||
|
|
||
| ```alloy | ||
| // Discover Kubernetes pods | ||
| discovery.kubernetes "pods" { | ||
| role = "pod" | ||
| } | ||
|
|
||
| // Add custom labels from Kubernetes metadata | ||
| discovery.relabel "pods" { | ||
| targets = discovery.kubernetes.pods.targets | ||
|
|
||
| rule { | ||
| source_labels = ["__meta_kubernetes_namespace"] | ||
| target_label = "namespace" | ||
| } | ||
|
|
||
| rule { | ||
| source_labels = ["__meta_kubernetes_pod_node_name"] | ||
| target_label = "node" | ||
| } | ||
|
|
||
| rule { | ||
| source_labels = ["__meta_kubernetes_pod_label_app"] | ||
| target_label = "app" | ||
| } | ||
|
|
||
| rule { | ||
| source_labels = ["__meta_kubernetes_pod_label_environment"] | ||
| target_label = "environment" | ||
| } | ||
|
|
||
| rule { | ||
| source_labels = ["__meta_kubernetes_pod_ip"] | ||
| target_label = "pod_ip" | ||
| } | ||
| } | ||
|
|
||
| // Receive profiles over HTTP | ||
| pyroscope.receive_http "default" { | ||
| http { | ||
| listen_address = "0.0.0.0" | ||
| listen_port = 4040 | ||
| } | ||
| forward_to = [pyroscope.enrich.metadata.receiver] | ||
| } | ||
|
|
||
| // Enrich profiles with Kubernetes metadata | ||
| pyroscope.enrich "metadata" { | ||
| targets = discovery.relabel.pods.output | ||
| target_match_label = "pod_ip" | ||
| profiles_match_label = "service_name" | ||
| labels_to_copy = ["namespace", "node", "app", "environment"] | ||
| forward_to = [pyroscope.write.default.receiver] | ||
| } | ||
|
|
||
| // Write profiles to Pyroscope | ||
| pyroscope.write "default" { | ||
| endpoint { | ||
| url = "http://pyroscope:4040" | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ## Component behavior | ||
|
|
||
| The component matches profiles to discovered targets and enriches them with additional labels: | ||
|
|
||
| 1. For each profile, it looks up the value of `profiles_match_label` from the profile's labels, or `target_match_label` if `profiles_match_label` isn't specified. | ||
| 1. It matches this value against the `target_match_label` in discovered targets. | ||
| 1. When it finds a match, it copies the requested `labels_to_copy` from the discovered target to the profile. If `labels_to_copy` is empty, it copies all labels. | ||
| 1. The component forwards the profile, enriched or unchanged, to the configured receivers. | ||
|
|
||
| {{< admonition type="caution" >}} | ||
| By default, `pyroscope.enrich` is ready as it starts, even if discovery doesn't find targets. | ||
| If you send profiles to this component before the metadata synchronizes, the component passes them through as-is, without enrichment. | ||
| This is most likely to impact `pyroscope.enrich` on startup for a short time before discovery components send a list of targets. | ||
| {{< /admonition >}} | ||
|
|
||
| <!-- START GENERATED COMPATIBLE COMPONENTS --> | ||
|
|
||
| ## Compatible components | ||
|
|
||
| `pyroscope.enrich` can accept arguments from the following components: | ||
|
|
||
| - Components that export [Targets](../../../compatibility/#targets-exporters) | ||
| - Components that export [Pyroscope `ProfilesReceiver`](../../../compatibility/#pyroscope-profilesreceiver-exporters) | ||
|
|
||
| `pyroscope.enrich` has exports that can be consumed by the following components: | ||
|
|
||
| - Components that consume [Pyroscope `ProfilesReceiver`](../../../compatibility/#pyroscope-profilesreceiver-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 hidden or 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.
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.
Uh oh!
There was an error while loading. Please reload this page.