tricorder-observability / Starship

Starship: next-generation Observability platform built with eBPF+WASM
GNU Affero General Public License v3.0
163 stars 23 forks source link

Automatically generate WASM C code for a C struct outputted from eBPF #239

Open nascentcore-eng opened 1 year ago

nascentcore-eng commented 1 year ago

What's the motivation? Is it related to a problem? Please describe the background and rationale. Given a C struct, it's tedious to manually write WASM C guest code to transform it into JSON format. We should be able to write a tool to accept a C struct name, or a header file, and generate the WASM C guest code, and compile it into .wasm binary code.

This .wasm binary code can then be directly executed on the Starship platform.

In other words, given a C struct outputted from eBPF, Starship can automatically output it into JSON format and write into database.

Describe the solution you'd like We can use the existing C struct bindgen to produce the C code, and generate the WASM C code, to produce the c json output code. This is already part of C struct bind gen

https://github.com/tricorder-observability/c-struct-bindgen

This can be part of starship CLI

Describe alternatives you've considered None

Additional context, for example, Kubernetes versions, Kernel versions etc. This is similar to a previous version of eunomia-bpf's automated JSON output feature. @yunwei37 might have the pointer