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-1.3.1.tar.gz (14.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-1.3.1-cp310-cp310-musllinux_1_1_x86_64.whl (26.3 MB view details)

Uploaded CPython 3.10musllinux: musl 1.1+ x86-64

traceable_agent-1.3.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (40.5 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

traceable_agent-1.3.1-cp39-cp39-musllinux_1_1_x86_64.whl (19.9 MB view details)

Uploaded CPython 3.9musllinux: musl 1.1+ x86-64

traceable_agent-1.3.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (30.4 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

traceable_agent-1.3.1-cp38-cp38-musllinux_1_1_x86_64.whl (13.5 MB view details)

Uploaded CPython 3.8musllinux: musl 1.1+ x86-64

traceable_agent-1.3.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (20.3 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

traceable_agent-1.3.1-cp37-cp37m-musllinux_1_1_x86_64.whl (7.0 MB view details)

Uploaded CPython 3.7mmusllinux: musl 1.1+ x86-64

traceable_agent-1.3.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (10.2 MB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.17+ x86-64

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

Hashes for traceable-agent-1.3.1.tar.gz
Algorithm Hash digest
SHA256 12166e1295e89021947a24d17e7507f80f2b2146a9721e99f9ae81edc0c277b5
MD5 98be50dd21e0516e49a748e66d7b0f84
BLAKE2b-256 dfd77044e534321c534e5a09035b6d7cc42ad3cfac6f8a4bd90f3883b00015e7

See more details on using hashes here.

File details

Details for the file traceable_agent-1.3.1-cp310-cp310-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for traceable_agent-1.3.1-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 de3328f248633c711d5673b2f0c736b827d48d83f7e974ae1b9ec537c49769b5
MD5 8df19536b28d14ce8fb5f9b08a9fc317
BLAKE2b-256 571fac989458298cf0394a278c8c96bc9238150c33643c4c39bd226511694132

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-1.3.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 589c83d59bbc150995202cf8118f64be9e225b665e73ee91398528f6e13ad3d1
MD5 c839b4be33b014fe19a14f429b34c1af
BLAKE2b-256 96431affa8c1e29059e01df3a1b8e1eeab3a51a538e02d6a47a3e9ef50bf2ffd

See more details on using hashes here.

File details

Details for the file traceable_agent-1.3.1-cp39-cp39-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for traceable_agent-1.3.1-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 9d4d28875f377cf8dec4e3ba3ab728691b9bfd203714169e2c1ba3ff8528d583
MD5 03a1f39ba77ca7286203df9c98351965
BLAKE2b-256 ba3a43b9e83480c4c5a965553fee471a579d6112a9d841d6f19780b483ec60e0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-1.3.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8b95cb8e5798c028829d545c5727cf3db728b298b241cd8c89163126556189dd
MD5 c0b7f166c697f0be445f7aad22e8fac3
BLAKE2b-256 14bee5bbec4d615ad6a32bbeaf5763ff0ef761035d323ff083c81265e293a576

See more details on using hashes here.

File details

Details for the file traceable_agent-1.3.1-cp38-cp38-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for traceable_agent-1.3.1-cp38-cp38-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 a948a094ebfe5348560b15fc48c2f1ff444d1f435e1f7d28df361b57c7a154b4
MD5 8a12ebd29e96be754f580bab33d61d2a
BLAKE2b-256 5c7ba18387f5edd257842801e44bbdbaa3799fe876d0cfdc4e46be571103e62a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-1.3.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 be75b89804fb9ed94c4799649abf49607c185f43a1bbea17e12188b47658f3d6
MD5 eebd38699a8fb90d8812cad1d6c907ec
BLAKE2b-256 794083f556d04ff5dea8f96a0cd998b1e3c919f879dec186a9483d597ab707cb

See more details on using hashes here.

File details

Details for the file traceable_agent-1.3.1-cp37-cp37m-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for traceable_agent-1.3.1-cp37-cp37m-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 bd5c25eff2256eabb81c961fa455fffe78badd9acc7fa75aadaec5234f32c3c0
MD5 d14c3050daba74494ea08bdb2a3bb6dd
BLAKE2b-256 e860760c9b0b3191901a4bcc6d351bd869cc7d980719a2d4ac26ccc51e974ec0

See more details on using hashes here.

File details

Details for the file traceable_agent-1.3.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for traceable_agent-1.3.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 86eb1333f36c1a65fda1f30759c950fed3c42df9b639390b3f1a1f28b5262c5e
MD5 e6edf95eb9eabedc7117a87bfce65939
BLAKE2b-256 db48df28e0d9cfbcdaca5ba629662b93fa728fb324eff4a828127bd469f05680

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