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.2.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.2-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.2-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.2-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.2-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.2-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.2.tar.gz.

File metadata

  • Download URL: traceable-agent-1.0.2.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.2.tar.gz
Algorithm Hash digest
SHA256 e87776ce91aea43f124f0ba066a86169605021bac354a240e70dad626e365ec0
MD5 5af5d1a9d5dac02373840c8289f073d9
BLAKE2b-256 868a65df1dd5ce541fa5af0325e3a83b69eb3565ce2247a7270b4510adfe18e7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-1.0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6c5ed10b8029b6e45f4d58bec2dc26342b8e05457c48bd80bab7e39d450e0a8a
MD5 43cd33902879dafa34ec3abbb6209c9e
BLAKE2b-256 dda11f4902ca6421fefe4cc8b11fe1b980e1f62956492f9d32081962c0708c86

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-1.0.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 23651f093ea019ecca9008d8e6a803b5444d5d249f98553b9ed566ed2e33ccb9
MD5 ae0f9286c1a443749fc563fad06f19b9
BLAKE2b-256 028c42e88f86b57b296ddb033b17140c3a1c63cef156186ff6fef522cf327edc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-1.0.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b0c24665792b156b236a495f2df9c34b80ce78b6bb085ffe448d7afe13b836bf
MD5 8ec9291a5286ffd0e6fa4c2456dc09d9
BLAKE2b-256 9adfa4a12f35a1c4355c72f23ca09d04f2de1a9cff2a6031976c89bfd3e9a8f5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-1.0.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 285b2221a09ab313b06ae589517cf3ad12bad090608031067293008be9f1ddfc
MD5 55c44630b18a7930184e9ed20a13df8f
BLAKE2b-256 7262f4c5db97ad6f30dab35bfd0aa513fb3362e95ff429d2afbddd0a486c28f0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-1.0.2-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a9c92cfbb4734271ab3aaf874543c232a41ff6c0f3464bdc81fbeafe85b002df
MD5 349484e83eaed0cec608356bc71a3615
BLAKE2b-256 c717ea93fdeb7ffff414b10c39a46227af037c92100c2866c62ef129327571bc

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