@happyvertical/smrt-analytics 0.60.18 → 0.61.1
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/AGENTS.md +8 -0
- package/README.md +8 -0
- package/agents/observability.md +72 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/manifest.json +1 -1
- package/dist/observability.d.ts +240 -0
- package/dist/observability.d.ts.map +1 -0
- package/dist/observability.js +420 -0
- package/dist/observability.js.map +1 -0
- package/dist/smrt-knowledge.json +13 -6
- package/dist/smrt-knowledge.okf.md +7 -2
- package/package.json +13 -9
package/dist/manifest.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"version": "1.0.0",
|
|
3
3
|
"timestamp": 0,
|
|
4
4
|
"packageName": "@happyvertical/smrt-analytics",
|
|
5
|
-
"packageVersion": "0.
|
|
5
|
+
"packageVersion": "0.61.1",
|
|
6
6
|
"objects": {
|
|
7
7
|
"@happyvertical/smrt-analytics:AnalyticsDataStreamCollection": {
|
|
8
8
|
"name": "analyticsdatastreamcollection",
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read-only OpenObserve reader for the `default/project_observability` stream
|
|
3
|
+
* (happyvertical/smrt#4908).
|
|
4
|
+
*
|
|
5
|
+
* SERVER-ONLY. This entry point (`@happyvertical/smrt-analytics/observability`)
|
|
6
|
+
* is deliberately not re-exported from the package root or `./browser`, and it
|
|
7
|
+
* refuses to run in a browser. The credential is resolved at call time and sent
|
|
8
|
+
* only in the `Authorization` header of the search request; it is never stored,
|
|
9
|
+
* logged, or placed in an error message.
|
|
10
|
+
*
|
|
11
|
+
* Stream shape. The iac collector (`project-observability/runtime.py`,
|
|
12
|
+
* `collect()`) writes LONG-FORMAT rows every 10 minutes: one row per
|
|
13
|
+
* (project, source, entity) per poll. Every row carries `project`, `source`
|
|
14
|
+
* (`matomo`, `glitchtip`, `bifrost`, `workloads`, `deployments`, `ci`, plus the
|
|
15
|
+
* opt-in `codex`/`claude` configuration rows, which this reader ignores),
|
|
16
|
+
* `entity`, `record_kind` (`snapshot`), `status` (`connected`, `not_connected`,
|
|
17
|
+
* `error`), `_timestamp`, `observed_at` and `last_success_at` (microseconds),
|
|
18
|
+
* plus source-specific fields:
|
|
19
|
+
*
|
|
20
|
+
* | source | fields |
|
|
21
|
+
* | ----------- | -------------------------------------------------------------------- |
|
|
22
|
+
* | matomo | period, visitors, visits, actions |
|
|
23
|
+
* | glitchtip | period, window_start, window_end, error_events, error_events_current_hour |
|
|
24
|
+
* | bifrost | context, period, requests, input_tokens, output_tokens, total_tokens, estimated_cost_usd (gateway estimate, USD), budget_usd, budget_used_usd, budget_reset, cost_kind |
|
|
25
|
+
* | workloads | namespace, desired/ready/updated_replicas, images (deployment rows); cpu_cores, memory_bytes, measured_at (pod rows) |
|
|
26
|
+
* | deployments | ready, revision, transition_at |
|
|
27
|
+
* | ci | workflow, run_status, conclusion, revision, run_updated_at |
|
|
28
|
+
*
|
|
29
|
+
* A source with no data or a failed poll is a single row with entity
|
|
30
|
+
* `connection` and status `not_connected` or `error`. Fields the collector does
|
|
31
|
+
* not write (a dashboard URL, integer-minor-unit cost) are not invented: AI cost
|
|
32
|
+
* is the collector's USD estimate, and metrics absent from a row are `null`.
|
|
33
|
+
*
|
|
34
|
+
* @packageDocumentation
|
|
35
|
+
*/
|
|
36
|
+
export declare const PROJECT_OBSERVABILITY_SOURCES: readonly ["matomo", "glitchtip", "bifrost", "workloads", "deployments", "ci"];
|
|
37
|
+
export type ProjectObservabilitySource = (typeof PROJECT_OBSERVABILITY_SOURCES)[number];
|
|
38
|
+
/** Collector connection state of a row. */
|
|
39
|
+
export type ProjectObservabilityStatus = 'connected' | 'not_connected' | 'error' | (string & {});
|
|
40
|
+
interface RecordBase {
|
|
41
|
+
project: string;
|
|
42
|
+
entity: string;
|
|
43
|
+
status: ProjectObservabilityStatus;
|
|
44
|
+
/** Poll time (`observed_at`), microseconds since epoch. */
|
|
45
|
+
observedAtMicros: number;
|
|
46
|
+
/** Poll time, ISO 8601 UTC. */
|
|
47
|
+
observedAt: string;
|
|
48
|
+
lastSuccessAtMicros: number | null;
|
|
49
|
+
}
|
|
50
|
+
export interface MatomoRecord extends RecordBase {
|
|
51
|
+
source: 'matomo';
|
|
52
|
+
period: string | null;
|
|
53
|
+
visitors: number | null;
|
|
54
|
+
visits: number | null;
|
|
55
|
+
actions: number | null;
|
|
56
|
+
}
|
|
57
|
+
export interface GlitchtipRecord extends RecordBase {
|
|
58
|
+
source: 'glitchtip';
|
|
59
|
+
period: string | null;
|
|
60
|
+
windowStart: string | null;
|
|
61
|
+
windowEnd: string | null;
|
|
62
|
+
errorEvents: number | null;
|
|
63
|
+
errorEventsCurrentHour: number | null;
|
|
64
|
+
}
|
|
65
|
+
export interface BifrostRecord extends RecordBase {
|
|
66
|
+
source: 'bifrost';
|
|
67
|
+
context: string | null;
|
|
68
|
+
period: string | null;
|
|
69
|
+
requests: number | null;
|
|
70
|
+
inputTokens: number | null;
|
|
71
|
+
outputTokens: number | null;
|
|
72
|
+
totalTokens: number | null;
|
|
73
|
+
/** Gateway estimate in USD (decimal), never an invoice. */
|
|
74
|
+
estimatedCostUsd: number | null;
|
|
75
|
+
budgetUsd: number | null;
|
|
76
|
+
budgetUsedUsd: number | null;
|
|
77
|
+
budgetReset: string | null;
|
|
78
|
+
costKind: string | null;
|
|
79
|
+
}
|
|
80
|
+
export interface WorkloadsRecord extends RecordBase {
|
|
81
|
+
source: 'workloads';
|
|
82
|
+
namespace: string | null;
|
|
83
|
+
desiredReplicas: number | null;
|
|
84
|
+
readyReplicas: number | null;
|
|
85
|
+
updatedReplicas: number | null;
|
|
86
|
+
images: string | null;
|
|
87
|
+
cpuCores: number | null;
|
|
88
|
+
memoryBytes: number | null;
|
|
89
|
+
measuredAt: string | null;
|
|
90
|
+
}
|
|
91
|
+
export interface DeploymentsRecord extends RecordBase {
|
|
92
|
+
source: 'deployments';
|
|
93
|
+
/** Flux Ready condition status: `True`, `False`, `Unknown`. */
|
|
94
|
+
ready: string | null;
|
|
95
|
+
revision: string | null;
|
|
96
|
+
transitionAt: string | null;
|
|
97
|
+
}
|
|
98
|
+
export interface CiRecord extends RecordBase {
|
|
99
|
+
source: 'ci';
|
|
100
|
+
workflow: string | null;
|
|
101
|
+
runStatus: string | null;
|
|
102
|
+
/** GitHub conclusion, or `pending`. */
|
|
103
|
+
conclusion: string | null;
|
|
104
|
+
revision: string | null;
|
|
105
|
+
runUpdatedAt: string | null;
|
|
106
|
+
}
|
|
107
|
+
/** One typed collector row, discriminated by `source`. */
|
|
108
|
+
export type ProjectObservabilityRecord = MatomoRecord | GlitchtipRecord | BifrostRecord | WorkloadsRecord | DeploymentsRecord | CiRecord;
|
|
109
|
+
export interface ProjectSourceState {
|
|
110
|
+
status: ProjectObservabilityStatus;
|
|
111
|
+
observedAtMicros: number;
|
|
112
|
+
lastSuccessAtMicros: number | null;
|
|
113
|
+
}
|
|
114
|
+
/** Per-project totals over the latest poll. `null` means no data, never 0. */
|
|
115
|
+
export interface ProjectObservabilitySummary {
|
|
116
|
+
/** Matomo unique visitors today, summed over sites. */
|
|
117
|
+
visitors: number | null;
|
|
118
|
+
/** GlitchTip error events, last 24 complete UTC hours. */
|
|
119
|
+
errorEvents: number | null;
|
|
120
|
+
/** Bifrost rolling-24h total tokens over the project's keys. */
|
|
121
|
+
aiTotalTokens: number | null;
|
|
122
|
+
/** Bifrost rolling-24h estimated cost in USD. */
|
|
123
|
+
aiEstimatedCostUsd: number | null;
|
|
124
|
+
/** Sum of desired / ready replicas over deployment rows. */
|
|
125
|
+
workloadsDesired: number | null;
|
|
126
|
+
workloadsReady: number | null;
|
|
127
|
+
/** Flux kustomizations Ready=True / total. */
|
|
128
|
+
deploymentsReady: number | null;
|
|
129
|
+
deploymentsTotal: number | null;
|
|
130
|
+
/** Latest CI conclusion per repository (entity = `owner/repo`). */
|
|
131
|
+
latestCi: {
|
|
132
|
+
repository: string;
|
|
133
|
+
conclusion: string | null;
|
|
134
|
+
}[];
|
|
135
|
+
}
|
|
136
|
+
/** Latest records for one project folded into a snapshot. */
|
|
137
|
+
export interface ProjectObservabilitySnapshot {
|
|
138
|
+
projectId: string;
|
|
139
|
+
/** Newest poll across sources. */
|
|
140
|
+
observedAtMicros: number;
|
|
141
|
+
observedAt: string;
|
|
142
|
+
sources: Partial<Record<ProjectObservabilitySource, ProjectSourceState>>;
|
|
143
|
+
/** Latest data rows per source (connection rows excluded). */
|
|
144
|
+
records: {
|
|
145
|
+
[S in ProjectObservabilitySource]: Extract<ProjectObservabilityRecord, {
|
|
146
|
+
source: S;
|
|
147
|
+
}>[];
|
|
148
|
+
};
|
|
149
|
+
summary: ProjectObservabilitySummary;
|
|
150
|
+
}
|
|
151
|
+
/** Credential scheme for the `Authorization` header. */
|
|
152
|
+
export type ObservabilityAuthScheme = 'Basic' | 'Bearer';
|
|
153
|
+
type MaybeAsync<T> = T | Promise<T>;
|
|
154
|
+
/** Structural subset of `SecretService` so callers can pass one directly. */
|
|
155
|
+
export interface ObservabilitySecretSource {
|
|
156
|
+
retrieve(name: string): Promise<{
|
|
157
|
+
value: string;
|
|
158
|
+
}>;
|
|
159
|
+
}
|
|
160
|
+
export interface OpenObserveStreamReaderOptions {
|
|
161
|
+
/** Base URL, e.g. `https://openobserve.example.com`. Resolved per call. */
|
|
162
|
+
endpoint: string | (() => MaybeAsync<string>);
|
|
163
|
+
/**
|
|
164
|
+
* Returns the read-only credential (the pre-encoded Basic token, or a bearer
|
|
165
|
+
* token). Resolved per call; see {@link credentialFromSecret}.
|
|
166
|
+
*/
|
|
167
|
+
credential: () => MaybeAsync<string>;
|
|
168
|
+
authScheme?: ObservabilityAuthScheme;
|
|
169
|
+
/** OpenObserve organization. Default `default`. */
|
|
170
|
+
org?: string;
|
|
171
|
+
/** Stream name. Default `project_observability`. */
|
|
172
|
+
stream?: string;
|
|
173
|
+
/** Injected fetch (tests). Default global `fetch`. */
|
|
174
|
+
fetch?: typeof fetch;
|
|
175
|
+
/** Per-request timeout in ms. Default 10000. */
|
|
176
|
+
timeoutMs?: number;
|
|
177
|
+
/**
|
|
178
|
+
* Max rows per query. Exceeding it throws rather than silently truncating.
|
|
179
|
+
* Default 5000.
|
|
180
|
+
*/
|
|
181
|
+
maxRows?: number;
|
|
182
|
+
/** Clock override for window defaults (tests). */
|
|
183
|
+
now?: () => Date;
|
|
184
|
+
}
|
|
185
|
+
export interface ProjectObservabilityQuery {
|
|
186
|
+
/** Window start (inclusive). Default: `end` minus 24h. */
|
|
187
|
+
start?: Date;
|
|
188
|
+
/** Window end. Default: now. */
|
|
189
|
+
end?: Date;
|
|
190
|
+
/** Restrict to these project ids. */
|
|
191
|
+
projectIds?: readonly string[];
|
|
192
|
+
}
|
|
193
|
+
/** Error raised by the reader. The message never contains the credential. */
|
|
194
|
+
export declare class OpenObserveReadError extends Error {
|
|
195
|
+
readonly status?: number;
|
|
196
|
+
constructor(message: string, status?: number);
|
|
197
|
+
}
|
|
198
|
+
/** Build a `credential` resolver from a secrets store entry (e.g. `SecretService`). */
|
|
199
|
+
export declare function credentialFromSecret(source: ObservabilitySecretSource, secretName: string): () => Promise<string>;
|
|
200
|
+
/**
|
|
201
|
+
* Normalize one raw stream hit into a typed record. Returns null for rows that
|
|
202
|
+
* are not collector snapshots of a known source (e.g. `codex`/`claude`
|
|
203
|
+
* configuration rows) or lack a project, entity, or timestamp.
|
|
204
|
+
*/
|
|
205
|
+
export declare function parseProjectObservabilityRecord(raw: unknown): ProjectObservabilityRecord | null;
|
|
206
|
+
/**
|
|
207
|
+
* Fold records into per-project snapshots. Groups by (project, source, entity)
|
|
208
|
+
* keeping the newest row, then keeps only entities seen in each source's latest
|
|
209
|
+
* poll so entities the collector stopped reporting do not linger.
|
|
210
|
+
*/
|
|
211
|
+
export declare function foldProjectSnapshots(records: readonly ProjectObservabilityRecord[]): ProjectObservabilitySnapshot[];
|
|
212
|
+
/** Read-only client for the per-project observability stream. */
|
|
213
|
+
export declare class OpenObserveStreamReader {
|
|
214
|
+
private readonly options;
|
|
215
|
+
private readonly org;
|
|
216
|
+
private readonly stream;
|
|
217
|
+
constructor(options: OpenObserveStreamReaderOptions);
|
|
218
|
+
/** Every collector snapshot row in the window, newest poll first. */
|
|
219
|
+
queryWindow(query?: ProjectObservabilityQuery): Promise<ProjectObservabilityRecord[]>;
|
|
220
|
+
/**
|
|
221
|
+
* Latest snapshot per project in the window (default last 24h). The newest row
|
|
222
|
+
* per (project, source, entity) is chosen server-side, so the row cap bounds
|
|
223
|
+
* distinct entities, not poll history.
|
|
224
|
+
*/
|
|
225
|
+
latestPerProject(query?: ProjectObservabilityQuery): Promise<ProjectObservabilitySnapshot[]>;
|
|
226
|
+
private where;
|
|
227
|
+
private search;
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Fixture raw stream hits in the collector's long format (obviously fake data).
|
|
231
|
+
* Project `example-site` has two polls (the older with different values) and a
|
|
232
|
+
* failed GlitchTip source; `example-internal` has only workloads and an
|
|
233
|
+
* unconnected Matomo. Includes an opt-in `codex` configuration row that the
|
|
234
|
+
* reader must ignore.
|
|
235
|
+
*/
|
|
236
|
+
export declare const PROJECT_OBSERVABILITY_FIXTURE_HITS: readonly Record<string, unknown>[];
|
|
237
|
+
/** Fixture records parsed from {@link PROJECT_OBSERVABILITY_FIXTURE_HITS}. */
|
|
238
|
+
export declare const PROJECT_OBSERVABILITY_FIXTURE_RECORDS: readonly ProjectObservabilityRecord[];
|
|
239
|
+
export {};
|
|
240
|
+
//# sourceMappingURL=observability.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"observability.d.ts","sourceRoot":"","sources":["../src/observability.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,eAAO,MAAM,6BAA6B,+EAOhC,CAAC;AAEX,MAAM,MAAM,0BAA0B,GACpC,CAAC,OAAO,6BAA6B,CAAC,C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7C;AAED,uFAAuF;AACvF,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,yBAAyB,EACjC,UAAU,EAAE,MAAM,GACjB,MAAM,OAAO,CAAC,MAAM,CAAC,CAEvB;AAwBD;;;;GAIG;AACH,wBAAgB,+BAA+B,CAC7C,GAAG,EAAE,OAAO,GACX,0BAA0B,GAAG,IAAI,CAsFnC;AAOD;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,SAAS,0BAA0B,EAAE,GAC7C,4BAA4B,EAAE,CA2BhC;AAiED,iEAAiE;AACjE,qBAAa,uBAAuB;IAClC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAiC;IACzD,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAS;IAC7B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;gBAEpB,OAAO,EAAE,8BAA8B;IAWnD,qEAAqE;IAC/D,WAAW,CACf,KAAK,GAAE,yBAA8B,GACpC,OAAO,CAAC,0BAA0B,EAAE,CAAC;IAMxC;;;;OAIG;IACG,gBAAgB,CACpB,KAAK,GAAE,yBAA8B,GACpC,OAAO,CAAC,4BAA4B,EAAE,CAAC;IAQ1C,OAAO,CAAC,KAAK;YAeC,MAAM;CAuFrB;AAeD;;;;;;GAMG;AACH,eAAO,MAAM,kCAAkC,EAAE,SAAS,MAAM,CAC9D,MAAM,EACN,OAAO,CACR,EA8HA,CAAC;AAEF,8EAA8E;AAC9E,eAAO,MAAM,qCAAqC,EAAE,SAAS,0BAA0B,EAGnB,CAAC"}
|
|
@@ -0,0 +1,420 @@
|
|
|
1
|
+
//#region src/observability.ts
|
|
2
|
+
var PROJECT_OBSERVABILITY_SOURCES = [
|
|
3
|
+
"matomo",
|
|
4
|
+
"glitchtip",
|
|
5
|
+
"bifrost",
|
|
6
|
+
"workloads",
|
|
7
|
+
"deployments",
|
|
8
|
+
"ci"
|
|
9
|
+
];
|
|
10
|
+
var OpenObserveReadError = class extends Error {
|
|
11
|
+
status;
|
|
12
|
+
constructor(message, status) {
|
|
13
|
+
super(message);
|
|
14
|
+
this.name = "OpenObserveReadError";
|
|
15
|
+
this.status = status;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
function credentialFromSecret(source, secretName) {
|
|
19
|
+
return async () => (await source.retrieve(secretName)).value;
|
|
20
|
+
}
|
|
21
|
+
var DAY_MS = 1440 * 60 * 1e3;
|
|
22
|
+
var PROJECT_ID_PATTERN = /^[a-z][a-z0-9-]{0,62}$/;
|
|
23
|
+
var NAME_PATTERN = /^[A-Za-z0-9_.-]+$/;
|
|
24
|
+
var CONNECTION = "connection";
|
|
25
|
+
function toNum(value) {
|
|
26
|
+
if (typeof value === "number" && Number.isFinite(value)) return value;
|
|
27
|
+
if (typeof value === "string" && value.trim() !== "") {
|
|
28
|
+
const n = Number(value);
|
|
29
|
+
return Number.isFinite(n) ? n : null;
|
|
30
|
+
}
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
function toText(value) {
|
|
34
|
+
return typeof value === "string" && value !== "" ? value : null;
|
|
35
|
+
}
|
|
36
|
+
function isSource(value) {
|
|
37
|
+
return PROJECT_OBSERVABILITY_SOURCES.includes(value);
|
|
38
|
+
}
|
|
39
|
+
function parseProjectObservabilityRecord(raw) {
|
|
40
|
+
if (typeof raw !== "object" || raw === null) return null;
|
|
41
|
+
const r = raw;
|
|
42
|
+
const project = toText(r.project);
|
|
43
|
+
const entity = toText(r.entity);
|
|
44
|
+
const observed = toNum(r.observed_at) ?? toNum(r._timestamp);
|
|
45
|
+
if (!project || !entity || observed === null || !isSource(r.source)) return null;
|
|
46
|
+
if (r.record_kind !== void 0 && r.record_kind !== "snapshot") return null;
|
|
47
|
+
const base = {
|
|
48
|
+
project,
|
|
49
|
+
entity,
|
|
50
|
+
status: toText(r.status) ?? "unknown",
|
|
51
|
+
observedAtMicros: observed,
|
|
52
|
+
observedAt: new Date(Math.floor(observed / 1e3)).toISOString(),
|
|
53
|
+
lastSuccessAtMicros: toNum(r.last_success_at)
|
|
54
|
+
};
|
|
55
|
+
switch (r.source) {
|
|
56
|
+
case "matomo": return {
|
|
57
|
+
...base,
|
|
58
|
+
source: "matomo",
|
|
59
|
+
period: toText(r.period),
|
|
60
|
+
visitors: toNum(r.visitors),
|
|
61
|
+
visits: toNum(r.visits),
|
|
62
|
+
actions: toNum(r.actions)
|
|
63
|
+
};
|
|
64
|
+
case "glitchtip": return {
|
|
65
|
+
...base,
|
|
66
|
+
source: "glitchtip",
|
|
67
|
+
period: toText(r.period),
|
|
68
|
+
windowStart: toText(r.window_start),
|
|
69
|
+
windowEnd: toText(r.window_end),
|
|
70
|
+
errorEvents: toNum(r.error_events),
|
|
71
|
+
errorEventsCurrentHour: toNum(r.error_events_current_hour)
|
|
72
|
+
};
|
|
73
|
+
case "bifrost": return {
|
|
74
|
+
...base,
|
|
75
|
+
source: "bifrost",
|
|
76
|
+
context: toText(r.context),
|
|
77
|
+
period: toText(r.period),
|
|
78
|
+
requests: toNum(r.requests),
|
|
79
|
+
inputTokens: toNum(r.input_tokens),
|
|
80
|
+
outputTokens: toNum(r.output_tokens),
|
|
81
|
+
totalTokens: toNum(r.total_tokens),
|
|
82
|
+
estimatedCostUsd: toNum(r.estimated_cost_usd),
|
|
83
|
+
budgetUsd: toNum(r.budget_usd),
|
|
84
|
+
budgetUsedUsd: toNum(r.budget_used_usd),
|
|
85
|
+
budgetReset: toText(r.budget_reset),
|
|
86
|
+
costKind: toText(r.cost_kind)
|
|
87
|
+
};
|
|
88
|
+
case "workloads": return {
|
|
89
|
+
...base,
|
|
90
|
+
source: "workloads",
|
|
91
|
+
namespace: toText(r.namespace),
|
|
92
|
+
desiredReplicas: toNum(r.desired_replicas),
|
|
93
|
+
readyReplicas: toNum(r.ready_replicas),
|
|
94
|
+
updatedReplicas: toNum(r.updated_replicas),
|
|
95
|
+
images: toText(r.images),
|
|
96
|
+
cpuCores: toNum(r.cpu_cores),
|
|
97
|
+
memoryBytes: toNum(r.memory_bytes),
|
|
98
|
+
measuredAt: toText(r.measured_at)
|
|
99
|
+
};
|
|
100
|
+
case "deployments": return {
|
|
101
|
+
...base,
|
|
102
|
+
source: "deployments",
|
|
103
|
+
ready: toText(r.ready),
|
|
104
|
+
revision: toText(r.revision),
|
|
105
|
+
transitionAt: toText(r.transition_at)
|
|
106
|
+
};
|
|
107
|
+
case "ci": return {
|
|
108
|
+
...base,
|
|
109
|
+
source: "ci",
|
|
110
|
+
workflow: toText(r.workflow),
|
|
111
|
+
runStatus: toText(r.run_status),
|
|
112
|
+
conclusion: toText(r.conclusion),
|
|
113
|
+
revision: toText(r.revision),
|
|
114
|
+
runUpdatedAt: toText(r.run_updated_at)
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
function sumOf(values) {
|
|
119
|
+
const present = values.filter((v) => v !== null);
|
|
120
|
+
return present.length === 0 ? null : present.reduce((a, b) => a + b, 0);
|
|
121
|
+
}
|
|
122
|
+
function foldProjectSnapshots(records) {
|
|
123
|
+
const latest = /* @__PURE__ */ new Map();
|
|
124
|
+
for (const rec of records) {
|
|
125
|
+
const key = JSON.stringify([
|
|
126
|
+
rec.project,
|
|
127
|
+
rec.source,
|
|
128
|
+
rec.entity
|
|
129
|
+
]);
|
|
130
|
+
const cur = latest.get(key);
|
|
131
|
+
if (!cur || rec.observedAtMicros > cur.observedAtMicros) latest.set(key, rec);
|
|
132
|
+
}
|
|
133
|
+
const poll = /* @__PURE__ */ new Map();
|
|
134
|
+
for (const rec of latest.values()) {
|
|
135
|
+
const key = `${rec.project}\0${rec.source}`;
|
|
136
|
+
poll.set(key, Math.max(poll.get(key) ?? 0, rec.observedAtMicros));
|
|
137
|
+
}
|
|
138
|
+
const byProject = /* @__PURE__ */ new Map();
|
|
139
|
+
for (const rec of latest.values()) {
|
|
140
|
+
if (rec.observedAtMicros !== poll.get(`${rec.project}\0${rec.source}`)) continue;
|
|
141
|
+
const list = byProject.get(rec.project) ?? [];
|
|
142
|
+
list.push(rec);
|
|
143
|
+
byProject.set(rec.project, list);
|
|
144
|
+
}
|
|
145
|
+
return [...byProject.entries()].sort(([a], [b]) => a.localeCompare(b)).map(([projectId, recs]) => buildSnapshot(projectId, recs));
|
|
146
|
+
}
|
|
147
|
+
function buildSnapshot(projectId, recs) {
|
|
148
|
+
const records = {
|
|
149
|
+
matomo: [],
|
|
150
|
+
glitchtip: [],
|
|
151
|
+
bifrost: [],
|
|
152
|
+
workloads: [],
|
|
153
|
+
deployments: [],
|
|
154
|
+
ci: []
|
|
155
|
+
};
|
|
156
|
+
const sources = {};
|
|
157
|
+
let newest = 0;
|
|
158
|
+
for (const rec of recs.sort((a, b) => a.entity.localeCompare(b.entity))) {
|
|
159
|
+
newest = Math.max(newest, rec.observedAtMicros);
|
|
160
|
+
if (rec.entity === CONNECTION || !sources[rec.source]) sources[rec.source] = {
|
|
161
|
+
status: rec.status,
|
|
162
|
+
observedAtMicros: rec.observedAtMicros,
|
|
163
|
+
lastSuccessAtMicros: rec.lastSuccessAtMicros
|
|
164
|
+
};
|
|
165
|
+
if (rec.entity !== CONNECTION) records[rec.source].push(rec);
|
|
166
|
+
}
|
|
167
|
+
const deploys = records.workloads.filter((w) => w.desiredReplicas !== null);
|
|
168
|
+
const aiRolling = records.bifrost.filter((b) => b.period === "rolling_24h" && b.totalTokens !== null);
|
|
169
|
+
return {
|
|
170
|
+
projectId,
|
|
171
|
+
observedAtMicros: newest,
|
|
172
|
+
observedAt: new Date(Math.floor(newest / 1e3)).toISOString(),
|
|
173
|
+
sources,
|
|
174
|
+
records,
|
|
175
|
+
summary: {
|
|
176
|
+
visitors: sumOf(records.matomo.map((m) => m.visitors)),
|
|
177
|
+
errorEvents: sumOf(records.glitchtip.map((g) => g.errorEvents)),
|
|
178
|
+
aiTotalTokens: sumOf(aiRolling.map((b) => b.totalTokens)),
|
|
179
|
+
aiEstimatedCostUsd: sumOf(aiRolling.map((b) => b.estimatedCostUsd)),
|
|
180
|
+
workloadsDesired: sumOf(deploys.map((w) => w.desiredReplicas)),
|
|
181
|
+
workloadsReady: sumOf(deploys.map((w) => w.readyReplicas)),
|
|
182
|
+
deploymentsReady: records.deployments.length === 0 ? null : records.deployments.filter((d) => d.ready === "True").length,
|
|
183
|
+
deploymentsTotal: records.deployments.length === 0 ? null : records.deployments.length,
|
|
184
|
+
latestCi: records.ci.map((c) => ({
|
|
185
|
+
repository: c.entity,
|
|
186
|
+
conclusion: c.conclusion
|
|
187
|
+
}))
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
function isBrowser() {
|
|
192
|
+
const g = globalThis;
|
|
193
|
+
return typeof g.window !== "undefined" && typeof g.document !== "undefined";
|
|
194
|
+
}
|
|
195
|
+
var OpenObserveStreamReader = class {
|
|
196
|
+
options;
|
|
197
|
+
org;
|
|
198
|
+
stream;
|
|
199
|
+
constructor(options) {
|
|
200
|
+
const org = options.org ?? "default";
|
|
201
|
+
const stream = options.stream ?? "project_observability";
|
|
202
|
+
if (!NAME_PATTERN.test(org) || !NAME_PATTERN.test(stream)) throw new OpenObserveReadError("Invalid org or stream name");
|
|
203
|
+
this.options = options;
|
|
204
|
+
this.org = org;
|
|
205
|
+
this.stream = stream;
|
|
206
|
+
}
|
|
207
|
+
/** Every collector snapshot row in the window, newest poll first. */
|
|
208
|
+
async queryWindow(query = {}) {
|
|
209
|
+
const where = this.where(query.projectIds);
|
|
210
|
+
const sql = `SELECT * FROM "${this.stream}"${where} ORDER BY observed_at DESC`;
|
|
211
|
+
return this.search(query, sql);
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Latest snapshot per project in the window (default last 24h). The newest row
|
|
215
|
+
* per (project, source, entity) is chosen server-side, so the row cap bounds
|
|
216
|
+
* distinct entities, not poll history.
|
|
217
|
+
*/
|
|
218
|
+
async latestPerProject(query = {}) {
|
|
219
|
+
const where = this.where(query.projectIds);
|
|
220
|
+
const sql = `SELECT * FROM (SELECT *, row_number() OVER (PARTITION BY project, source, entity ORDER BY observed_at DESC) AS rn FROM "${this.stream}"${where}) WHERE rn = 1 ORDER BY project, source, entity`;
|
|
221
|
+
return foldProjectSnapshots(await this.search(query, sql));
|
|
222
|
+
}
|
|
223
|
+
where(projectIds) {
|
|
224
|
+
const clauses = [`record_kind = 'snapshot'`];
|
|
225
|
+
if (projectIds && projectIds.length > 0) {
|
|
226
|
+
for (const id of projectIds) if (!PROJECT_ID_PATTERN.test(id)) throw new OpenObserveReadError("Invalid project id in query");
|
|
227
|
+
clauses.push(`project IN (${projectIds.map((id) => `'${id}'`).join(", ")})`);
|
|
228
|
+
}
|
|
229
|
+
return ` WHERE ${clauses.join(" AND ")}`;
|
|
230
|
+
}
|
|
231
|
+
async search(query, sql) {
|
|
232
|
+
if (isBrowser()) throw new OpenObserveReadError("OpenObserveStreamReader is server-only and cannot run in a browser");
|
|
233
|
+
const now = (this.options.now ?? (() => /* @__PURE__ */ new Date()))();
|
|
234
|
+
const end = query.end ?? now;
|
|
235
|
+
const start = query.start ?? /* @__PURE__ */ new Date(end.getTime() - DAY_MS);
|
|
236
|
+
if (Number.isNaN(start.getTime()) || Number.isNaN(end.getTime())) throw new OpenObserveReadError("Query window contains an invalid date");
|
|
237
|
+
if (start.getTime() >= end.getTime()) throw new OpenObserveReadError("Query window start must precede end");
|
|
238
|
+
const endpoint = typeof this.options.endpoint === "function" ? await this.options.endpoint() : this.options.endpoint;
|
|
239
|
+
const credential = await this.options.credential();
|
|
240
|
+
if (!endpoint || !credential) throw new OpenObserveReadError("OpenObserve endpoint and credential must be configured");
|
|
241
|
+
const maxRows = this.options.maxRows ?? 5e3;
|
|
242
|
+
const url = `${endpoint.replace(/\/+$/, "")}/api/${this.org}/_search`;
|
|
243
|
+
const body = JSON.stringify({ query: {
|
|
244
|
+
sql,
|
|
245
|
+
start_time: start.getTime() * 1e3,
|
|
246
|
+
end_time: end.getTime() * 1e3,
|
|
247
|
+
from: 0,
|
|
248
|
+
size: maxRows + 1
|
|
249
|
+
} });
|
|
250
|
+
const doFetch = this.options.fetch ?? fetch;
|
|
251
|
+
const redact = (text) => text.split(credential).join("[redacted]").slice(0, 200);
|
|
252
|
+
let response;
|
|
253
|
+
try {
|
|
254
|
+
response = await doFetch(url, {
|
|
255
|
+
method: "POST",
|
|
256
|
+
headers: {
|
|
257
|
+
Authorization: `${this.options.authScheme ?? "Basic"} ${credential}`,
|
|
258
|
+
"Content-Type": "application/json",
|
|
259
|
+
Accept: "application/json"
|
|
260
|
+
},
|
|
261
|
+
body,
|
|
262
|
+
signal: AbortSignal.timeout(this.options.timeoutMs ?? 1e4)
|
|
263
|
+
});
|
|
264
|
+
} catch (error) {
|
|
265
|
+
throw new OpenObserveReadError(redact(`OpenObserve request failed (${error instanceof Error ? error.name : "error"})`));
|
|
266
|
+
}
|
|
267
|
+
if (!response.ok) throw new OpenObserveReadError(redact(`OpenObserve search failed with HTTP ${response.status}`), response.status);
|
|
268
|
+
let payload;
|
|
269
|
+
try {
|
|
270
|
+
payload = await response.json();
|
|
271
|
+
} catch {
|
|
272
|
+
throw new OpenObserveReadError("OpenObserve returned a non-JSON body");
|
|
273
|
+
}
|
|
274
|
+
const hits = payload?.hits;
|
|
275
|
+
if (!Array.isArray(hits)) throw new OpenObserveReadError("OpenObserve response has no hits array");
|
|
276
|
+
if (hits.length > maxRows) throw new OpenObserveReadError(`OpenObserve result exceeded the ${maxRows}-row cap; narrow the window or raise maxRows`);
|
|
277
|
+
return hits.map(parseProjectObservabilityRecord).filter((rec) => rec !== null);
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
var T1 = 0x640b5eece0000;
|
|
281
|
+
var T2 = 0x640b612914600;
|
|
282
|
+
function polled(project, observed) {
|
|
283
|
+
return {
|
|
284
|
+
project,
|
|
285
|
+
_timestamp: observed,
|
|
286
|
+
observed_at: observed,
|
|
287
|
+
last_success_at: observed,
|
|
288
|
+
record_kind: "snapshot",
|
|
289
|
+
status: "connected"
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
var PROJECT_OBSERVABILITY_FIXTURE_HITS = [
|
|
293
|
+
{
|
|
294
|
+
...polled("example-site", T1),
|
|
295
|
+
source: "matomo",
|
|
296
|
+
entity: "7",
|
|
297
|
+
period: "today_site_timezone",
|
|
298
|
+
visitors: 100,
|
|
299
|
+
visits: 120,
|
|
300
|
+
actions: 300
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
...polled("example-site", T1),
|
|
304
|
+
source: "ci",
|
|
305
|
+
entity: "example-org/example-site",
|
|
306
|
+
workflow: "CI",
|
|
307
|
+
run_status: "completed",
|
|
308
|
+
conclusion: "failure",
|
|
309
|
+
revision: "0000000000000000000000000000000000000001",
|
|
310
|
+
run_updated_at: "2025-10-09T08:00:00Z"
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
...polled("example-site", T2),
|
|
314
|
+
source: "matomo",
|
|
315
|
+
entity: "7",
|
|
316
|
+
period: "today_site_timezone",
|
|
317
|
+
visitors: 120,
|
|
318
|
+
visits: 150,
|
|
319
|
+
actions: 340
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
...polled("example-site", T2),
|
|
323
|
+
source: "bifrost",
|
|
324
|
+
entity: "vk-example",
|
|
325
|
+
context: "app",
|
|
326
|
+
period: "rolling_24h",
|
|
327
|
+
requests: 12,
|
|
328
|
+
input_tokens: 3e4,
|
|
329
|
+
output_tokens: 15e3,
|
|
330
|
+
total_tokens: 45e3,
|
|
331
|
+
estimated_cost_usd: 2.75,
|
|
332
|
+
cost_kind: "gateway_estimate"
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
...polled("example-site", T2),
|
|
336
|
+
source: "bifrost",
|
|
337
|
+
entity: "vk-example:budget-1",
|
|
338
|
+
context: "app",
|
|
339
|
+
period: "1M",
|
|
340
|
+
budget_usd: 50,
|
|
341
|
+
budget_used_usd: 12.5,
|
|
342
|
+
budget_reset: "2025-10-01T00:00:00Z",
|
|
343
|
+
cost_kind: "governance_estimate"
|
|
344
|
+
},
|
|
345
|
+
{
|
|
346
|
+
...polled("example-site", T2),
|
|
347
|
+
source: "workloads",
|
|
348
|
+
entity: "example-ns/web",
|
|
349
|
+
namespace: "example-ns",
|
|
350
|
+
desired_replicas: 2,
|
|
351
|
+
ready_replicas: 2,
|
|
352
|
+
updated_replicas: 2,
|
|
353
|
+
images: "registry.example.invalid/web:1"
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
...polled("example-site", T2),
|
|
357
|
+
source: "workloads",
|
|
358
|
+
entity: "example-ns/web-abc",
|
|
359
|
+
namespace: "example-ns",
|
|
360
|
+
cpu_cores: .05,
|
|
361
|
+
memory_bytes: 104857600,
|
|
362
|
+
measured_at: "2025-10-09T11:59:00Z"
|
|
363
|
+
},
|
|
364
|
+
{
|
|
365
|
+
...polled("example-site", T2),
|
|
366
|
+
source: "deployments",
|
|
367
|
+
entity: "example-site",
|
|
368
|
+
ready: "True",
|
|
369
|
+
revision: "main@sha1:0000000000000000000000000000000000000002",
|
|
370
|
+
transition_at: "2025-10-08T10:00:00Z"
|
|
371
|
+
},
|
|
372
|
+
{
|
|
373
|
+
...polled("example-site", T2),
|
|
374
|
+
source: "ci",
|
|
375
|
+
entity: "example-org/example-site",
|
|
376
|
+
workflow: "CI",
|
|
377
|
+
run_status: "completed",
|
|
378
|
+
conclusion: "success",
|
|
379
|
+
revision: "0000000000000000000000000000000000000002",
|
|
380
|
+
run_updated_at: "2025-10-09T11:00:00Z"
|
|
381
|
+
},
|
|
382
|
+
{
|
|
383
|
+
...polled("example-site", T2),
|
|
384
|
+
source: "glitchtip",
|
|
385
|
+
entity: "connection",
|
|
386
|
+
status: "error",
|
|
387
|
+
last_success_at: void 0
|
|
388
|
+
},
|
|
389
|
+
{
|
|
390
|
+
project: "example-site",
|
|
391
|
+
source: "codex",
|
|
392
|
+
entity: "connection",
|
|
393
|
+
record_kind: "configuration",
|
|
394
|
+
status: "opt_in_import_required",
|
|
395
|
+
_timestamp: T2,
|
|
396
|
+
observed_at: T2
|
|
397
|
+
},
|
|
398
|
+
{
|
|
399
|
+
...polled("example-internal", T2),
|
|
400
|
+
source: "matomo",
|
|
401
|
+
entity: "connection",
|
|
402
|
+
status: "not_connected",
|
|
403
|
+
last_success_at: void 0
|
|
404
|
+
},
|
|
405
|
+
{
|
|
406
|
+
...polled("example-internal", T2),
|
|
407
|
+
source: "workloads",
|
|
408
|
+
entity: "internal-ns/api",
|
|
409
|
+
namespace: "internal-ns",
|
|
410
|
+
desired_replicas: 1,
|
|
411
|
+
ready_replicas: 0,
|
|
412
|
+
updated_replicas: 1,
|
|
413
|
+
images: "registry.example.invalid/api:3"
|
|
414
|
+
}
|
|
415
|
+
];
|
|
416
|
+
var PROJECT_OBSERVABILITY_FIXTURE_RECORDS = PROJECT_OBSERVABILITY_FIXTURE_HITS.map(parseProjectObservabilityRecord).filter((rec) => rec !== null);
|
|
417
|
+
//#endregion
|
|
418
|
+
export { OpenObserveReadError, OpenObserveStreamReader, PROJECT_OBSERVABILITY_FIXTURE_HITS, PROJECT_OBSERVABILITY_FIXTURE_RECORDS, PROJECT_OBSERVABILITY_SOURCES, credentialFromSecret, foldProjectSnapshots, parseProjectObservabilityRecord };
|
|
419
|
+
|
|
420
|
+
//# sourceMappingURL=observability.js.map
|