Metadata-Version: 2.4
Name: trustkit
Version: 0.1.1
Summary: OpenTelemetry + Traceloop initialization helper for Python services
Author: BRANDAD Development GmbH
Keywords: opentelemetry,tracing,otel,traceloop
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: opentelemetry-api>=1.30.0
Requires-Dist: opentelemetry-sdk>=1.30.0
Requires-Dist: opentelemetry-exporter-otlp-proto-http>=1.30.0
Requires-Dist: traceloop-sdk>=0.40.0
Requires-Dist: python-dotenv>=1.0.0
Dynamic: license-file

# trustkit (Python)

OpenTelemetry + Traceloop initialization helper for Python services.

## Installation

```bash
pip install trustkit
```

## Usage

```python
from trustkit import init_otel

init_otel(
    endpoint="https://your-otel-collector.example.com",
    api_key="your-api-key",
    service_name="my-service",
)
```

The `endpoint` is automatically normalized — `/api/otel/traces` is appended if not already present.

If the OTLP endpoint is unreachable, `init_otel(...)` falls back to a no-op exporter and the app continues running without traces.

## Parameters

| Parameter | Type | Description |
|---|---|---|
| `endpoint` | `str` | OTLP HTTP base URL (e.g. `https://collector.example.com`) |
| `api_key` | `str` | Value for the `X-API-Key` header |
| `service_name` | `str` | Service name shown in traces |

## Optional Environment Variables

All of these are optional — sensible defaults are baked in.

| Variable | Default | Description |
|---|---|---|
| `OTEL_SERVICE_VERSION` | `0.0.0-local` | Service version shown in traces |
| `OTEL_DEPLOYMENT_ENVIRONMENT` | `local-workstation` | Deployment environment |
| `OTEL_SERVICE_INSTANCE_ID` | `local-instance` | Instance ID |
| `OTEL_EXPORTER_OTLP_COMPRESSION` | `gzip` | Compression (`gzip` or none) |
| `OTEL_EXPORTER_OTLP_PROTOCOL` | `http/protobuf` | Protocol |

## License

Copyright © BRANDAD Development GmbH. All rights reserved.

This library is licensed under the [PolyForm Shield License 1.0.0](https://polyformproject.org/licenses/shield/1.0.0).
