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.0.tar.gz (33.7 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.0-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.0-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.0-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.0-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.0-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.0-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.0-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.0-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.0-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.0-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.0-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.0-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.0.tar.gz.

File metadata

  • Download URL: traceable-agent-2.0.0.tar.gz
  • Upload date:
  • Size: 33.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for traceable-agent-2.0.0.tar.gz
Algorithm Hash digest
SHA256 fa46ebc5aba5ac822e2a78c4fd1386810349e8e14d3264d95e1480b9a510d774
MD5 e4f47a348d2ef8daec061a59ae98665b
BLAKE2b-256 d44baf49e6742fb66afd94ba412c216094c21d80390ad5b0bc97950321a1199f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-2.0.0-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 7f0f2e1494c62ff5ad5a1c9c5083886cdcc558d4152b8f4adcab2a9aab6f08f9
MD5 ef6b4563bd259d3f1155d7164dd49c15
BLAKE2b-256 213dea048b1cc99eef3c276af6f324a717ae2336ed8a5e1f93409f926fa4c695

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-2.0.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 04749901132722adbf8a5bc009e8bde6e918f2037480646b21582a674f8d9402
MD5 5f77442f7276e16ea3dea99f791bddad
BLAKE2b-256 b9da738b83b8a5550d31410d27a1e168ace7921f35ffea4f3d34ffb0c9cefb4f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-2.0.0-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 c26ab5d69e92fc3ad935a13803dcafa13bfba2943f76ff3a065db02caa2b369c
MD5 c3da0ed359b2e49331b85b9830920f0e
BLAKE2b-256 2f17f56ff3e37a0e59f54bfb173de837014a4369ed25acb03998cedc2bb32056

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-2.0.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 28dd562151bfbe1a1ae130ab93de04621c28ecb5bf5d201a307ff9b4c417397f
MD5 db14ad41d296d32ab5de1d3e874b76be
BLAKE2b-256 f950029570351edbb73aa8d648fd411794052b4df2e7de578da90a4118f1c932

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-2.0.0-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 692f3bd0dbe83f164f28fff9cb569be5079ccaff1ccceb24177956155db4519f
MD5 00a950a8517daa179fe3db086db4f8fd
BLAKE2b-256 b295cc18f36df856916058c3347077e1afcb180c406854b3cd2171a64873e388

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-2.0.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f62e07afd977cd66a13cd46c47a34e2fc58f3c8061ee8859ff9fcf1972cf1f78
MD5 3ebb420e1b77d9e5cd4e1b664d87f8e4
BLAKE2b-256 1c6775c670e36870dc775f0ac25d92f5b954553857ed52a5ad97672c9cdd5ce6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-2.0.0-cp310-cp310-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 a7cfbf4a16cc3c747ba9cd3c3aa99c851a8d9359410c4bfec455df6b4dd10e43
MD5 ef69c160d7b132daf7e356dfe76e57af
BLAKE2b-256 5e9dd4a5e2211ddf241c7cdea01f5285dc5428d9e50cb563d9b185fd19e081a9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-2.0.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 268b9b6aba702c5001e277efb060f50b73a5b7036516ee7959b9039637a592db
MD5 5914d95382bfa08091f82248d69d3159
BLAKE2b-256 c8737ea2f7c781f8563d334708d91c54aa792be06d575d1a5ce26027ac4a0b31

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-2.0.0-cp39-cp39-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 c3559bde54fd1f3c5384a955538700f5ac6d219dd3c2ae57c148cbc7dd29d3ad
MD5 7d44440ccd9df679e388fcf7b75283d9
BLAKE2b-256 e89ab1f00d58ffcbf883e223fe245e6f83720c53f90cc34f690e4f749955fcf7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-2.0.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b50838eb95ae89698414ea526ea053951f45b55ca8e08013b872d97190c0c967
MD5 5b7713eb97f26f565498d76cf189298d
BLAKE2b-256 2001cb30d74ad5446849ce10552af5cc395355ea7b356f26dcd3d4775dce45c6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-2.0.0-cp38-cp38-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 7197427d550250455c2bd1de3fa36b3cd4ac274fd68c6de0f11e1be0394c373a
MD5 566af0a283422f9690bad3d592b98404
BLAKE2b-256 8b89463e6fe562e91b625cd99ca1410f460b1409126be85168d4340cc4a8f9c4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-2.0.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2033209c907f17de204bb45ccfebec610b697eaa58994d40f77eee1a6f7d58c2
MD5 3bf97a0fba7d82ae7c8f10f861fb26a5
BLAKE2b-256 288e540086f9e4116502515ed679ef76d2aa072e0c59731ccf6975895fde8dd7

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