Get run-level cost attribution working in minutes.
- Python 3.9+
- OpenTelemetry Collector (see Collector Configuration)
pip install "botanu[all]"from botanu import enable
enable(service_name="my-service")from botanu import botanu_use_case
@botanu_use_case(name="my_workflow")
def my_function():
data = db.query(...)
result = llm.complete(...)
return resultAll LLM calls, database queries, and HTTP requests inside the function are automatically tracked with the same run_id.
from botanu import enable, botanu_use_case
enable(service_name="my-service")
@botanu_use_case(name="my_workflow")
def my_function():
data = db.query(...)
result = openai.chat.completions.create(
model="gpt-4",
messages=[{"role": "user", "content": data}]
)
return result| Attribute | Example | Description |
|---|---|---|
botanu.run_id |
019abc12-... |
Unique run identifier |
botanu.use_case |
my_workflow |
Business use case |
gen_ai.usage.input_tokens |
150 |
LLM input tokens |
gen_ai.usage.output_tokens |
200 |
LLM output tokens |
db.system |
postgresql |
Database system |
All spans share the same run_id, enabling cost-per-transaction analytics.
- Configuration - Environment variables and YAML config
- Kubernetes Deployment - Zero-code instrumentation at scale
- Context Propagation - Cross-service tracing