Metadata-Version: 2.4
Name: logdrop-agent
Version: 0.1.0a1
Summary: LogDrop Python agent: traces Python services without code changes and sends privacy-safe spans to LogDrop.
Author: Initial Code (LogDrop)
License-Expression: LicenseRef-LogDrop-Client-Library-License-1.0
Project-URL: Homepage, https://developer.logdrop.io/docs/backend-tracing
Keywords: logdrop,tracing,apm,opentelemetry
Classifier: Development Status :: 3 - Alpha
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: System :: Monitoring
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
License-File: NOTICE
Requires-Dist: opentelemetry-api==1.45.2
Requires-Dist: opentelemetry-sdk==1.45.2
Requires-Dist: opentelemetry-semantic-conventions==0.66b2
Requires-Dist: opentelemetry-instrumentation==0.66b2
Requires-Dist: opentelemetry-util-http==0.66b2
Requires-Dist: opentelemetry-instrumentation-django==0.66b2
Requires-Dist: opentelemetry-instrumentation-flask==0.66b2
Requires-Dist: opentelemetry-instrumentation-fastapi==0.66b2
Requires-Dist: opentelemetry-instrumentation-wsgi==0.66b2
Requires-Dist: opentelemetry-instrumentation-asgi==0.66b2
Requires-Dist: opentelemetry-instrumentation-requests==0.66b2
Requires-Dist: opentelemetry-instrumentation-httpx==0.66b2
Requires-Dist: opentelemetry-instrumentation-urllib3==0.66b2
Requires-Dist: opentelemetry-instrumentation-urllib==0.66b2
Requires-Dist: opentelemetry-instrumentation-aiohttp-client==0.66b2
Requires-Dist: opentelemetry-instrumentation-psycopg==0.66b2
Requires-Dist: opentelemetry-instrumentation-psycopg2==0.66b2
Requires-Dist: opentelemetry-instrumentation-asyncpg==0.66b2
Requires-Dist: opentelemetry-instrumentation-pymysql==0.66b2
Requires-Dist: opentelemetry-instrumentation-mysqlclient==0.66b2
Requires-Dist: opentelemetry-instrumentation-mysql==0.66b2
Requires-Dist: opentelemetry-instrumentation-pymongo==0.66b2
Requires-Dist: opentelemetry-instrumentation-redis==0.66b2
Requires-Dist: opentelemetry-instrumentation-pika==0.66b2
Requires-Dist: opentelemetry-instrumentation-aio-pika==0.66b2
Requires-Dist: opentelemetry-instrumentation-kafka-python==0.66b2
Requires-Dist: opentelemetry-instrumentation-confluent-kafka==0.66b2
Requires-Dist: opentelemetry-instrumentation-celery==0.66b2
Requires-Dist: opentelemetry-instrumentation-grpc==0.66b2
Requires-Dist: opentelemetry-instrumentation-dbapi==0.66b2
Dynamic: license-file

# logdrop-agent

The LogDrop Python agent traces Python services without code changes and sends privacy-safe spans to
[LogDrop](https://logdrop.io): distributed traces, service and endpoint health (APM) and the dependency map, also across
Java, Node.js and Python services in one trace. It is a distribution of OpenTelemetry Python whose privacy rules are
the same as the LogDrop Java and Node.js agents'.

On Kubernetes you do not need this package: the LogDrop Helm chart adds the agent to pods annotated
`logdrop.io/trace: python`. Use it outside Kubernetes.

## Requirements

- CPython 3.10 or newer. On an older Python the agent prints one line and the service runs untraced.
- A LogDrop project with tracing enabled and a traces ingest key.

## Start a service with the agent

```bash
pip install logdrop-agent
export LOGDROP_ENDPOINT=https://otel.logdrop.io
export LOGDROP_INGEST_KEY_FILE=/etc/logdrop/trace-ingest-key   # a file that holds the traces key
export LOGDROP_SERVICE=orders
export LOGDROP_ENVIRONMENT=production
logdrop-run gunicorn app:app        # or: logdrop-run python app.py, logdrop-run uvicorn main:app
```

The service logs one line when the agent starts:

```text
[logdrop-agent] INFO LogDrop Python agent 0.1.0a1 is tracing service "orders" (environment "production") to otel.logdrop.io.
```

`logdrop-run` puts the agent first on `PYTHONPATH` and replaces itself with your command. Your code does not change.

## What is traced

Django, Flask and FastAPI; outgoing HTTP with requests, httpx, urllib3, urllib and aiohttp; PostgreSQL (psycopg,
psycopg2, asyncpg), MySQL (PyMySQL, mysqlclient, mysql-connector), MongoDB, Redis, RabbitMQ (pika, aio-pika), Kafka
(kafka-python, confluent-kafka), Celery and gRPC. Worker processes of pre-fork servers such as gunicorn are traced.

Never sent: request and response headers, cookies, query strings, SQL values (statements leave only as value-free
templates), Redis keys, message bodies, exception messages and stack traces.

Custom spans: the optional [`logdrop-api`](https://pypi.org/project/logdrop-api/) package.

Documentation: https://developer.logdrop.io/docs/backend-tracing

## Licence

The LogDrop parts are licensed under the LogDrop Client Library License 1.0 (`LICENSE`); the OpenTelemetry packages
it depends on keep their Apache License 2.0 (`NOTICE`).
