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

File metadata

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

File hashes

Hashes for traceable-agent-1.2.2.tar.gz
Algorithm Hash digest
SHA256 f841dd125e41b81030e9d35f2c0efc14b17b3b31bbce7ea7c8732cbae03fd5a1
MD5 8e5bbde7d307ea8594ebb84d6a2d1ab1
BLAKE2b-256 74eb728fa2143ca6362ac7ff59f7aba9c41a003584d94493f9deaa12f6dbe63d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-1.2.2-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 00f3f3460fafae722b5e5da5767d984d5565c821ff72a575e003b352716e7fff
MD5 ed5eb0312033ab1832a6ce109fe001b5
BLAKE2b-256 4b01b061602c75dc314a8206de5eddad787eb5b89b440389a84fa68b490203df

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-1.2.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f8cc9fa1871c09003ab293634b45562dded239fe6c643e5f2d42834687ea89fa
MD5 e9121257ba03ebdd8dc0db9fcf09578a
BLAKE2b-256 93ae2dd2fa8f7a6f61129512e4ef59e3ad3b667305ec6308ebb6e8cf7bd16cc2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-1.2.2-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 91c11de1fe1a0871b18d86e0c285ad93e9ebdd2955d36b8f5cad0af68b785c30
MD5 a466a1c4982b2beb6386b26e8f113ac7
BLAKE2b-256 4da23821140029d4e57223d3b355c8ea046abaaf7f63e05206c347025d76115d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-1.2.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4df2b208b2ca5015bf8782aaf36719a4d0bc1cf16ac8ce0e5ba3a00ae97b1ffb
MD5 1f0c5d1af0a42b2ce5175b7ed47dadd2
BLAKE2b-256 66a4f415b5ccc1e1a48c7f8ad7ab8134308d4643b6130638775dd17bb4ca5525

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-1.2.2-cp38-cp38-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 efdbd7e7b538a5976d8cf0ec3a774c67782f8bf94d655b57064507482402f999
MD5 228d2f5c59152a89dab6353d2499ce19
BLAKE2b-256 e6ae97162b2b9e1506c7477b478e3bb2c8e1a5a30205ce731946a1e4b35d6992

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-1.2.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e01cf5b2efbb6a8035b86fcc6ea3fb854a6ec1a0f3d96eb4c2ca75bf85e13ce4
MD5 88d45294e5cf776aa7e0139ec20c238b
BLAKE2b-256 be8f917eb6ca44eced419c8a19bcc4178ff76207961451370819a3162d84eb85

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-1.2.2-cp37-cp37m-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 8d3c816a930c6ece3fd9aaac0b45e3a1ea954c47be9d1ebf84b4cb02343c0a82
MD5 a3398557e6241932262cebe737bb0a08
BLAKE2b-256 9116bb2721b94a6a33d4949bf2d0fc253b7753a82529f1a529308b09f13b62b3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-1.2.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 31e52aa32ab49166d375e771fc65aea59ed9687e86b7aab3f84689f3e088b81f
MD5 85cbe5ebdcec0efc9d807a1648b50608
BLAKE2b-256 574e01729fa721451727fcf81b37f9801d0bd9b238f8d073e8003eb2f2272082

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-1.2.2-cp36-cp36m-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 b721d02c66f0fe3a587ad9c1956be7c5cc5365de6f7965af802945875c5006c7
MD5 bf1ea1cfd1629a38bb4fba546742d209
BLAKE2b-256 65b2912337da40eaf3dc60b802d336086d3068ef6fd96eb1160afd53d5f40668

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for traceable_agent-1.2.2-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4c1972ba23fb0acc2d8ec20fe2857e2e72a67d1335d51953a724435f912fb88d
MD5 ccb2997bbeff34ce9167466fc80f4994
BLAKE2b-256 d1cf12604c5efc6f4f22976b982e0cd7f68285572531dcce2bb52a24da387817

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