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.1.0b1.tar.gz (96.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-2.1.0b1-cp314-cp314-musllinux_1_2_x86_64.whl (13.0 MB view details)

Uploaded CPython 3.14musllinux: musl 1.2+ x86-64

traceable_agent-2.1.0b1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (12.0 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ x86-64

traceable_agent-2.1.0b1-cp313-cp313-musllinux_1_2_x86_64.whl (13.0 MB view details)

Uploaded CPython 3.13musllinux: musl 1.2+ x86-64

traceable_agent-2.1.0b1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (12.0 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

traceable_agent-2.1.0b1-cp312-cp312-musllinux_1_2_x86_64.whl (13.0 MB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ x86-64

traceable_agent-2.1.0b1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (12.0 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

traceable_agent-2.1.0b1-cp311-cp311-musllinux_1_2_x86_64.whl (13.0 MB view details)

Uploaded CPython 3.11musllinux: musl 1.2+ x86-64

traceable_agent-2.1.0b1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (12.0 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

traceable_agent-2.1.0b1-cp310-cp310-musllinux_1_2_x86_64.whl (13.0 MB view details)

Uploaded CPython 3.10musllinux: musl 1.2+ x86-64

traceable_agent-2.1.0b1-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (12.0 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

File details

Details for the file traceable_agent-2.1.0b1.tar.gz.

File metadata

  • Download URL: traceable_agent-2.1.0b1.tar.gz
  • Upload date:
  • Size: 96.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for traceable_agent-2.1.0b1.tar.gz
Algorithm Hash digest
SHA256 56c9848fa595fad3e4336f0551e2ae9b51245db4ecfc7e3c8f8a998ab9505063
MD5 d7cb3074d693b124f376fd0eda9e6778
BLAKE2b-256 24db429eece9ca18f4af39b5024935bfd0521265f9a0b58299d562d666ce8a23

See more details on using hashes here.

File details

Details for the file traceable_agent-2.1.0b1-cp314-cp314-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for traceable_agent-2.1.0b1-cp314-cp314-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 89e8fa09a026198da7c6bd73fe278eaec7aa194d2a3b6c3b2c3a9a31eba16cdc
MD5 8b45383e1705e86b340cec409d1782cc
BLAKE2b-256 33ff58541853759a26b1bf20f9af9940ef0eef6aae4c03874d60d2338e460b6f

See more details on using hashes here.

File details

Details for the file traceable_agent-2.1.0b1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for traceable_agent-2.1.0b1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 a0ec2c246c42785e4b3b5a89e36acbc3293ed943e89fb977bc48748e6af99144
MD5 187f432850f08cef79f4b9263ed951d6
BLAKE2b-256 e5242350c94080dcc25984252aae4eedb6e5c5bd723ab0f73412f579bd24f9af

See more details on using hashes here.

File details

Details for the file traceable_agent-2.1.0b1-cp313-cp313-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for traceable_agent-2.1.0b1-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 57979f697ee7aa08c9d8acceab0cf4efc38fa17c661bb9ad82539a2436ac6f37
MD5 2d760d10efeeb75a7df112f640996d03
BLAKE2b-256 8a93fb098ac6223835278691dae494571de8a8349faf1053d4de01b3aae5548f

See more details on using hashes here.

File details

Details for the file traceable_agent-2.1.0b1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for traceable_agent-2.1.0b1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 8f8cc08f5d9b81fab17a94cbbc5582120950f3ba6fb8cd73051fd4a19e076192
MD5 38780de06a330784247a46a61b085c85
BLAKE2b-256 75ad25aa2510b708b9577e19a3390c91b7262915e7f4e02107bed8b55b220dc6

See more details on using hashes here.

File details

Details for the file traceable_agent-2.1.0b1-cp312-cp312-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for traceable_agent-2.1.0b1-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 a4e5b42416e014ac37ed816c874db994d025495617c9dd4e3aed84a051f663ec
MD5 fd9ada4898cebfb1b4bfbeb14c789826
BLAKE2b-256 cc3a3cd32deb65a9fa4738a1c29fd2c333a76a16e9d13030e6e8d9ae06102a84

See more details on using hashes here.

File details

Details for the file traceable_agent-2.1.0b1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for traceable_agent-2.1.0b1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 1bb4acd8d0c9aebdc8fa5ac472c8a953546e584abce2b3af9a30f70d9faa4b6e
MD5 9375b79c84123ed06d21139f0ec9a5a7
BLAKE2b-256 3c0062cb480cfddd98313425fe7371712879f580c9b67ad245f337f49912ab55

See more details on using hashes here.

File details

Details for the file traceable_agent-2.1.0b1-cp311-cp311-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for traceable_agent-2.1.0b1-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 f903d11b2fab51fcd1c734fcfc38af2aef41b1b4620266030b4f6ee06e858cdf
MD5 78e796c29837fc62c517052ea98680a5
BLAKE2b-256 edad25fe54ccf59a02d8bafdde2ab8fa98bb97a00bdfab62a2041d7bb302751a

See more details on using hashes here.

File details

Details for the file traceable_agent-2.1.0b1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for traceable_agent-2.1.0b1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 0e19ca39de98130c79c43faad027d2d1d769f1dae3cdb053e183ffa409f08224
MD5 edce2791b917d73f0a0b2057efc9177a
BLAKE2b-256 ab0fb8c16aa3f3c8fb6d0ceb5e860de31246db63ef90a8dec1753e17817814c5

See more details on using hashes here.

File details

Details for the file traceable_agent-2.1.0b1-cp310-cp310-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for traceable_agent-2.1.0b1-cp310-cp310-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 bbbf8dfab96a86aa823588c8c4f4ee5a905b133cfe1f545fbff88979acdfa5d9
MD5 26533c3d259c97eec172c7d7bb1c2770
BLAKE2b-256 4fa228f5c59f199635ca3964e830d982917f56b5879d38ebe19a01143a170486

See more details on using hashes here.

File details

Details for the file traceable_agent-2.1.0b1-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for traceable_agent-2.1.0b1-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 5b0ddad1aadb78bc7616eaaad49e264193a06cea76f90ea0ea99e39367c719e4
MD5 8499c0f10e5e0a8d982666cd26bec873
BLAKE2b-256 e9950bdfea0360eeea157132a351bb3629ebb6cd5bb2134318d474ca919f5460

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