Traceable.ai Python Agent
Project description
Python Agent
Usage
Python traceable agent requires Python >= 3.6
Additionally, to use the traceable filter, you must be on a supported OS.
- Ubuntu 18.04+
- Centos 7+
- Debian 10+
- Amazon Linux 2+
Instrumentation methods
There are two ways to instrument your application, auto-instrumentation and code based instrumentation.
Autoinstrumentation
Simply prepend traceableai-instrument to your applications startup command.
ex: traceableai-instrument flask run
Code based instrumentation
Add the following snippet to your python apps entrypoint file:
from traceableai.agent import Agent
app = Flask(__name__)
agent = Agent()
agent.instrument(app) # This will instrument the flask app + any other modules that are supported
agent.add_traceable_filter() # add the traceable filter to enable blocking
Developing
# Create a virtual env & install dependencies
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt -r dev-requirements
Note: if you run into an error installing grpc:
File "/Users/user/.pyenv/versions/3.9.4/lib/python3.9/distutils/unixccompiler.py", line 120, in _compile raise CompileError(msg) distutils.errors.CompileError: command '/usr/bin/clang' failed with exit code 1
prepend this env var to the above pip install command:
GRPC_PYTHON_BUILD_SYSTEM_ZLIB=true
Building
pip install -r requirements.txt
python3 -m build
Instrumenting
traceableai-instrument your_startup_command
# ex: traceableai-instrument flask run -p 5000
Updating Libtraceable
When you want to update libtraceable you should first download the latest version and precompile the headers.
gcc -E blocking.h > blocking.h.preprocessed
Then mv blocking.h.preprocessed ./src/traceableai/filter/blocking.h.preprocessed
Additionally, open src/traceableai/autoinstrumentation/download.py
Edit the constant: LIBTRACEABLE_VERSION set it equal to the version you just generated headers for.
You can test this functionality by using the project within the: docker/test_apps
It will fail to build if libtraceable cannot be downloaded
Updating the Proto
git submodule update --init --recursive
./scripts/build_proto.sh
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
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file traceable-agent-1.0.1.tar.gz.
File metadata
- Download URL: traceable-agent-1.0.1.tar.gz
- Upload date:
- Size: 11.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
31611cc7a786f37c06393aa694cf8ca0b1536c66ec747d6dae78e194fe89850c
|
|
| MD5 |
85a56bc04490e4a5cf3cd025e2749c6c
|
|
| BLAKE2b-256 |
407e64898983cdbda3c221145257531c60247da7e5dc7c6c54d0633710ef3bed
|
File details
Details for the file traceable_agent-1.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: traceable_agent-1.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 8.6 MB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
786960ef8af340b85e0b773b38309396379623b30a524de9c8dcd149afc7378a
|
|
| MD5 |
c9d89bb6e58291bf1af1a781f0a649a4
|
|
| BLAKE2b-256 |
cb19ea8040ad6c9374118b7c53afbf959f325328699735b9b4857676a344a809
|
File details
Details for the file traceable_agent-1.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: traceable_agent-1.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 8.6 MB
- Tags: CPython 3.9, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4b3d64924fe69816cea41d32862460ef6e91d03719f4c584303894e6ddff3e2b
|
|
| MD5 |
f885371fc81ac78a767bd25e5877384c
|
|
| BLAKE2b-256 |
463321f8b05a8153f8516962b447314caf9b202f7c7b42fddb0074b55aca6b53
|
File details
Details for the file traceable_agent-1.0.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: traceable_agent-1.0.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 8.6 MB
- Tags: CPython 3.8, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
824835e255f46a6afb21791d42397a96afc6085fab5528e6e9f6abedc776afb2
|
|
| MD5 |
eafdf84b580811dacf3e669eff030fe3
|
|
| BLAKE2b-256 |
51d4c16c0774cf553816cf358f5a6f4d738b6028b836b435e936cb4ac5f14993
|
File details
Details for the file traceable_agent-1.0.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: traceable_agent-1.0.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 8.6 MB
- Tags: CPython 3.7m, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1b3d0b134e4faee89ca32cf08504880b2aadf9bd6ff4ba54302dca02c0edc671
|
|
| MD5 |
e26411c07ec63a1a84e7ccb18ce984e4
|
|
| BLAKE2b-256 |
7dae49f6f0d26af4dcb3adf5121cbcabfffd54b15b422bed0d71a4201f4c7345
|
File details
Details for the file traceable_agent-1.0.1-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: traceable_agent-1.0.1-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 8.5 MB
- Tags: CPython 3.6m, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3a87b4bec8db301815182845f48d07062f0fd37a6b157b64be16adbb42dd8c05
|
|
| MD5 |
4991cd558b6aab568f6d9cb508b72d54
|
|
| BLAKE2b-256 |
3c37f4ac005c079e50a2228e54bc7fbae1d4108b2d0d4912761ac8dc92483a9f
|