Traceable.ai Python Agent
Project description
Python Agent
Usage
Python traceable agent requires Python >= 3.7
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.txt
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
- Update the
libtraceable.hheader file if it has changed. - Edit
./src/download.pyand update the constantLIBTRACEABLE_VERSION. - Verify using a test application in
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
Testing
- Unit tests
- Build the *.whl files.
build_artifacts.shbuilds all the whl files. Intentionally use theCIBW_SKIPenvironment variable to skip versions to save time. The example below only tests on 3.6.CIBW_SKIP="*37* *38* *39* *310*" ./build_artifacts.sh - Build and run test in docker.
docker build -f docker/test_apps/unittest.Dockerfile -t pythonunittest . docker run --rm pythonunittest
- Build the *.whl files.
- Test applications
- Refer to
docker/test_apps/.
- Refer to
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.3.1.tar.gz.
File metadata
- Download URL: traceable-agent-1.3.1.tar.gz
- Upload date:
- Size: 14.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
12166e1295e89021947a24d17e7507f80f2b2146a9721e99f9ae81edc0c277b5
|
|
| MD5 |
98be50dd21e0516e49a748e66d7b0f84
|
|
| BLAKE2b-256 |
dfd77044e534321c534e5a09035b6d7cc42ad3cfac6f8a4bd90f3883b00015e7
|
File details
Details for the file traceable_agent-1.3.1-cp310-cp310-musllinux_1_1_x86_64.whl.
File metadata
- Download URL: traceable_agent-1.3.1-cp310-cp310-musllinux_1_1_x86_64.whl
- Upload date:
- Size: 26.3 MB
- Tags: CPython 3.10, musllinux: musl 1.1+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
de3328f248633c711d5673b2f0c736b827d48d83f7e974ae1b9ec537c49769b5
|
|
| MD5 |
8df19536b28d14ce8fb5f9b08a9fc317
|
|
| BLAKE2b-256 |
571fac989458298cf0394a278c8c96bc9238150c33643c4c39bd226511694132
|
File details
Details for the file traceable_agent-1.3.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: traceable_agent-1.3.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 40.5 MB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
589c83d59bbc150995202cf8118f64be9e225b665e73ee91398528f6e13ad3d1
|
|
| MD5 |
c839b4be33b014fe19a14f429b34c1af
|
|
| BLAKE2b-256 |
96431affa8c1e29059e01df3a1b8e1eeab3a51a538e02d6a47a3e9ef50bf2ffd
|
File details
Details for the file traceable_agent-1.3.1-cp39-cp39-musllinux_1_1_x86_64.whl.
File metadata
- Download URL: traceable_agent-1.3.1-cp39-cp39-musllinux_1_1_x86_64.whl
- Upload date:
- Size: 19.9 MB
- Tags: CPython 3.9, musllinux: musl 1.1+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9d4d28875f377cf8dec4e3ba3ab728691b9bfd203714169e2c1ba3ff8528d583
|
|
| MD5 |
03a1f39ba77ca7286203df9c98351965
|
|
| BLAKE2b-256 |
ba3a43b9e83480c4c5a965553fee471a579d6112a9d841d6f19780b483ec60e0
|
File details
Details for the file traceable_agent-1.3.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: traceable_agent-1.3.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 30.4 MB
- Tags: CPython 3.9, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8b95cb8e5798c028829d545c5727cf3db728b298b241cd8c89163126556189dd
|
|
| MD5 |
c0b7f166c697f0be445f7aad22e8fac3
|
|
| BLAKE2b-256 |
14bee5bbec4d615ad6a32bbeaf5763ff0ef761035d323ff083c81265e293a576
|
File details
Details for the file traceable_agent-1.3.1-cp38-cp38-musllinux_1_1_x86_64.whl.
File metadata
- Download URL: traceable_agent-1.3.1-cp38-cp38-musllinux_1_1_x86_64.whl
- Upload date:
- Size: 13.5 MB
- Tags: CPython 3.8, musllinux: musl 1.1+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a948a094ebfe5348560b15fc48c2f1ff444d1f435e1f7d28df361b57c7a154b4
|
|
| MD5 |
8a12ebd29e96be754f580bab33d61d2a
|
|
| BLAKE2b-256 |
5c7ba18387f5edd257842801e44bbdbaa3799fe876d0cfdc4e46be571103e62a
|
File details
Details for the file traceable_agent-1.3.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: traceable_agent-1.3.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 20.3 MB
- Tags: CPython 3.8, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
be75b89804fb9ed94c4799649abf49607c185f43a1bbea17e12188b47658f3d6
|
|
| MD5 |
eebd38699a8fb90d8812cad1d6c907ec
|
|
| BLAKE2b-256 |
794083f556d04ff5dea8f96a0cd998b1e3c919f879dec186a9483d597ab707cb
|
File details
Details for the file traceable_agent-1.3.1-cp37-cp37m-musllinux_1_1_x86_64.whl.
File metadata
- Download URL: traceable_agent-1.3.1-cp37-cp37m-musllinux_1_1_x86_64.whl
- Upload date:
- Size: 7.0 MB
- Tags: CPython 3.7m, musllinux: musl 1.1+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bd5c25eff2256eabb81c961fa455fffe78badd9acc7fa75aadaec5234f32c3c0
|
|
| MD5 |
d14c3050daba74494ea08bdb2a3bb6dd
|
|
| BLAKE2b-256 |
e860760c9b0b3191901a4bcc6d351bd869cc7d980719a2d4ac26ccc51e974ec0
|
File details
Details for the file traceable_agent-1.3.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: traceable_agent-1.3.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 10.2 MB
- Tags: CPython 3.7m, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
86eb1333f36c1a65fda1f30759c950fed3c42df9b639390b3f1a1f28b5262c5e
|
|
| MD5 |
e6edf95eb9eabedc7117a87bfce65939
|
|
| BLAKE2b-256 |
db48df28e0d9cfbcdaca5ba629662b93fa728fb324eff4a828127bd469f05680
|