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-1.3.0.tar.gz (14.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.3.0-cp310-cp310-musllinux_1_1_x86_64.whl (26.3 MB view details)

Uploaded CPython 3.10musllinux: musl 1.1+ x86-64

traceable_agent-1.3.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (40.5 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

traceable_agent-1.3.0-cp39-cp39-musllinux_1_1_x86_64.whl (19.9 MB view details)

Uploaded CPython 3.9musllinux: musl 1.1+ x86-64

traceable_agent-1.3.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (30.4 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

traceable_agent-1.3.0-cp38-cp38-musllinux_1_1_x86_64.whl (13.5 MB view details)

Uploaded CPython 3.8musllinux: musl 1.1+ x86-64

traceable_agent-1.3.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (20.3 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

traceable_agent-1.3.0-cp37-cp37m-musllinux_1_1_x86_64.whl (7.0 MB view details)

Uploaded CPython 3.7mmusllinux: musl 1.1+ x86-64

traceable_agent-1.3.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (10.2 MB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.17+ x86-64

File details

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

File metadata

  • Download URL: traceable-agent-1.3.0.tar.gz
  • Upload date:
  • Size: 14.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for traceable-agent-1.3.0.tar.gz
Algorithm Hash digest
SHA256 e41d54eb3e21678e0bd9f41ccc85429f3c8f5ab50af333da9c3b88b67a4dca4c
MD5 6dc063685695b0f6ab35baf76d595aeb
BLAKE2b-256 1d2a191d34be74e13b73d1f34edbd64ceab1094ea02b55d5981bd64a9fdc0c80

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-1.3.0-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 4c872489b25d31e4bd88429f3f5530b6a0809ca369e1b01d0b6555165c52e4c3
MD5 e9abbf6d2c7740dbd818d86736fc94f6
BLAKE2b-256 ff78e610fa403c05998cae4d9f2ef0612dc38899000f56a9196f82f6e742463a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-1.3.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5b5945d19cf0039c8f2709158d5789e4083c118115e1b5d6e415aecd947db874
MD5 82c95d424ea041eddec7af83e7061d7e
BLAKE2b-256 600b665063fdb8428d4011ab694225b638babfabe824c0abd2c69142690abcf9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-1.3.0-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 ff9cbf5be688ba2226101b01e5167378fac4c1d0d4341609d3d138c28713a57a
MD5 2e283279d0e2c967d4a22a64579fa172
BLAKE2b-256 107e3e83d5ff7ba2ee6c92d0f48e6529d36648f888727e8cf35a455e789fb410

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-1.3.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1b7706a10a1c9e408eabee76575d902b60228daf951432e776ea2d22654518d0
MD5 93b1e04269bde6185d3700924230fd12
BLAKE2b-256 d8486421b8bffa5bcae4bec0b4a9199a626f9f4f14251bdbf834229c68bd132c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-1.3.0-cp38-cp38-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 489311bb7087122289097dfa5e5905e193679b21773c039be4e9f4b6b1ae3d49
MD5 4837258c19133fa18440524a531e6496
BLAKE2b-256 ce2d99c7df605a5c18a84f2618278aa73ba0ccc64c9d8239e5771f62a51c7d00

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-1.3.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 342cb4a01ebbc6525b15e0d86261f14e87e969c93524299ef4d286e34720633e
MD5 c40b6410d53b99202951df1f2e25791e
BLAKE2b-256 bd644a0007dbdb26be8cee36877e4fa8fcb3ba7498f2c966cc3fae74de3c1a80

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-1.3.0-cp37-cp37m-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 205eb3987767f3251d63a527f8677b85f18dd3cf54fde8e6b4249d873ceb8af4
MD5 2ed218b51512c123f29caf513976f480
BLAKE2b-256 82fb4c8a0c711c830e490be8de2a9b8d5ca25cd85b00838ab619024fae15dec2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-1.3.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ceb4d88927f5eca5000c9892d177f0f019efc5ce562c418aef51dba2bda0814e
MD5 48a395d66ea179c12a5f332c2127908b
BLAKE2b-256 dceb2d738f9531af6cc7e8ba8e584dbcc31471e1b7b703a958588bb4cffb9e5d

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