forgesight-clickhouse
The ClickHouse exporter for ForgeSight. Writes each ForgeSight record as one row in a denormalized single-table MergeTree, batched columnar — so a platform team can query its agent telemetry in SQL: spend by team, p99 LLM latency by model, tokens per workflow over 90 days.
pip install forgesight-clickhouse
import forgesight
from forgesight_clickhouse import ClickHouseExporter
forgesight.configure(exporters=[
ClickHouseExporter(
dsn="clickhouse://user:pass@ch-host:8443/agents?secure=true",
table="forgesight_records",
create_table=True, # dev convenience; production runs the shipped migration
),
])
Or by name: exporters: [{name: clickhouse, config: {dsn: "${FORGESIGHT_CLICKHOUSE_DSN}"}}].
Why a columnar exporter
A Record is written once and never updated (OTel's immutable span model), so trace-level business metadata is denormalized onto every row — no join table, so analytical queries never pay a join:
SELECT agent_name, quantile(0.99)(duration_ms)
FROM forgesight_records WHERE kind = 'llm' GROUP BY agent_name;
SELECT metadata.team, sum(cost_usd)
FROM forgesight_records
WHERE kind = 'llm' AND start_time >= now() - INTERVAL 30 DAY
GROUP BY metadata.team;
Inserts are batched by the SDK's export pipeline (ClickHouse hates row-at-a-time): one
columnar INSERT per batch, on the export worker, fault-isolated. A ClickHouse outage makes
export() return FAILURE (counted, never raised — P6); it never blocks the agent.
Schema & migrations
The DDL ships in the package (migrations/0001_init.sql). create_table=True runs
CREATE TABLE IF NOT EXISTS on first export for dev; production applies the migration
out-of-band. New domain fields arrive as new nullable columns via numbered migrations —
old queries keep working.
Configuration
| Key | Env | Default |
|---|---|---|
dsn |
FORGESIGHT_CLICKHOUSE_DSN |
— (required) |
table |
FORGESIGHT_CLICKHOUSE_TABLE |
forgesight_records |
batch_size |
FORGESIGHT_CLICKHOUSE_BATCH_SIZE |
512 (clamped to the pipeline max) |
async_insert |
FORGESIGHT_CLICKHOUSE_ASYNC_INSERT |
true |
wait_for_async_insert |
FORGESIGHT_CLICKHOUSE_WAIT_ASYNC |
false |
create_table |
FORGESIGHT_CLICKHOUSE_CREATE_TABLE |
false |
Constructor kwargs win over env (FR-12). Prompt/response content is never stored in
the base table; it is gated SDK-wide by capture_content (off by default, P7).
License
Apache-2.0
Metadata
Release files for forgesight-clickhouse 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| forgesight_clickhouse-0.1.1.tar.gz | 10.4 kB | Without provenance | Details for forgesight_clickhouse-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| forgesight_clickhouse-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for forgesight_clickhouse-0.1.1-py3-none-any.whl |
Total release size: 20.0 kB
Release files / forgesight_clickhouse-0.1.1.tar.gz
| Download URL | forgesight_clickhouse-0.1.1.tar.gz |
|---|---|
| Size | 10.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cafc939d8503a82b10ec85887f37e78ff1cd0c13d958f7cd67a0715fbbad5f6a
|
|
BLAKE2b-256 checksum How to use checksums |
e7e7cb795984f3af8760e1f71b5687884543e32006c974cc233643e2781792fe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.15
|
Release files / forgesight_clickhouse-0.1.1-py3-none-any.whl
| Download URL | forgesight_clickhouse-0.1.1-py3-none-any.whl |
|---|---|
| Size | 9.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
58c9d9f5bdb3e0078f361a534bbe78d1d1218517b833c1ade888bdfc53bd2151
|
|
BLAKE2b-256 checksum How to use checksums |
4b3136a8193c0b1abc2918653953634bd5079750889e38eb1e477f5a89e8c9cb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.15
|
Security for forgesight-clickhouse 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.