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.3.tar.gz (13.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.2.3-cp310-cp310-musllinux_1_1_x86_64.whl (32.4 MB view details)

Uploaded CPython 3.10musllinux: musl 1.1+ x86-64

traceable_agent-1.2.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (50.3 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

traceable_agent-1.2.3-cp39-cp39-musllinux_1_1_x86_64.whl (26.0 MB view details)

Uploaded CPython 3.9musllinux: musl 1.1+ x86-64

traceable_agent-1.2.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (40.2 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

traceable_agent-1.2.3-cp38-cp38-musllinux_1_1_x86_64.whl (19.7 MB view details)

Uploaded CPython 3.8musllinux: musl 1.1+ x86-64

traceable_agent-1.2.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (30.2 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

traceable_agent-1.2.3-cp37-cp37m-musllinux_1_1_x86_64.whl (13.3 MB view details)

Uploaded CPython 3.7mmusllinux: musl 1.1+ x86-64

traceable_agent-1.2.3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (20.1 MB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.17+ x86-64

traceable_agent-1.2.3-cp36-cp36m-musllinux_1_1_x86_64.whl (7.0 MB view details)

Uploaded CPython 3.6mmusllinux: musl 1.1+ x86-64

traceable_agent-1.2.3-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (10.1 MB view details)

Uploaded CPython 3.6mmanylinux: glibc 2.17+ x86-64

File details

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

File metadata

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

File hashes

Hashes for traceable-agent-1.2.3.tar.gz
Algorithm Hash digest
SHA256 f444175ddd4e2dfc4649375d51151855ce0b223a3c1edd14552adc70c709065b
MD5 1c8b40acb9f876479d9fa520f44c0f01
BLAKE2b-256 a39bf7199f7d59d25ffaa7b0b27856703535b639ee6624e09006f4065801539e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-1.2.3-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 a68cc297f4c26639499bf001c11c7646ee47decec65a97414b7a03b7b45ad3e4
MD5 4bf4eb6d416502ffa1fa80a00ad64e8a
BLAKE2b-256 1784208e91035369deb4a3f67b42ba8631dbd247ecfbceb962b8243ce9f0993a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-1.2.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5db7efeb4c7bf702355c479a8dfcacba5eacf5ca3e20c1df4f56f1610f338f1c
MD5 d73aa5d2789391473eb5a2c84e09ceaf
BLAKE2b-256 1f0884026fecd194c76bf1ff395cd01fe2d7e97ae73cf2392210c97544afa16c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-1.2.3-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 92a21ddd2ab2f1ae230834ef2377975981a4e5de38b5b464fc38052cec75b8d6
MD5 bf750919dcbcb56334eaf8fa8e57aa51
BLAKE2b-256 8d1aa051e07ac458a196029882af33b673eb80f39dcf8a37e325b7ebadf69a2b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-1.2.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1518e91d1303046927b5823ac449156adbfd74f6581c12f00576e322ca3e4778
MD5 95f1ac63d21a920d1f2d97814df3e3f0
BLAKE2b-256 64bd2943f074364232476c00e976b0dcabf092f39d78b82bda21828be9b47404

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-1.2.3-cp38-cp38-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 63fa412afa278613f338157f5b974e844cf3edb87f4fe5e9336ac6f03cc0850f
MD5 faaa320110cdd9bfb5afb79b148d1982
BLAKE2b-256 213f3035c450cb5e099d571c13ee09a3b82d408db202a73a8b773e65b8cd1297

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-1.2.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3adc915043c7c7b0ba1a57bb75d68f1b250e6da069662a82b8c8ed28626f054b
MD5 863dd0432e6d374ac0ec7c1c8d446d74
BLAKE2b-256 e316d459f1f9e7566deb826812aaf66cb6549a53f50bf4069144a356e8d427a7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-1.2.3-cp37-cp37m-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 5c355f19c52a892ffa4b17837c1a4d40b07971a9b4d00ea2cbc0be0521fd742e
MD5 9b3613ea24dfbdd2c41d54022c81c894
BLAKE2b-256 070c6a67a0fcd362b42c4969f81a4fca36a3bf5cbf49fa010a42819573d0a3ad

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-1.2.3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 cc3240da31c35126ed6ce9996b8788db11ae4b2db36b7fcdd0b48934f94bdcdf
MD5 9d4070557a96c54f9c65f4f7bfd57c86
BLAKE2b-256 58f7b12331cde322c5c28565a3860698383856ee4101e2090c0fc6f53f0c179d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-1.2.3-cp36-cp36m-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 5710835d217f38dcba299fe8e0101942bda49539208616050d6dd4325d8f645c
MD5 2e4200fd32da6266e152098cecd369b7
BLAKE2b-256 f845e4371bd486539a1a38b9d8a916d35bfea2109408b19939475ecc5a03c7cd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-1.2.3-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b1d229ee24fba709e9365623db07207d0372d126f7bb1cace12f6a580601a391
MD5 b2d6b5d4672bcf46b042bdf50c730e3b
BLAKE2b-256 900256754d7f8901220a0d22c4d79adb84f2465d1802373d898d2be5184ad20b

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