feat: AI APM module — LLM call telemetry & analytics #1
Reference in New Issue
Block a user
Delete Branch "feat/ai-apm"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
AI APM for Ophion
Extends Ophion with AI/LLM observability. Every AI call from any product (Cute Kiwi, Sentinela, etc.) gets tracked, stored, and analyzed.
New Files
internal/aiapm/types.go— AI call record types + analytics aggregation typesinternal/aiapm/pricing.go— Pricing tables for 25+ models (Anthropic, OpenAI, Google, Mistral, DeepSeek, Groq)internal/aiapm/store.go— PostgreSQL storage (batch inserts, filtered queries, timeseries, aggregations)internal/aiapm/collector.go— Async collector with buffered channel (5000 cap), batch flush every 500ms or 100 recordsinternal/api/aiapm_handlers.go— 7 REST endpoints under/api/v1/ai-apm/Endpoints
POST /api/v1/ai-apm/ingest— receive AI call records (single or batch)GET /api/v1/ai-apm/summary— usage summary (calls, tokens, cost)GET /api/v1/ai-apm/models— per-model breakdownGET /api/v1/ai-apm/vendors— per-vendor breakdownGET /api/v1/ai-apm/costs— cost timeseriesGET /api/v1/ai-apm/calls— recent calls (paginated)GET /api/v1/ai-apm/pricing— current pricing tableModified
cmd/server/main.go— registers AI APM routes, creates table at startupBuild
go build ./...passes clean.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.