Skip to main content

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

  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 --build-arg ARTIFACTORY_USER --build-arg ARTIFACTORY_TOKEN -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.2.1.tar.gz (12.2 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.2.1-cp310-cp310-musllinux_1_1_x86_64.whl (28.7 MB view details)

Uploaded CPython 3.10musllinux: musl 1.1+ x86-64

traceable_agent-1.2.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (46.9 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

traceable_agent-1.2.1-cp39-cp39-musllinux_1_1_x86_64.whl (23.1 MB view details)

Uploaded CPython 3.9musllinux: musl 1.1+ x86-64

traceable_agent-1.2.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (37.5 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

traceable_agent-1.2.1-cp38-cp38-musllinux_1_1_x86_64.whl (17.5 MB view details)

Uploaded CPython 3.8musllinux: musl 1.1+ x86-64

traceable_agent-1.2.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (28.2 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

traceable_agent-1.2.1-cp37-cp37m-musllinux_1_1_x86_64.whl (11.9 MB view details)

Uploaded CPython 3.7mmusllinux: musl 1.1+ x86-64

traceable_agent-1.2.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (18.8 MB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.17+ x86-64

traceable_agent-1.2.1-cp36-cp36m-musllinux_1_1_x86_64.whl (6.2 MB view details)

Uploaded CPython 3.6mmusllinux: musl 1.1+ x86-64

traceable_agent-1.2.1-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (9.4 MB view details)

Uploaded CPython 3.6mmanylinux: glibc 2.17+ x86-64

File details

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

File metadata

  • Download URL: traceable-agent-1.2.1.tar.gz
  • Upload date:
  • Size: 12.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.15

File hashes

Hashes for traceable-agent-1.2.1.tar.gz
Algorithm Hash digest
SHA256 98d222e0b611fca147cfbdbf47f09e6a8f03eace73d6259f9345b89121d9c24e
MD5 4b3679ee4b730afb41271c2cf2f59a62
BLAKE2b-256 b1e024d9fa1d6fa256d3d81571f85370ffe135eabf319316b7471bff40b6d180

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-1.2.1-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 b0599745f9b92e25ed2208705773d3543c150d068316d1812073b6a3b53857c2
MD5 4b5076e7e81b46c5b63484887230e5d7
BLAKE2b-256 91ea2fdc7d21338c8502f8dbcac780f50f3df51442e684f0a8bd1eddee306219

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-1.2.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1ce27939fa83dbbbd332389ce86d51b12bab2e7abd95be202a2877f375a61fcb
MD5 80f6f2182a0e2c1c79da65443b0e268b
BLAKE2b-256 4f52ae5da0015a816e6948e39a18c2fb7a95595e8819ea461ed03c2a319e7b81

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-1.2.1-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 2a075431e4307e9ed597a3719c308b450eaf89b4ac3b5978f5e4af12cf1105b4
MD5 868f72b267c2970e9a3d19af33064c32
BLAKE2b-256 d23bdc0665f088bdd55178771cbb0fa4f086fc7d5856fca467967a04d86c4599

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-1.2.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 31e678f2d8e1d888e132c8fe951156cd9481efcaf09dc6dcfb4830702064bc94
MD5 5ee9495ff26168d99a46a292c2294a3e
BLAKE2b-256 934690a2f5b888bbfd468033e3111ab92eed78f61c2473e245444c95448798e8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-1.2.1-cp38-cp38-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 f7eb575c33c0272080d9a53734b14546e977e7edcf2c8da8b371b2bfaa864221
MD5 e4dea6a78d118507b5b36de5845bdffe
BLAKE2b-256 bc64214b420ef7d8f3351fc58289c3d43b34986e0983e3f73c7378fc3e9a3168

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-1.2.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 801ed5e9e447310ae73fce5c9069457c25b6c86183aafe835219970a9b43269d
MD5 f8acba37553d9d735b8c60fa8e850439
BLAKE2b-256 37990dbf018b2b73f449b77a0722ecb14cf2358673ad58988368d5a47ab1794d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-1.2.1-cp37-cp37m-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 f30a8b69e098706a303f63dd188b47eeebb729d8b8865e60f0c53f3e5363db2a
MD5 776a6eded7a80dcd815ed6d2acb8f232
BLAKE2b-256 9554c496d64dd61e4a718df41d81c8ec2e7ed6f9dfdbd430ddd8c3a6c2d8f1b3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-1.2.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7b70e54c95c25ef7994b182a50f8c1102d4f06d5cf84348ca239a7cb8d8c3d50
MD5 e3b445b62c00d035bfcf7254c0a75a9e
BLAKE2b-256 de4082c54f28db6230ffb5f6030cc45df3242f54bc018c9a9e102aaf18708dfb

See more details on using hashes here.

File details

Details for the file traceable_agent-1.2.1-cp36-cp36m-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for traceable_agent-1.2.1-cp36-cp36m-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 ce98038ce2a4579f86427936e092b349e373be90b655d99b60ec96f6ee7a6f90
MD5 bf7920cc42856be1dac38ce336c92756
BLAKE2b-256 3ae49a509e8eb14c35abef96fcc2e58bd9d29d365a1849895550a4cd9e9e9008

See more details on using hashes here.

File details

Details for the file traceable_agent-1.2.1-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for traceable_agent-1.2.1-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 621b052a51d2bbfe32e1f3267536b1d16fa11bc84a3548da1cd28b394af657eb
MD5 1c8c2ccbfdca746b74d834c24bff9167
BLAKE2b-256 7f5d687a02dccf2d586111b68c2158e82438999b5cd1d21c40a782805a63fddb

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