Skip to content
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

examples: Add pyroscope relabel componet in rideshare-alloy example #3894

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
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
Copy link
Collaborator

@kolesnikovae kolesnikovae Feb 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should be careful with use of dev images in examples, esp. latest. Users may not notice that and replicate it in production.

Suggested change
docker pull grafana/grafana/alloy-dev:latest
docker pull grafana/alloy-dev:latest

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was done as a temporary workaround since there's no other image available than the dev one, but I can pin it to a specific dev tag.

The idea is to change it back to the previous state when the next release is available.


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

pyroscope.relabel "filter_profiles" {
// Convert region to datacenter
rule {
action = "replace"
source_labels = ["region"]
target_label = "datacenter"
}

// Add environment label
rule {
action = "replace"
target_label = "environment"
replacement = "demo"
}

// Add component label based on application name
rule {
action = "replace"
source_labels = ["__name__"]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

__name__ is a profile name like process_cpu or memory . I am not understanding why is it compared against ride-sharing-app.*

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for history: now I udnerstand why __name__ is used. This is because __name__ is the special lable in OG flameql.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should somehow translate __name__ to service_name transparentyl

target_label = "component"
regex = "ride-sharing-app.*"
replacement = "backend"
}
rule {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should add example of how to drop targets, for example drop 10% of service-a and 20% of service-b

action = "replace"
source_labels = ["__name__"]
target_label = "component"
regex = "load-generator.*"
replacement = "load-generator"
}

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
Loading