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

When you want to update libtraceable you should first download the latest version and precompile the headers. gcc -E libtraceable.h > libtraceable.h.preprocessed

Then mv libtraceable.h.preprocessed ./src/traceableai/filter/libtraceable.h.preprocessed

Additionally, open src/download.py Edit the constant: LIBTRACEABLE_VERSION set it equal to the version you just generated headers for.

You can test this functionality by using the project within the: 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

Unit Tests

build_artifacts.sh builds all the whl files. Specify skipped versions in (CIBW_SKIP) to only build 3.6 for unit tests.

CIBW_SKIP="*37* *38* *39* *310*" ./build_artifacts.sh
docker build --build-arg ARTIFACTORY_USER --build-arg ARTIFACTORY_TOKEN -f docker/test_apps/Dockerfile.unittest -t pythonunittest . && docker run --rm pythonunittest

Test applications

Refer to docker/test_apps/ and the corresponding scripts in scripts/

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.0.tar.gz (12.3 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.0-cp310-cp310-musllinux_1_1_x86_64.whl (28.6 MB view details)

Uploaded CPython 3.10musllinux: musl 1.1+ x86-64

traceable_agent-1.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (46.7 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

traceable_agent-1.2.0-cp39-cp39-musllinux_1_1_x86_64.whl (23.0 MB view details)

Uploaded CPython 3.9musllinux: musl 1.1+ x86-64

traceable_agent-1.2.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (37.4 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

traceable_agent-1.2.0-cp38-cp38-musllinux_1_1_x86_64.whl (17.4 MB view details)

Uploaded CPython 3.8musllinux: musl 1.1+ x86-64

traceable_agent-1.2.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (28.1 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

traceable_agent-1.2.0-cp37-cp37m-musllinux_1_1_x86_64.whl (11.8 MB view details)

Uploaded CPython 3.7mmusllinux: musl 1.1+ x86-64

traceable_agent-1.2.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (18.7 MB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.17+ x86-64

traceable_agent-1.2.0-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.0-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.0.tar.gz.

File metadata

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

File hashes

Hashes for traceable-agent-1.2.0.tar.gz
Algorithm Hash digest
SHA256 0b8f980a096f64550f08c39500a9fa23b30657a1b8946cc76c6afb0a8e5b7004
MD5 297eb9384ee3d06fc29ba11b1c3b1cad
BLAKE2b-256 844ba8c548d14d1729694638328a44299525e39d53f45e85126e4ba359aa81f9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-1.2.0-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 3b106108b3ea02f77057b392773851e0520a071c3c48c8e655353f9b3c8eb76d
MD5 e9b03e8645df9662ea3be1c1f33be0e4
BLAKE2b-256 d08093d422442df027264fbd0391647751b845f49a67bf64d2e625a7430676ed

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-1.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3f4f0538f8e668a75211d7a8baf89d99b3cb01974f6648e8b392fe623e2b7e17
MD5 213905375af11fab732977aa11077524
BLAKE2b-256 cf6263c8813b0f73ed254370f987b2936373dc04d5c1df618763eee305f90444

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-1.2.0-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 e6272ca8ce872d71ab0611f6e8a9f7625314cd8d600b626f7e337edf299caed9
MD5 dab90f54bec16fd4e199ecc194e52af5
BLAKE2b-256 f985a1d710dffc5732b6ae99c0205b8cd358adfb4d8e4b9622457bdd0a0bc082

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-1.2.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 cf63c25393eddbf44174feea314f2cf0205549b324ecf5290e2c336683d8e7e1
MD5 8424e2e254602229f866f2114347ff5b
BLAKE2b-256 fa71214145ac06b83be91300609a318b79a2e775ac83a5c4f671c98fa1703fb7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-1.2.0-cp38-cp38-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 a4a5ac303eb50561b72027b2d1e635223f53cfd62ecfe8dcb83bd7f08d9f80e8
MD5 3f869b4366a77f341a83dea57cc1cd16
BLAKE2b-256 c82a870d9a0de8e4402c46267a92c978140ba6bfae56ff276e9dc8a009d9407e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-1.2.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 56764d504ebc1ff058261e581d5078528e3a552912a1306a18e0c67d9ec7a293
MD5 526ae3400bbd901810f3b789d8442818
BLAKE2b-256 e72a426500f87b188fe0e1f08001afd263e42d907f6288293129e9d38c9218a8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-1.2.0-cp37-cp37m-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 f476c712d5e663fb9ab7085dca7e0e5341c1bdb3e0ae252b2cfc04ed7737a041
MD5 bf6434d4ee1f6152e4d927afb86a5f88
BLAKE2b-256 43cb8a4efb03ad80ca7164ef1c70568f8295d3cf6da7bd45df659ed31296b1df

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-1.2.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6cc5551a2cc8056611358d3937d089a8cb168c126fd6708dc4616390cdd6f952
MD5 297a283a5d7311001a5ea47701d14ec3
BLAKE2b-256 023c48d7530917661dac69862f52dcf3fd1b015efca42ada128ad37cf42eac05

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-1.2.0-cp36-cp36m-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 ef84279f4c4716e04c25e2877ed407f88da61e2ed789cf3104e2fedbc6697bb9
MD5 ea98356f08df50534ed47dcdacc053b6
BLAKE2b-256 be3998aa680a4dcb9e06d6b64367c7664453d5c85b7d9923a7f73845f484f2fe

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-1.2.0-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 16b212b1d5a8f647e2fae98c05e21764f20d1612783124e8bf87461c49f965f8
MD5 415e9ba6b4bb96e84b0757f5ac9f87bd
BLAKE2b-256 e4c21a077e9bddd2a67a133a78a99fcb9bc178382dcbc28038f35d8eb3d6e4dd

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