parca-dev / parca-agent

eBPF based always-on profiler auto-discovering targets in Kubernetes and systemd, zero code changes or restarts needed!
https://parca.dev/
Apache License 2.0
557 stars 68 forks source link

Set versions of C dependencies and compile with frame pointers #1304

Open javierhonduco opened 1 year ago

javierhonduco commented 1 year ago

We depend on libbpf, which links zlib and libelf. Let's make sure that the versions of these packages we use are defined by us, and are not different across machines depending on the available version provided by the OS. While we are at it, let's compile them with frame pointers, too.

I do this in rbperf for zlib and libelf to ensure consistent builds and to make troubleshooting regressions in behaviour and performance easier with this script.

cc @kakkoyun

maxbrunet commented 1 year ago

*whispers* Nix...

kakkoyun commented 1 year ago

whispers Nix...

@maxbrunet I'd be happy to use Nix, as the base image of choice, for our build pipeline as long as it checks all our boxes. As far as I know, Nix means more reproducible builds, even locally.

We still have this project for these types of aspirations 🤗 https://github.com/parca-dev/cross-builder

maxbrunet commented 1 year ago

Nix is not a base image, it is a build tool and package manager. It would replace goreleaser, podman, libbpf git-submodule, and probably parts of the Makefile and GHA workflows. If done correctly, it should check all the boxes very strictly... its main caveat being having to learn the language itself. If that's something you are willing to try, I'll try to find time to build a POC. I would need to do some research on how to structure it and other best practices (it would a first for me too).

cross-builder would be unnecessary and this GitHub Action would be used in the workflows: install-nix. The container image could be use as an alternative to installing it locally.

kakkoyun commented 1 year ago

https://github.com/parca-dev/parca-agent/issues/1304 add a way to download the dependencies and build locally for the current host.

We need to extend the script to cross-build against multiple architectures and configure goreleaser accordingly.

kakkoyun commented 1 year ago

Also these configuration variable should be extended with -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer https://github.com/parca-dev/parca-agent/blob/bd6a25af07744bef33f85d7ae51cfadc3ce93f5f/.goreleaser.yml#L27

https://github.com/parca-dev/parca-agent/blob/bd6a25af07744bef33f85d7ae51cfadc3ce93f5f/.goreleaser.yml#L59