odigos-io / opentelemetry-go-instrumentation

OpenTelemetry auto-instrumentation for Go applications
Apache License 2.0
289 stars 44 forks source link

Include bpf includes within the project #24

Closed ocampeau closed 2 years ago

ocampeau commented 2 years ago

Feature request

Maybe the project can come with its own include directory containing all standard bpf header files required to build the project, which would make it much easier for everybody to just build the binary locally without bothering about bpf dependencies.

Use case

After cloning the project, the make build command failed because I did not have my bpf include files in /usr/include/bpf.

Luckily, I had a personal project on my machine using libbpf, and so I just copied some of my include files to /usr/include/bpf and it worked. But for some other people less familiar with bpf who just wants to try this amazing tool (still in early stage, but looks quite promising) it might be a blocker.

Is this feature request gets accepted, I can submit a PR.

edeNFed commented 2 years ago

That sounds like a great idea. I'll be happy to accept a PR. By the way, there is a Dockerfile that you can use to build the project inside a docker container.

ocampeau commented 2 years ago

Great! I'll try to have a PR ready soon.

Also, I just took a look at the Dockerfile, and I was not aware of the libbpf-devel package (or libbpf-dev on Debian). That's awesome. It makes it much easier to have the header files. I was used to link libbpf from the kernel source tree.

I still see some advantages though to have an include directory within the project that would include all files from libbpf-devel package (and possibly more).

The most obvious to me is to make it possible to build the binary from within the project without any external dependencies. Another advantage I see is for versioning: to make sure anyone building the project locally are doing it against the same version of the bpf header files.

I'll submit a PR soon.