pg_agenttrace
alohadb · AlohaDB OTLP trace storage, agent span trees and usage rollups
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 102460 | pg_agenttrace | alohadb | 1.0 | STAT | MIT | SQL |
PostgreSQL · 18
| Relationships | |
|---|---|
| Requires | plpgsql |
Usage
Sources:
pg_agenttrace 1.0 stores OpenTelemetry agent traces, exposes span trees and usage rollups, and can estimate GenAI costs from an administrator-maintained price table.
These are preview modules of AlohaDB 21.2.0, a PostgreSQL 18 fork. Compatibility with stock PostgreSQL is not established.
Enable and Ingest
A superuser installs the SQL/PLpgSQL extension in its fixed agenttrace schema. Direct SQL ingestion requires no preload or restart. The optional HTTP receiver is supplied separately by pg_restapi.
agenttrace_ingest_otlp(jsonb) accepts an OTLP/JSON ExportTraceServiceRequest and returns the number of newly inserted spans; repeated identities are idempotent. agenttrace_ingest_span accepts a 32-hex trace ID and a 16-hex span ID. Invalid identifiers or timestamps fail the call.
Privileges and Retention
PUBLIC access to extension tables and functions is revoked. Administrators use agenttrace_grant_writer and agenttrace_grant_reader for explicit role grants. Ingest functions are SECURITY DEFINER with a pinned search path; those grants authorize database access, not per-tenant isolation. Traces may contain prompts, tool arguments and credentials, so limit writers/readers and redact at the source.
Data is partitioned by UTC day. Automatic creation accepts dates from 31 days in the past through 2 days in the future and creates at most 4 new days per batch. Administrators can precreate a range with agenttrace_ensure_partitions and remove old data with agenttrace_drop_partitions; dropping partitions permanently removes their spans. Late or out-of-range data needs an explicit retention/partition decision.
The price table starts empty: a missing estimate is not zero cost. Graph registration/synchronization and Parquet export are optional integrations and require the matching AlohaDB modules and privileges. Keep database backups; rollups and exported partitions are not a substitute for the original trace corpus.