Skip to main content

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

  1. Update the libtraceable.h header file if it has changed.
  2. Edit ./src/download.py and update the constant LIBTRACEABLE_VERSION.
  3. 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
    1. Build the *.whl files. build_artifacts.sh builds all the whl files. Intentionally use the CIBW_SKIP environment variable to skip versions to save time. The example below only tests on 3.6.
      CIBW_SKIP="*37* *38* *39* *310*" ./build_artifacts.sh
      
    2. Build and run test in docker.
      docker build -f docker/test_apps/unittest.Dockerfile -t pythonunittest .
      docker run --rm pythonunittest
      
  • Test applications
    1. Refer to docker/test_apps/.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

traceable-agent-2.0.1.tar.gz (33.4 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

traceable_agent-2.0.1-cp313-cp313-musllinux_1_2_x86_64.whl (39.6 MB view details)

Uploaded CPython 3.13musllinux: musl 1.2+ x86-64

traceable_agent-2.0.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (60.7 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

traceable_agent-2.0.1-cp312-cp312-musllinux_1_2_x86_64.whl (33.2 MB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ x86-64

traceable_agent-2.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (50.6 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

traceable_agent-2.0.1-cp311-cp311-musllinux_1_2_x86_64.whl (26.8 MB view details)

Uploaded CPython 3.11musllinux: musl 1.2+ x86-64

traceable_agent-2.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (40.5 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

traceable_agent-2.0.1-cp310-cp310-musllinux_1_2_x86_64.whl (20.3 MB view details)

Uploaded CPython 3.10musllinux: musl 1.2+ x86-64

traceable_agent-2.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (30.4 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

traceable_agent-2.0.1-cp39-cp39-musllinux_1_2_x86_64.whl (13.9 MB view details)

Uploaded CPython 3.9musllinux: musl 1.2+ x86-64

traceable_agent-2.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (20.3 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

traceable_agent-2.0.1-cp38-cp38-musllinux_1_2_x86_64.whl (7.5 MB view details)

Uploaded CPython 3.8musllinux: musl 1.2+ x86-64

traceable_agent-2.0.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (10.2 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

File details

Details for the file traceable-agent-2.0.1.tar.gz.

File metadata

  • Download URL: traceable-agent-2.0.1.tar.gz
  • Upload date:
  • Size: 33.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for traceable-agent-2.0.1.tar.gz
Algorithm Hash digest
SHA256 67a227985104e5f164c6c2eed250e5a3193ace19dc53173210402e69f1bbe5b6
MD5 60516c3b0b34383eeab0b263416543dc
BLAKE2b-256 8abd2005a66b64d5ecb2a00f8edb8e3cc66f234d3d325b52c381f3288db9c7ae

See more details on using hashes here.

File details

Details for the file traceable_agent-2.0.1-cp313-cp313-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for traceable_agent-2.0.1-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 e984363427ff3ccb89c968cef70eeebef5bb515816415bbde5ab0093d1f2558c
MD5 031db894f7847c4c7bb518a398868887
BLAKE2b-256 318ea6587932239e8a840bdeaf96bc08a1e3b4cc95a48b8159646b0a3f1de0fd

See more details on using hashes here.

File details

Details for the file traceable_agent-2.0.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for traceable_agent-2.0.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 424f316a787e66fd421f41d8d5f51dc47f8340ec36ff1f80402d020dfbe1b7d6
MD5 af41384bbd83fb2088687050b6e4a997
BLAKE2b-256 9987fe0e90288d5ca2703d5e2b2deef36ea688a24f18bde887caa4c42f30246a

See more details on using hashes here.

File details

Details for the file traceable_agent-2.0.1-cp312-cp312-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for traceable_agent-2.0.1-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 94675b3b8394f6349bc528bb3ca9d533c9335e19fa21b1abce2cbac9c12b464e
MD5 efd708dc1390932e328dde7c60791350
BLAKE2b-256 44b4af708c326d13edc911139f218d8afa5ad73ded9bcb09147594632a966c95

See more details on using hashes here.

File details

Details for the file traceable_agent-2.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for traceable_agent-2.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 79ade8903b95db7bf68f04300ee9ba9b49cf164baf68167a505b68e6bcdfa912
MD5 de943a900f3562f70e1473cd65b43b39
BLAKE2b-256 e1a13791eba778c6866669df332e2dda86fac161f4fcd99acddbe17379fc5d78

See more details on using hashes here.

File details

Details for the file traceable_agent-2.0.1-cp311-cp311-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for traceable_agent-2.0.1-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 71c7e0adca2841df2af3a65f17ba322829909d6a805b85723d84aabd1268863a
MD5 eebe14c0cc424ef55418ab16bb72b5a3
BLAKE2b-256 000ac7eade9246b33785683d6d6acf62abed36136adf10d100105443fdb48e91

See more details on using hashes here.

File details

Details for the file traceable_agent-2.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for traceable_agent-2.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3cce75561eed7b3e55a98f928656c097d608359ada8c6317bd099292f9f8d17b
MD5 b03e019d2c5e7c82716b0ca0033e64c0
BLAKE2b-256 cf35052b8e92cc17514d972764c2f84275d1075a83aacdcc993de41ac4871722

See more details on using hashes here.

File details

Details for the file traceable_agent-2.0.1-cp310-cp310-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for traceable_agent-2.0.1-cp310-cp310-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 6a73849f68a3f5e30500c0280d306bd61b14f4aa2c108fb61794f30e94714326
MD5 c9659550a2119af1a7a76eec624dee58
BLAKE2b-256 42517c5b6a5320da3a609eb671e703478b16ee43a17cd7d3148752b34fd1699c

See more details on using hashes here.

File details

Details for the file traceable_agent-2.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for traceable_agent-2.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1aef4956926243355a0ffe31f3304b7ab473e6483f37bc93cd954dce383d3732
MD5 e71e01d84574f297641228f09964710d
BLAKE2b-256 c8d437f46193cf9a91aa61af181ba9fff1255986fc3efcf2e5f4f3de42bbaf34

See more details on using hashes here.

File details

Details for the file traceable_agent-2.0.1-cp39-cp39-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for traceable_agent-2.0.1-cp39-cp39-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 9e7f27eb0d8eab3868f7f3f8c5388f5dffda2b49f033a6f5fa9076e56542fea6
MD5 0a8734e73d33485a92d442df0f645989
BLAKE2b-256 72030a0e0d9fe7f241becddc111f00f4f7268c996d3f5cc2ad2f6b7c47dba4f6

See more details on using hashes here.

File details

Details for the file traceable_agent-2.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for traceable_agent-2.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e3cfb23dc956a76bcee294b43001077bdf088462cfc541c2cf2095bb1ac5e33c
MD5 a95b67af64e55dc4ab6c58e1bc88b579
BLAKE2b-256 125a26bb6594cbc8e6bc69117498bf1cae5de9814ba5ff16cbbd1cbabfa87062

See more details on using hashes here.

File details

Details for the file traceable_agent-2.0.1-cp38-cp38-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for traceable_agent-2.0.1-cp38-cp38-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 1cfe138fc51da1d839fc93deb607d9a9f1e2d588c7ac7d2ccb2ef382bb4720f8
MD5 7e579353b76cf4e8fef0263bc8ff0812
BLAKE2b-256 604e947724f2658bcba014414bdccb8fb773dc900daac2e2bac8d74567f59091

See more details on using hashes here.

File details

Details for the file traceable_agent-2.0.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for traceable_agent-2.0.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 dd2598962560b6c4678744382cdab04e17ba6932366977f128b5a79c21754212
MD5 2c37c8b36478d40386c723c11ac17581
BLAKE2b-256 f75898bdce1a92c8a495f974bcb076286dd602aa2a996b0e373b0a50695eba4e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page