Metadata-Version: 2.4
Name: logdrop-api
Version: 0.1.0a1
Summary: Optional custom spans, flush, export status and key update for Python services traced by the LogDrop agent. No dependencies; records nothing without the agent.
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.8
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# logdrop-api

Optional custom spans, flush, export status and key update for Python services traced by the
[LogDrop Python agent](https://pypi.org/project/logdrop-agent/). No dependencies. Without the agent every call is safe
and records nothing.

```bash
pip install logdrop-api
```

```python
from logdrop_api import LogDrop

tracing = LogDrop.tracing()

with tracing.span("checkout.price") as span:
    span.attribute("order.type", "delivery")   # custom keys need LOGDROP_ALLOWED_ATTRIBUTE_KEYS=order.type
    total = pricing.total(order)               # spans started here, also after an await, are its children

@tracing.traced("checkout.validate")           # functions and coroutine functions
async def validate(order): ...
```

- An exception raised in a span records its type only, never its message or traceback, and is passed on.
- Custom attributes are sent only for keys listed in `LOGDROP_ALLOWED_ATTRIBUTE_KEYS`; keys that can carry secrets
  (`token`, `password`, `authorization` and others) are always dropped.
- `LogDrop.flush(seconds)` sends the spans that ended before the call, for example before a batch job exits.
- `LogDrop.export_status()`, `LogDrop.update_ingest_credential(key)` and `LogDrop.is_agent_attached()` are available too.

Python 3.8 or newer. Documentation: https://developer.logdrop.io/docs/backend-tracing

## Licence

LogDrop Client Library License 1.0 (`LICENSE`).
