@autter/otlp-ingester 1.0.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/types.d.ts CHANGED
@@ -62,6 +62,39 @@ export interface RuntimeSpanRow {
62
62
  attributes: Record<string, unknown> | null;
63
63
  startedAt: Date;
64
64
  }
65
+ /**
66
+ * One LLM provider call (chat, completion, embedding, …) extracted from a
67
+ * span carrying GenAI/Vercel-AI/Autter attributes — see llm.ts. Stored per
68
+ * call, not rolled up: LLM traffic is orders of magnitude smaller than
69
+ * HTTP, and spend analysis needs every call. Tokens and cost are resolved
70
+ * at ingest so usage/spend queries are plain aggregates.
71
+ */
72
+ export interface RuntimeLlmCall {
73
+ service: string;
74
+ environment: string;
75
+ release: string | null;
76
+ traceId: string;
77
+ spanId: string;
78
+ /** gen_ai.provider.name / gen_ai.system / ai.model.provider — "openai", … */
79
+ provider: string;
80
+ model: string;
81
+ /** gen_ai.operation.name — "chat", "embeddings", "generateText", … */
82
+ operation: string;
83
+ inputTokens: number;
84
+ outputTokens: number;
85
+ costUsd: number;
86
+ /** reported = SDK sent the exact cost; estimated = built-in pricing table. */
87
+ costSource: "reported" | "estimated" | "none";
88
+ durationMs: number;
89
+ status: "ok" | "error";
90
+ /** Provider exception type for failed calls ("RateLimitError", …); "" when ok. */
91
+ errorType: string;
92
+ /** Opaque end-user id for per-user usage/cost attribution. */
93
+ userId: string;
94
+ sessionId: string;
95
+ attributes: Record<string, string> | null;
96
+ startedAt: Date;
97
+ }
65
98
  /** One 60-second usage rollup bucket. */
66
99
  export interface RuntimeMetricPoint {
67
100
  service: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autter/otlp-ingester",
3
- "version": "1.0.0",
3
+ "version": "1.2.0",
4
4
  "description": "Self-hostable OTLP + browser-error ingest service for Autter Runtime: normalises telemetry into a per-repo ClickHouse data model",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -14,7 +14,8 @@
14
14
  "scripts": {
15
15
  "dev": "tsx watch src/index.ts",
16
16
  "start": "node dist/index.js",
17
- "build": "tsc -p tsconfig.json"
17
+ "build": "tsc -p tsconfig.json",
18
+ "test": "tsx --test src/*.test.ts"
18
19
  },
19
20
  "dependencies": {
20
21
  "@clickhouse/client": "^1.12.0",