grafana / beyla

eBPF-based autoinstrumentation of web applications and network metrics
https://grafana.com/oss/beyla-ebpf/
Apache License 2.0
1.17k stars 74 forks source link

Custom framework tracing #740

Open bck01215 opened 2 weeks ago

bck01215 commented 2 weeks ago

It would be useful for contributors if beyla had an extensible framework for custom BPF tracepoints.

Currently the existing sql tracing is very limited in scope. Instead of this project directly loading tracing from upstream packages, it would be nice if libraries existed that could be loaded in. This would minimize the BPF tracepoints while allowing each user to program their use case.

grcevski commented 2 weeks ago

Very interesting idea @bck01215!

How do you envision this being done? I think adding Go modules wouldn't be a problem, Grafana Alloy already has a very nice plugin model we can borrow in Beyla. We in fact use it to add Beyla to it.

I'm wondering if you have any ideas on how we could make the bpf loading generic enough to be pluggable... There are projects that do this, like Inspector Gadget, but they recently added image based gadgets, because I think it's not easy to make everything work well with the same model. Perhaps if we limit ourselves to purely observability, it would be possible...

I'm curious to hear more about this idea.

bck01215 commented 2 weeks ago

Very interesting idea @bck01215!

How do you envision this being done? I think adding Go modules wouldn't be a problem, Grafana Alloy already has a very nice plugin model we can borrow in Beyla. We in fact use it to add Beyla to it.

Unfortunately I do not consider myself much of a programmer. It's possible this idea is not practical to implement, but as a user it would be ideal to have the ability to only have to write a program to trace only the tracepoints I'm interested in (as well as not running the tracepoints I am uninterested in).

The way my non-programmer brain would see this playing out is having BPF programs optionally enabled through a flag/env var list that send back to some receiver func the span details. Perhaps similar to BCC there would have to be a library to provide context awareness inside the BPF program.