This is documentation for the next version of Grafana Alloy Documentation. For the latest stable release, go to the latest version.
pyroscope.enrich
Community: This component is developed, maintained, and supported by the Alloy user community. Grafana doesn’t offer commercial support for this component. To enable and use community components, you must set the
--feature.community-components.enabledflag totrue.
EXPERIMENTAL: This is an experimental component. Experimental components are subject to frequent breaking changes, and may be removed with no equivalent replacement. To enable and use an experimental component, you must set the
stability.levelflag toexperimental.
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
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:
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:
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:
// 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:
- For each profile, it looks up the value of
profiles_match_labelfrom the profile’s labels, ortarget_match_labelifprofiles_match_labelisn’t specified. - It matches this value against the
target_match_labelin discovered targets. - When it finds a match, it copies the requested
labels_to_copyfrom the discovered target to the profile. Iflabels_to_copyis empty, it copies all labels. - The component forwards the profile, enriched or unchanged, to the configured receivers.
Caution
By default,
pyroscope.enrichis 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 impactpyroscope.enrichon startup for a short time before discovery components send a list of targets.
Compatible components
pyroscope.enrich can accept arguments from the following components:
- Components that export Targets
- Components that export Pyroscope
ProfilesReceiver
pyroscope.enrich has exports that can be consumed by the following components:
- Components that consume Pyroscope
ProfilesReceiver
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.



