eunomia-bpf / bpftime

Userspace eBPF runtime for Observability, Network & General Extensions Framework
https://eunomia.dev/bpftime/
MIT License
818 stars 75 forks source link

[FEATURE] Add user friendly API for register events. #348

Open yunwei37 opened 1 month ago

yunwei37 commented 1 month ago

Is your feature request related to a problem? Please describe.

There should be a clearly API to allow user register events and init runtime.

Describe the solution you'd like

for example:

// Init runtime
int bpftime_init_runtime(runtime_config* config);
// Register events
int bpftime_register_attach_events(int event_id, event_config* config);
// Handle events
int handle_events(int event_id, struct ecent_ctx* ctx);

We need to discuss how to do that.

Describe alternatives you've considered

Provide usage examples

Additional context

Officeyutong commented 1 month ago

What does event here mean? Attach type?

yunwei37 commented 1 month ago

for example, nginx incoming request is an event, uprobe is an event, syscall tracepoints is an event, dpdk incoming request can be an event

Events can be connected to bpf_prog using bpf_link.

yunwei37 commented 1 month ago

Does that make sense?

Officeyutong commented 1 month ago

for example, nginx incoming request is an event, uprobe is an event, syscall tracepoints is an event, dpdk incoming request can be an event

Events can be connected to bpf_prog using bpf_link.

These were called attach type previously, but we need a full set of callbacks to define an attach type, such ad instantiation at https://github.com/eunomia-bpf/bpftime/blob/a6a132bfe6717a2f41a67ec646b44856d57c5714/runtime/src/attach/bpf_attach_ctx.cpp#L111

We can have a discussion when you have some time