@autter/otlp-ingester 0.1.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/Dockerfile +18 -0
- package/README.md +114 -0
- package/dist/auth.d.ts +18 -0
- package/dist/auth.js +103 -0
- package/dist/clickhouse.d.ts +27 -0
- package/dist/clickhouse.js +261 -0
- package/dist/config.d.ts +35 -0
- package/dist/config.js +51 -0
- package/dist/fingerprint.d.ts +19 -0
- package/dist/fingerprint.js +80 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +26 -0
- package/dist/migrations.d.ts +42 -0
- package/dist/migrations.js +88 -0
- package/dist/normalize-browser.d.ts +103 -0
- package/dist/normalize-browser.js +113 -0
- package/dist/normalize-otlp.d.ts +84 -0
- package/dist/normalize-otlp.js +258 -0
- package/dist/otlp-proto.d.ts +3 -0
- package/dist/otlp-proto.js +107 -0
- package/dist/server.d.ts +8 -0
- package/dist/server.js +267 -0
- package/dist/types.d.ts +92 -0
- package/dist/types.js +11 -0
- package/package.json +53 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
export type RuntimeSource = "browser" | "server";
|
|
2
|
+
/**
|
|
3
|
+
* Signal severity. Errors AND warnings/info land in the same occurrences
|
|
4
|
+
* table (severity is a column, not a separate pipeline) so later
|
|
5
|
+
* aggregations can slice one dataset by severity, fingerprint, route, etc.
|
|
6
|
+
* Severity is intentionally NOT part of the fingerprint — the same defect
|
|
7
|
+
* reported once as a warning and once as an error groups together.
|
|
8
|
+
*/
|
|
9
|
+
export type RuntimeSeverity = "fatal" | "error" | "warning" | "info";
|
|
10
|
+
export declare const RUNTIME_SEVERITIES: readonly string[];
|
|
11
|
+
export declare function asSeverity(value: unknown, fallback: RuntimeSeverity): RuntimeSeverity;
|
|
12
|
+
/** A normalised error/warning event, before fingerprinting. */
|
|
13
|
+
export interface RuntimeOccurrenceInput {
|
|
14
|
+
source: RuntimeSource;
|
|
15
|
+
severity: RuntimeSeverity;
|
|
16
|
+
service: string;
|
|
17
|
+
environment: string;
|
|
18
|
+
release: string | null;
|
|
19
|
+
errorType: string;
|
|
20
|
+
message: string;
|
|
21
|
+
stack: string | null;
|
|
22
|
+
/** Path only — never a full URL with query params. */
|
|
23
|
+
route: string | null;
|
|
24
|
+
/** HTTP request method for server signals (GET, POST, …), if known. */
|
|
25
|
+
method: string | null;
|
|
26
|
+
statusCode: number | null;
|
|
27
|
+
traceId: string | null;
|
|
28
|
+
sessionId: string | null;
|
|
29
|
+
attributes: Record<string, unknown> | null;
|
|
30
|
+
occurredAt: Date;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Derived, aggregation-ready fields — computed once at ingest (from the
|
|
34
|
+
* same normalisers the fingerprint uses) and stored as their own columns
|
|
35
|
+
* so later aggregations never have to re-parse stacks or routes in SQL.
|
|
36
|
+
*/
|
|
37
|
+
export interface RuntimeOccurrence extends RuntimeOccurrenceInput {
|
|
38
|
+
occurrenceId: string;
|
|
39
|
+
fingerprint: string;
|
|
40
|
+
/** normalizeRoute(route) — "/users/:id/orders/:id"; GROUP BY-safe. */
|
|
41
|
+
routeNormalized: string;
|
|
42
|
+
/** normalizeMessage(message) — ids/numbers/strings templated out. */
|
|
43
|
+
messageNormalized: string;
|
|
44
|
+
/** Top normalised stack frames (≤5) — the "points" of the error. */
|
|
45
|
+
topFrames: string[];
|
|
46
|
+
/** topFrames[0] — single-column GROUP BY for "where did this come from". */
|
|
47
|
+
firstFrame: string;
|
|
48
|
+
}
|
|
49
|
+
export interface RuntimeSpanRow {
|
|
50
|
+
service: string;
|
|
51
|
+
environment: string;
|
|
52
|
+
release: string | null;
|
|
53
|
+
traceId: string;
|
|
54
|
+
spanId: string;
|
|
55
|
+
parentSpanId: string | null;
|
|
56
|
+
name: string;
|
|
57
|
+
kind: string;
|
|
58
|
+
status: "ok" | "error";
|
|
59
|
+
route: string | null;
|
|
60
|
+
statusCode: number | null;
|
|
61
|
+
durationMs: number;
|
|
62
|
+
attributes: Record<string, unknown> | null;
|
|
63
|
+
startedAt: Date;
|
|
64
|
+
}
|
|
65
|
+
/** One 60-second usage rollup bucket. */
|
|
66
|
+
export interface RuntimeMetricPoint {
|
|
67
|
+
service: string;
|
|
68
|
+
environment: string;
|
|
69
|
+
release: string | null;
|
|
70
|
+
route: string;
|
|
71
|
+
bucketAt: Date;
|
|
72
|
+
requestCount: number;
|
|
73
|
+
errorCount: number;
|
|
74
|
+
durationSumMs: number;
|
|
75
|
+
sessionCount: number;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* The tenant a validated ingest key resolves to.
|
|
79
|
+
*
|
|
80
|
+
* Key scopes:
|
|
81
|
+
* - `server` — secret key for backends: all endpoints (OTLP + browser relay).
|
|
82
|
+
* - `client` — PUBLISHABLE key shipped in frontend bundles: `/v1/browser`
|
|
83
|
+
* only, origin allow-list enforced, stricter rate limit. Leaking it can
|
|
84
|
+
* at worst send fake browser errors for one repo — never read anything.
|
|
85
|
+
*/
|
|
86
|
+
export interface IngestContext {
|
|
87
|
+
orgId: string;
|
|
88
|
+
repositoryId: string;
|
|
89
|
+
scope: "client" | "server";
|
|
90
|
+
/** client keys only: exact origins allowed to send (empty = any). */
|
|
91
|
+
allowedOrigins: string[];
|
|
92
|
+
}
|
package/dist/types.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@autter/otlp-ingester",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Self-hostable OTLP + browser-error ingest service for Autter Runtime: normalises telemetry into a per-repo ClickHouse data model",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "dist/index.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/Autter-dev/autter-runtime.git",
|
|
12
|
+
"directory": "packages/otlp-ingester"
|
|
13
|
+
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"dev": "tsx watch src/index.ts",
|
|
16
|
+
"start": "node dist/index.js",
|
|
17
|
+
"build": "tsc -p tsconfig.json"
|
|
18
|
+
},
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"@clickhouse/client": "^1.12.0",
|
|
21
|
+
"express": "^4.21.2",
|
|
22
|
+
"protobufjs": "^7.6.5",
|
|
23
|
+
"zod": "^3.24.1"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@opentelemetry/exporter-trace-otlp-proto": "^0.57.1",
|
|
27
|
+
"@types/express": "^4.17.21",
|
|
28
|
+
"@types/node": "^22.10.0",
|
|
29
|
+
"tsx": "^4.19.0",
|
|
30
|
+
"typescript": "^5.7.0"
|
|
31
|
+
},
|
|
32
|
+
"engines": {
|
|
33
|
+
"node": ">=20"
|
|
34
|
+
},
|
|
35
|
+
"publishConfig": {
|
|
36
|
+
"access": "public",
|
|
37
|
+
"provenance": true
|
|
38
|
+
},
|
|
39
|
+
"homepage": "https://github.com/Autter-dev/autter-runtime#readme",
|
|
40
|
+
"bugs": "https://github.com/Autter-dev/autter-runtime/issues",
|
|
41
|
+
"keywords": [
|
|
42
|
+
"opentelemetry",
|
|
43
|
+
"otlp",
|
|
44
|
+
"clickhouse",
|
|
45
|
+
"telemetry",
|
|
46
|
+
"ingest",
|
|
47
|
+
"error-tracking"
|
|
48
|
+
],
|
|
49
|
+
"files": [
|
|
50
|
+
"dist",
|
|
51
|
+
"Dockerfile"
|
|
52
|
+
]
|
|
53
|
+
}
|