iovisor / iovisor/bcc

Update built-in USDT tools to support fully-specified probe API

Open
#2,326 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
22.7k
Forks
4.1k
Avg merge
5d 13h
Merged PRs (30d)
3

Description

> I do not particularly like BCC_USDT_HAS_FULLY_SPECIFIED_PROBE, but I guess we can live with it for now and later retire it with a few more releases. Otherwise, the patch looks good to me. In the future, we need to tweak python/C++ (esp. python) usdt user interfaces to include provider name.

As @yonghong-song indicates in https://github.com/iovisor/bcc/pull/2294#issuecomment-486018445, the current approach from #2294 relies on a compatibility hack.

We should phase this out and deprecate the old API as quickly as possible.

I have already got a PR in place for bpftrace to use he fully-specified API but this issue is to cover updating bcc tools and APIs:

Here are the references I found easily with grep:
* [ ] src/python/bcc/libbcc.py:221: `lib.bcc_usdt_enable_probe.restype = ct.c_int`
* [ ] src/python/bcc/libbcc.py:222: `lib.bcc_usdt_enable_probe.argtypes = [ct.c_void_p, ct.c_char_p, ct.c_char_p]`
* [ ] src/python/bcc/usdt.py:149: `if lib.bcc_usdt_enable_probe(self.context, probe.encode('ascii'),`
* [ ] src/python/bcc/usdt.py:158: `if lib.bcc_usdt_enable_probe(self.context, probe.encode('ascii'),`
* [ ] src/lua/bcc/usdt.lua:45: `assert(libbcc.bcc_usdt_enable_probe(
* [ ] src/lua/bcc/libbcc.lua:137: `int bcc_usdt_enable_probe(void *, const char *, const char *);`
* [ ] src/cc/bcc_usdt.h:72: `int bcc_usdt_enable_probe(void *, const char *, const char *);`
* [ ] src/cc/usdt/usdt.cc:449:`int bcc_usdt_enable_probe(void *usdt, const char *probe_name,`
* [ ] build/src/python/bcc-python/build/lib/bcc/libbcc.py:221: `lib.bcc_usdt_enable_probe.restype = ct.c_int`
* [ ] build/src/python/bcc-python/build/lib/bcc/libbcc.py:222: `lib.bcc_usdt_enable_probe.argtypes = [ct.c_void_p, ct.c_char_p, ct.c_char_p]`
* [ ] build/src/python/bcc-python/build/lib/bcc/usdt.py:149: `if lib.bcc_usdt_enable_probe(self.context, probe.encode('ascii'),`
* [ ] build/src/python/bcc-python/build/lib/bcc/usdt.py:158: `if lib.bcc_usdt_enable_probe(self.context, probe.encode('ascii'),`
* [ ] build/src/python/bcc-python/bcc/libbcc.py:221: `lib.bcc_usdt_enable_probe.restype = ct.c_int`
* [ ] build/src/python/bcc-python/bcc/libbcc.py:222: `lib.bcc_usdt_enable_probe.argtypes = [ct.c_void_p, ct.c_char_p, ct.c_char_p]`
* [ ] build/src/python/bcc-python/bcc/usdt.py:149: `if lib.bcc_usdt_enable_probe(self.context, probe.encode('ascii'),`
* [ ] build/src/python/bcc-python/bcc/usdt.py:158: `if lib.bcc_usdt_enable_probe(self.context, probe.encode('ascii'),`
* [ ] build/src/lua/bcc.lua:2443: `int bcc_usdt_enable_probe(void *, const char *, const char *);`
* [ ] build/src/lua/bcc.lua:2968: `assert(libbcc.bcc_usdt_enable_probe(`

So it is the python and lua APIs are what need the most immediate attention here.

Once the built-in stuff has been ported over, I think we should deprecate the old API.

cc @yonghong-song

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the referenced Python files src/python/bcc/libbcc.py and src/python/bcc/usdt.py, then inspect the corresponding Lua bindings and C declarations in src/lua and src/cc. Trace bcc_usdt_enable_probe across these entry points and compare the built-in APIs with the fully specified probe API. Done means the Python and Lua APIs and built-in tools use the new API, with the old API ready for deprecation.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, lua, python
Domain
api, tooling
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.