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 blocking.h > blocking.h.preprocessed

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

Additionally, open src/traceableai/autoinstrumentation/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

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.0.3.tar.gz (11.8 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.0.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (8.6 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

traceable_agent-1.0.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (8.6 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

traceable_agent-1.0.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (8.6 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

traceable_agent-1.0.3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (8.6 MB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.17+ x86-64

traceable_agent-1.0.3-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (8.5 MB view details)

Uploaded CPython 3.6mmanylinux: glibc 2.17+ x86-64

File details

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

File metadata

  • Download URL: traceable-agent-1.0.3.tar.gz
  • Upload date:
  • Size: 11.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for traceable-agent-1.0.3.tar.gz
Algorithm Hash digest
SHA256 1c2603a178c9c21af35b5c3a61f223e96c16da1993cfade7b496c8ac0de425d9
MD5 7bad8fcc87df6b0d225e7f704c68c693
BLAKE2b-256 36656624fdbc65612c5181175b3865d07b745481b527276c7a1c493ed41b5c85

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-1.0.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 920e5ff167d0ddebf43f3668a76356bc92ba72e754f6ece6960037dd456ff1fa
MD5 2ece90041ad3be2d1db58c31089db92e
BLAKE2b-256 d057439f3bf56505bc168c7f194bcb30b83ed74d044baf1adcb793fe7e2512b3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-1.0.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e1c39d426507d5ff425422041e0797642e87c73a4f0586e51d72ab35f2c7a8d7
MD5 226b9e2de26ed9fd9954267508a60dd7
BLAKE2b-256 f7c11b2125eec06a9dbc32403040b116a621dbbbde6866b2a16261f3dc21cdc2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-1.0.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bf8b66654a488d2fe1987f8c3cc704a28f7ad8ec2f3262013eabc956111c48d0
MD5 d41142efb5accb4846b063b2d743e9c6
BLAKE2b-256 08cc6c5a3e4ad1f3dedd802f83cdb052cdb336de1702ff511eb6752dfe4b2ae8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-1.0.3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2006613ccf26472d77a27b52355fe5fa5ae01ba93eb872e190f1e38837d83a63
MD5 21decd271dc557932b171bd19f1335f1
BLAKE2b-256 2fd5e83c7dbf0310e6c7cf97050fe41cfb922cc26219e4dce299b690ec620daa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-1.0.3-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 cdbe92ae997a02bc8798a3e1eadc94b295bf7ff4dc1043bbde5f8d0d58194307
MD5 b1b5421fc4986a08eab52831d001b65a
BLAKE2b-256 a15f728b7a64d40867fc3e1c6c15f7d8fa4ddca321ca87d0053253fbf54f2d46

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