UNPKG

traceprompt-node

Version:

Client-side encrypted, audit-ready logging for LLM applications

30 lines (24 loc) 876 B
import { Registry, Histogram, Counter, Gauge } from "prom-client"; export const registry = new Registry(); export const encryptHist = new Histogram({ name: "traceprompt_encrypt_ms", help: "Latency of client-side AES-GCM envelope encryption (ms)", buckets: [0.05, 0.1, 0.25, 0.5, 1, 2, 5], registers: [registry], }); export const tokenCountHist = new Histogram({ name: "traceprompt_token_count", help: "Tokens counted per prompt/response", buckets: [1, 5, 10, 20, 50, 100, 200, 500, 1000], registers: [registry], }); export const flushFailures = new Counter({ name: "traceprompt_flush_failures_total", help: "Number of failed POSTs to the Traceprompt ingest API", registers: [registry], }); export const queueGauge = new Gauge({ name: "traceprompt_queue_depth", help: "Number of events currently buffered in memory", registers: [registry], });