Skip to main content

acutracer (Distributed tracer)

A llm flow tracer

The following repo will have the instrumentors for a agentic system.

The instrumentor will trace all the outgoing calls made through a agentic system.

The following headers will be added to the calls.

X-acuvity-trace-id X-acuvity-span-id X-acuvity-parent-id

The headers will be captured by the proxy for further processing.

Running pytest

From the root directory run the following

pytest

Visualization of the traces

All the traces are OTEL compatible, so any OTEL collector can be used to view the traces locally.

Supported Instrumentors for python

  1. Web Frameworks:

    • FastAPIInstrumentor
    • FlaskInstrumentor
    • DjangoInstrumentor
  2. HTTP Clients:

    • RequestsInstrumentor
    • URLLibInstrumentor
    • AioHTTPClientInstrumentor

Future work for Granular Instrumentors in python

  1. Databases:

    • MongoInstrumentor
  2. gRPC:

    • GRPCInstrumentor
  3. AWS:

    • BotoInstrumentor
  4. Logging:

    • LoggingInstrumentor

Jaeger example with FAST API instrumentor:

Setting up the app:

1st pip install the acutracer

pip install acutracer

Import the following lines.

from acutracer.instrumentors.python.webapi.instrumentor import (
    WebAPIInstrumentor,
)

app = FastAPI(title="Fast-API")

instrumentor = WebAPIInstrumentor(name="acuvity-tracing-example")
tracer = instrumentor.instrument(app=app)

Setting Up and Using Jaeger UI (for macOS)

Starting Jaeger

Run the following command to start the Jaeger all-in-one Docker container:

docker run -d --name jaeger \
  -e COLLECTOR_ZIPKIN_HOST_PORT=:9411 \
  -e COLLECTOR_OTLP_ENABLED=true \
  -p 6831:6831/udp \
  -p 6832:6832/udp \
  -p 5778:5778 \
  -p 16686:16686 \
  -p 14317:4317 \
  -p 4318:4318 \
  -p 14250:14250 \
  -p 14268:14268 \
  -p 14269:14269 \
  -p 9411:9411 \
  jaegertracing/all-in-one:latest

Note: We've changed -p 4317:4317 to -p 14317:4317. This maps the container's internal port 4317 to the host's port 14317.

Accessing the Jaeger UI

Once the container is running, you can access the Jaeger UI by opening a web browser and navigating to:

http://localhost:16686

Viewing Traces

  1. Start your instrumented Python application.
  2. Make some requests to your application to generate traces.
  3. Open the Jaeger UI in your web browser.
  4. In the UI:
    • Select your service from the "Service" dropdown (it should be named after your Python application).
    • Set an appropriate time range.
    • Click "Find Traces" to view your traces.

Troubleshooting

If you don't see any traces:

  1. Check that your application is running and generating traffic.
  2. Ensure that the Jaeger agent port (6831) is accessible from your application.
  3. Verify that the exporter in your Python code is correctly configured to send traces to localhost:6831.
  4. Check the console output of your Python application for any error messages related to trace export.

Remember to stop the Jaeger container when you're done:

docker stop jaeger
docker rm jaeger

Metadata

Release files for acutracer 0.1.29

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for acutracer 0.1.29
File Size Uploaded
acutracer-0.1.29.tar.gz 19.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for acutracer 0.1.29
File Interpreter ABI Platform
acutracer-0.1.29-py3-none-any.whl Python 3 none any Details

Total release size: 40.6 kB

Release files / acutracer-0.1.29.tar.gz

Download URL acutracer-0.1.29.tar.gz
Size 19.8 kB
Tags Source
SHA-256 checksum
How to use checksums
3247f19033994db1fc3e831c74c5c2811c32d409cced1ea731cc488c2bb2cb2f
BLAKE2b-256 checksum
How to use checksums
3d6971f755b6635ca6cc8719e956c608ec16aab30cf27fff335d170d317826c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.9

Release files / acutracer-0.1.29-py3-none-any.whl

Download URL acutracer-0.1.29-py3-none-any.whl
Size 20.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
067ee6be4bb9ab4ed565581bd50310c68fa230e9a89997a49220202f9b8d07cb
BLAKE2b-256 checksum
How to use checksums
f08157aa3995a0dc8c6e1ac76362d154a43b49373588a34f32b99a5b4a630765
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.9
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page