Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/blank.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ body:
- prometheus.scrape
- prometheus.write.queue
- pyroscope.ebpf
- pyroscope.enrich
- pyroscope.java
- pyroscope.receive_http
- pyroscope.relabel
Expand Down
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ body:
- prometheus.scrape
- prometheus.write.queue
- pyroscope.ebpf
- pyroscope.enrich
- pyroscope.java
- pyroscope.receive_http
- pyroscope.relabel
Expand Down
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ body:
- prometheus.scrape
- prometheus.write.queue
- pyroscope.ebpf
- pyroscope.enrich
- pyroscope.java
- pyroscope.receive_http
- pyroscope.relabel
Expand Down
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ body:
- prometheus.scrape
- prometheus.write.queue
- pyroscope.ebpf
- pyroscope.enrich
- pyroscope.java
- pyroscope.receive_http
- pyroscope.relabel
Expand Down
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/proposal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ body:
- prometheus.scrape
- prometheus.write.queue
- pyroscope.ebpf
- pyroscope.enrich
- pyroscope.java
- pyroscope.receive_http
- pyroscope.relabel
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@ Main (unreleased)
### Features

- A new `mimir.alerts.kubernetes` component which discovers `AlertmanagerConfig` Kubernetes resources and loads them into a Mimir instance. (@ptodev)

- Mark `stage.windowsevent` block in the `loki.process` component as GA. (@kgeckhart)

- (_Experimental_) Add `pyroscope.enrich` component to enrich profiles using labels from `discovery.*` components. (@AndreZiviani)

### Enhancements

- update promtail converter to use `file_match` block for `loki.source.file` instead of going through `local.file_match`. (@kalleep)
Expand Down Expand Up @@ -95,6 +98,7 @@ v1.12.0-rc.0
- The `otelcol.processor.servicegraph` component now supports defining the maximum number of buckets for generated exponential histograms.
- See the upstream [core][https://github.com/open-telemetry/opentelemetry-collector/blob/v0.139.0/CHANGELOG.md] and [contrib][https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/v0.139.0/CHANGELOG.md] changelogs for more details.


### Enhancements

- Add per-application rate limiting with the `strategy` attribute in the `faro.receiver` component, to prevent one application from consuming the rate limit quota of others. (@hhertout)
Expand Down
3 changes: 3 additions & 0 deletions docs/sources/reference/compatibility/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ The following components, grouped by namespace, _consume_ Targets.

{{< collapse title="pyroscope" >}}
- [pyroscope.ebpf](../components/pyroscope/pyroscope.ebpf)
- [pyroscope.enrich](../components/pyroscope/pyroscope.enrich)
- [pyroscope.java](../components/pyroscope/pyroscope.java)
- [pyroscope.scrape](../components/pyroscope/pyroscope.scrape)
{{< /collapse >}}
Expand Down Expand Up @@ -422,6 +423,7 @@ The following components, grouped by namespace, _export_ Pyroscope `ProfilesRece
<!-- START GENERATED SECTION: EXPORTERS OF Pyroscope `ProfilesReceiver` -->

{{< collapse title="pyroscope" >}}
- [pyroscope.enrich](../components/pyroscope/pyroscope.enrich)
- [pyroscope.relabel](../components/pyroscope/pyroscope.relabel)
- [pyroscope.write](../components/pyroscope/pyroscope.write)
{{< /collapse >}}
Expand All @@ -437,6 +439,7 @@ The following components, grouped by namespace, _consume_ Pyroscope `ProfilesRec

{{< collapse title="pyroscope" >}}
- [pyroscope.ebpf](../components/pyroscope/pyroscope.ebpf)
- [pyroscope.enrich](../components/pyroscope/pyroscope.enrich)
- [pyroscope.java](../components/pyroscope/pyroscope.java)
- [pyroscope.receive_http](../components/pyroscope/pyroscope.receive_http)
- [pyroscope.relabel](../components/pyroscope/pyroscope.relabel)
Expand Down
171 changes: 171 additions & 0 deletions docs/sources/reference/components/pyroscope/pyroscope.enrich.md
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>" >}}

`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

`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 -->
1 change: 1 addition & 0 deletions internal/component/all/all.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ import (
_ "github.com/grafana/alloy/internal/component/prometheus/scrape" // Import prometheus.scrape
_ "github.com/grafana/alloy/internal/component/prometheus/write/queue" // Import prometheus.write.queue
_ "github.com/grafana/alloy/internal/component/pyroscope/ebpf" // Import pyroscope.ebpf
_ "github.com/grafana/alloy/internal/component/pyroscope/enrich" // Import pyroscope.enrich
_ "github.com/grafana/alloy/internal/component/pyroscope/java" // Import pyroscope.java
_ "github.com/grafana/alloy/internal/component/pyroscope/receive_http" // Import pyroscope.receive_http
_ "github.com/grafana/alloy/internal/component/pyroscope/relabel" // Import pyroscope.relabel
Expand Down
Loading
Loading