Skip to content

Commit

Permalink
examples: Add pyroscope relabel componet in rideshare-alloy example (#…
Browse files Browse the repository at this point in the history
…3894)

* examples: Add pyroscope relabel componet in rideshare-alloy example
  • Loading branch information
marcsanmi authored Feb 10, 2025
1 parent 886b418 commit c85bda3
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pyroscope.write "backend" {
# Pull latest images
docker pull grafana/pyroscope:latest
docker pull grafana/grafana:latest
docker pull grafana/alloy:latest
docker pull grafana/grafana/alloy-dev:latest

# Run the example
docker-compose up --build
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,46 @@ pyroscope.receive_http "default" {
listen_address = "0.0.0.0"
listen_port = 9999
}
forward_to = [pyroscope.relabel.filter_profiles.receiver]
}

pyroscope.relabel "filter_profiles" {
// Group regions into geographical areas for better aggregation
rule {
action = "replace"
source_labels = ["region"]
target_label = "geo_area"
regex = "(us-.*)"
replacement = "americas"
}
rule {
action = "replace"
source_labels = ["region"]
target_label = "geo_area"
regex = "(eu-.*)"
replacement = "emea"
}
rule {
action = "replace"
source_labels = ["region"]
target_label = "geo_area"
regex = "(ap-.*)"
replacement = "apac"
}

// Example: Sample profiles by service_name (drop 30% of services)
// rule {
// action = "hashmod"
// source_labels = ["service_name"]
// target_label = "__tmp_hash"
// modulus = 10
//}
// rule {
// action = "drop"
// source_labels = ["__tmp_hash"]
// regex = "^(0|1|2)$" // Drop profiles from services that hash to 0-2
// }

forward_to = [pyroscope.write.backend.receiver]
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ services:
context: .

alloy:
image: grafana/alloy:latest
image: grafana/alloy-dev:latest
command:
- run
- /etc/alloy/config.alloy
Expand All @@ -36,6 +36,7 @@ services:
- ./config.alloy:/etc/alloy/config.alloy
ports:
- "9999:9999"
- "12345:12345"

pyroscope:
image: grafana/pyroscope:latest
Expand Down

0 comments on commit c85bda3

Please sign in to comment.