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

Pyroscope: Provide an example for ebpf sidecar collection #3285

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

simonswine
Copy link
Contributor

@simonswine simonswine commented May 8, 2024

This shows how Alloy can be used to collect profiles as a sidecar. I am not too sure if this is something we should advertise too heavily, but valuable if you would only like to collect a very specific workloads, that is supported by eBPF.

Maybe we also want to have something like pyroscope exec was for this usecase.

The test workload launches some short-lived sub processes of varying length, the problem is that collection requires to have a quite low discovery.process.refresh_interval

This shows how Alloy can be used to collect profiles as a sidecar.

The workload will futhermore launch some shortlived processes of varying
lenght, that should also get collected by the profiler.
@simonswine simonswine changed the title Provide an example for ebpf sidecar collection Pyroscope: Provide an example for ebpf sidecar collection May 8, 2024
labels:
app: example-ebpf-sidecar
spec:
shareProcessNamespace: true
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 is a hard requirement for this to work


cat > /tmp/config.alloy <<"EOF"
discovery.process "all" {
refresh_interval = "200ms"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

With this I see the 100ms long running processes very rarely. I guess something that we loose by not consuming the PID events from the ebpf.Session in alloy directly.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I dont like the idea to run discovery.process every 200ms, but idk how bad it is.
I also don't like using alloy as sidecar at all. The binary is huge, consuming tons of space and memory.

  1. As you said we can notify discovery.process from discovery.ebpf about new PID
  2. Another option could be to somehow revive (but maybe with a different naming), the targets_only = false && default_target={"service_name": "foo239"}

This could look like this

sidecar {
  enabled=true

  discover_config {
    cwd = true
    exe = true
...
  }
relabel {
  rule {
...
  }
... 
}
}


Can we get k8s labels somehow?

@simonswine
Copy link
Contributor Author

@korniltsev if you got a moment, would like to understand how you feel about this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants