Create USDT probes and instrument your Python application dynamically
Project description
# python-stapsdt
Create USDT probes and instrument your Python application dynamically.
# Dependencies
At the moment this package only runs on Linux and requires
[libstapsdt](https://github.com/sthima/libstapsdt) to be installed to create
runtime probes.
## Ubuntu 16.04
To install libstapsdt, run:
```bash
sudo add-apt-repository ppa:sthima/oss
sudo apt-get update
sudo apt-get install libstapsdt0 libstapsdt-dev
```
## Other
Build from [libstapsdt](https://github.com/sthima/libstapsdt).
# Install
```bash
pip install stapsdt
```
# Example
The following code will create a probe named `firstProbe`.
```python
from time import sleep
import stapsdt
provider = stapsdt.Provider("pythonapp")
probe = provider.add_probe(
"firstProbe", stapsdt.ArgTypes.uint64, stapsdt.ArgTypes.int32)
provider.load()
while True:
print("Firing probe...")
if probe.fire("My little probe", 42):
print("Probe fired!")
sleep(1)
```
You can then trace this probe with any tool able to trace Systemtap's probes.
Here's an example with eBPF/bcc:
```bash
sudo trace -p PID 'u::firstProbe "%s - %d", arg1, arg2'
```
Create USDT probes and instrument your Python application dynamically.
# Dependencies
At the moment this package only runs on Linux and requires
[libstapsdt](https://github.com/sthima/libstapsdt) to be installed to create
runtime probes.
## Ubuntu 16.04
To install libstapsdt, run:
```bash
sudo add-apt-repository ppa:sthima/oss
sudo apt-get update
sudo apt-get install libstapsdt0 libstapsdt-dev
```
## Other
Build from [libstapsdt](https://github.com/sthima/libstapsdt).
# Install
```bash
pip install stapsdt
```
# Example
The following code will create a probe named `firstProbe`.
```python
from time import sleep
import stapsdt
provider = stapsdt.Provider("pythonapp")
probe = provider.add_probe(
"firstProbe", stapsdt.ArgTypes.uint64, stapsdt.ArgTypes.int32)
provider.load()
while True:
print("Firing probe...")
if probe.fire("My little probe", 42):
print("Probe fired!")
sleep(1)
```
You can then trace this probe with any tool able to trace Systemtap's probes.
Here's an example with eBPF/bcc:
```bash
sudo trace -p PID 'u::firstProbe "%s - %d", arg1, arg2'
```
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
stapsdt-0.1.1.tar.gz
(3.0 kB
view details)
File details
Details for the file stapsdt-0.1.1.tar.gz
.
File metadata
- Download URL: stapsdt-0.1.1.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fabc2ca82a7c7f7307bd5326a1a1cace720aa6e1682a53afe09f6cb20218e636 |
|
MD5 | 513650dddf0322318909856857174bc2 |
|
BLAKE2b-256 | e271cb26f3dda412814e22b3ed538bac58379cdf2c003345579aefe7e0d13677 |