@juice-js/observability 1.1.0-alpha.31 → 1.1.0-alpha.32

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.
@@ -0,0 +1,368 @@
1
+ import { ApiService, ContextService, LinkPipe } from "./juice-js-observability.mjs";
2
+ import { c as ContextBar, h as apiResource, o as problemText } from "./juice-js-observability-telemetry-DVwUTHSz.mjs";
3
+ import { burnText, objective, percent, sloState, times } from "./juice-js-observability-slos.page-DNG6g6_R.mjs";
4
+ import * as i0 from "@angular/core";
5
+ import { ChangeDetectionStrategy, Component, computed, inject, input } from "@angular/core";
6
+ import { RouterLink } from "@angular/router";
7
+ import { DatePipe } from "@angular/common";
8
+ import * as i1 from "@angular/material/progress-bar";
9
+ import { MatProgressBarModule } from "@angular/material/progress-bar";
10
+ const WINDOWS = {
11
+ "5m": "5 minutes",
12
+ "30m": "30 minutes",
13
+ "1h": "1 hour",
14
+ "6h": "6 hours",
15
+ "3d": "3 days"
16
+ };
17
+ var SloPage = class SloPage {
18
+ key = input.required(...ngDevMode ? [{ debugName: "key" }] : /* istanbul ignore next */ []);
19
+ ctx = inject(ContextService);
20
+ api = inject(ApiService);
21
+ detail = apiResource({
22
+ params: () => this.key(),
23
+ stream: ({ params }) => this.api.slo(params)
24
+ });
25
+ error = computed(() => problemText(this.detail.error()), ...ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []);
26
+ objective = objective;
27
+ percent = percent;
28
+ burn = burnText;
29
+ state = sloState;
30
+ times = times;
31
+ windowName(name) {
32
+ return WINDOWS[name] ?? name;
33
+ }
34
+ allowed(s) {
35
+ return Math.round(s.budgetAllowed);
36
+ }
37
+ daysNewestFirst(days) {
38
+ return [...days].reverse();
39
+ }
40
+ isToday(day) {
41
+ return day.day.slice(0, 10) === (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
42
+ }
43
+ excluded(day) {
44
+ const parts = [
45
+ [day.excludedHealth, "health checks"],
46
+ [day.excludedCancelled, "given up"],
47
+ [day.excludedClientErrors, "client errors"]
48
+ ].filter(([n]) => n > 0).map(([n, what]) => `${n.toLocaleString()} ${what}`);
49
+ return parts.length ? parts.join(", ") : "—";
50
+ }
51
+ clientErrors(d) {
52
+ return d.clientErrors === "Bad" ? "bad" : d.clientErrors === "Exclude" ? "not counted" : "counted as good";
53
+ }
54
+ static ɵfac = i0.ɵɵngDeclareFactory({
55
+ minVersion: "12.0.0",
56
+ version: "22.2.4",
57
+ ngImport: i0,
58
+ type: SloPage,
59
+ deps: [],
60
+ target: i0.ɵɵFactoryTarget.Component
61
+ });
62
+ static ɵcmp = i0.ɵɵngDeclareComponent({
63
+ minVersion: "17.0.0",
64
+ version: "22.2.4",
65
+ type: SloPage,
66
+ isStandalone: true,
67
+ selector: "ng-component",
68
+ inputs: { key: {
69
+ classPropertyName: "key",
70
+ publicName: "key",
71
+ isSignal: true,
72
+ isRequired: true,
73
+ transformFunction: null
74
+ } },
75
+ ngImport: i0,
76
+ template: `
77
+ <jc-context-bar>
78
+ <a class="jc-crumb" [routerLink]="['slos'] | jcLink" [queryParams]="ctx.keep()">SLOs</a><span class="jc-crumb-sep">›</span>
79
+ <h1>{{ detail.value()?.slo?.name ?? key() }}</h1>
80
+ </jc-context-bar>
81
+ @if (detail.isLoading() && !detail.value()) { <mat-progress-bar mode="indeterminate" /> }
82
+ @if (detail.error()) { <p class="jc-error">{{ error() }}</p> }
83
+ @if (detail.value(); as d) {
84
+ <p class="jc-summary">
85
+ <span class="jc-badge" [class]="state(d.slo.state).css" data-testid="slo-state">{{ state(d.slo.state).text }}</span>
86
+ <strong>{{ objective(d.slo) }}</strong> · {{ d.slo.category }} · {{ d.slo.service }} in {{ d.slo.environment }} · version {{ d.slo.version }}
87
+ @if (d.slo.pendingVersion) { <span class="jc-muted"> (version {{ d.slo.pendingVersion }} pending)</span> }
88
+ @if (d.slo.retired) { <span class="jc-muted"> · retired</span> }
89
+ </p>
90
+
91
+ <section class="jc-card" data-testid="slo-budget">
92
+ <h2>Error budget, last 30 days</h2>
93
+ @switch (d.slo.state) {
94
+ @case ('Unknown') {
95
+ <p data-testid="slo-budget-unknown">Only {{ percent(d.slo.coverage, 1) }} of the last 30 days' minutes are counted, so there's no budget to show yet. Minutes that weren't
96
+ read are never taken as good: either counting is still catching up, or telemetry didn't arrive.</p>
97
+ }
98
+ @case ('InsufficientData') {
99
+ <p>{{ d.slo.total.toLocaleString() }} requests in 30 days: too few to say whether the objective is met.</p>
100
+ }
101
+ @default {
102
+ <p><strong>{{ percent(d.slo.attainment, 3) }}</strong> of {{ d.slo.total.toLocaleString() }} requests were good, against an objective of {{ d.slo.target }}%.</p>
103
+ @if ((d.slo.budgetUsed ?? 0) <= 1) {
104
+ <p>{{ percent(d.slo.budgetUsed, 1) }} of the budget is used ({{ d.slo.bad.toLocaleString() }} bad of {{ allowed(d.slo).toLocaleString() }} allowed),
105
+ {{ percent(d.slo.budgetRemaining, 1) }} left.</p>
106
+ } @else {
107
+ <p class="jc-bad">The budget is overspent: {{ d.slo.bad.toLocaleString() }} bad requests against {{ allowed(d.slo).toLocaleString() }} allowed, {{ times(d.slo.budgetUsed!) }} the budget.</p>
108
+ }
109
+ }
110
+ }
111
+ </section>
112
+
113
+ <section class="jc-card" data-testid="slo-burn">
114
+ <h2>Burn rate</h2>
115
+ <p class="jc-muted jc-small">How fast the budget is being spent: 1× spends it exactly over 30 days. A window needs enough requests, and nearly all its minutes counted.</p>
116
+ <table class="jc-table">
117
+ <thead><tr><th>Window</th><th>Requests</th><th>Good</th><th>Burn rate</th></tr></thead>
118
+ <tbody>
119
+ @for (w of d.slo.burn; track w.name) {
120
+ <tr [attr.data-testid]="'slo-burn-' + w.name">
121
+ <td>{{ windowName(w.name) }}</td><td>{{ w.total.toLocaleString() }}</td><td>{{ percent(w.attainment, 2) }}</td><td>{{ burn(w) }}</td>
122
+ </tr>
123
+ }
124
+ </tbody>
125
+ </table>
126
+ </section>
127
+
128
+ <section class="jc-card" data-testid="slo-days">
129
+ <h2>By day</h2>
130
+ @if (d.days.length) {
131
+ <table class="jc-table">
132
+ <thead><tr><th>Day</th><th>Requests</th><th>Good</th><th>Left out</th><th>Minutes counted</th></tr></thead>
133
+ <tbody>
134
+ @for (day of daysNewestFirst(d.days); track day.day) {
135
+ <tr>
136
+ <td class="jc-nowrap">{{ day.day | date: 'MMM d' : 'UTC' }}</td>
137
+ <td>{{ day.total.toLocaleString() }}</td>
138
+ <td [class.jc-bad]="day.attainment !== null && day.attainment * 100 < d.slo.target">{{ percent(day.attainment, 3) }}</td>
139
+ <td class="jc-small">{{ excluded(day) }}</td>
140
+ <td [class.jc-bad]="day.minutes < day.expectedMinutes && !isToday(day)">{{ day.minutes }} of {{ day.expectedMinutes }}</td>
141
+ </tr>
142
+ }
143
+ </tbody>
144
+ </table>
145
+ } @else { <p class="jc-muted">Nothing counted yet.</p> }
146
+ </section>
147
+
148
+ <section class="jc-card" data-testid="slo-eligibility">
149
+ <h2>What counts</h2>
150
+ <ul class="jc-small">
151
+ <li>Requests to <strong>{{ d.definition.service }}</strong> in {{ d.definition.environment }}: its server and consumer spans,
152
+ {{ d.definition.operations.length ? 'only ' + d.definition.operations.join(', ') : 'every operation' }}.</li>
153
+ <li>Never counted: {{ d.definition.excludeOperations.join(', ') || 'nothing' }} (health checks and the like).</li>
154
+ <li>5xx, 429, a failed span and a failed message are bad.</li>
155
+ <li>Other 4xx (the client's mistake): {{ clientErrors(d.definition) }}.</li>
156
+ <li>408 and 499 (the client gave up): {{ d.definition.cancellations === 'Bad' ? 'counted as bad' : 'not counted' }}.</li>
157
+ <li>Retries: each attempt the service received is its own request.</li>
158
+ @if (d.definition.sli === 'Latency') { <li>Latency counts requests that succeeded: good at {{ d.definition.thresholdMs }} ms or less.</li> }
159
+ </ul>
160
+ </section>
161
+
162
+ <section class="jc-card" data-testid="slo-versions">
163
+ <h2>Versions</h2>
164
+ <table class="jc-table">
165
+ <thead><tr><th>Version</th><th>Objective</th><th>From</th><th>Status</th><th>Loaded</th></tr></thead>
166
+ <tbody>
167
+ @for (v of d.versions; track v.version) {
168
+ <tr [attr.data-testid]="'slo-version-' + v.version">
169
+ <td>{{ v.version }}</td><td>{{ objective(v.definition) }}</td><td class="jc-nowrap">{{ v.effectiveFrom | date: 'MMM d, HH:mm' }}</td>
170
+ <td>{{ v.status }}</td><td class="jc-small">{{ v.createdAt | date: 'MMM d, HH:mm' }} by {{ v.createdBy }}</td>
171
+ </tr>
172
+ }
173
+ </tbody>
174
+ </table>
175
+ <p class="jc-muted jc-small">Each minute is counted under the version in effect then, so a new objective doesn't rewrite the past.</p>
176
+ </section>
177
+ }
178
+ `,
179
+ isInline: true,
180
+ dependencies: [
181
+ {
182
+ kind: "directive",
183
+ type: RouterLink,
184
+ selector: "[routerLink]",
185
+ inputs: [
186
+ "target",
187
+ "queryParams",
188
+ "fragment",
189
+ "queryParamsHandling",
190
+ "state",
191
+ "info",
192
+ "relativeTo",
193
+ "preserveFragment",
194
+ "skipLocationChange",
195
+ "replaceUrl",
196
+ "browserUrl",
197
+ "routerLink"
198
+ ]
199
+ },
200
+ {
201
+ kind: "ngmodule",
202
+ type: MatProgressBarModule
203
+ },
204
+ {
205
+ kind: "component",
206
+ type: i1.MatProgressBar,
207
+ selector: "mat-progress-bar",
208
+ inputs: [
209
+ "color",
210
+ "value",
211
+ "bufferValue",
212
+ "mode"
213
+ ],
214
+ outputs: ["animationEnd"],
215
+ exportAs: ["matProgressBar"]
216
+ },
217
+ {
218
+ kind: "component",
219
+ type: ContextBar,
220
+ selector: "jc-context-bar"
221
+ },
222
+ {
223
+ kind: "pipe",
224
+ type: LinkPipe,
225
+ name: "jcLink"
226
+ },
227
+ {
228
+ kind: "pipe",
229
+ type: DatePipe,
230
+ name: "date"
231
+ }
232
+ ],
233
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
234
+ });
235
+ };
236
+ i0.ɵɵngDeclareClassMetadata({
237
+ minVersion: "12.0.0",
238
+ version: "22.2.4",
239
+ ngImport: i0,
240
+ type: SloPage,
241
+ decorators: [{
242
+ type: Component,
243
+ args: [{
244
+ changeDetection: ChangeDetectionStrategy.OnPush,
245
+ imports: [
246
+ RouterLink,
247
+ LinkPipe,
248
+ DatePipe,
249
+ MatProgressBarModule,
250
+ ContextBar
251
+ ],
252
+ template: `
253
+ <jc-context-bar>
254
+ <a class="jc-crumb" [routerLink]="['slos'] | jcLink" [queryParams]="ctx.keep()">SLOs</a><span class="jc-crumb-sep">›</span>
255
+ <h1>{{ detail.value()?.slo?.name ?? key() }}</h1>
256
+ </jc-context-bar>
257
+ @if (detail.isLoading() && !detail.value()) { <mat-progress-bar mode="indeterminate" /> }
258
+ @if (detail.error()) { <p class="jc-error">{{ error() }}</p> }
259
+ @if (detail.value(); as d) {
260
+ <p class="jc-summary">
261
+ <span class="jc-badge" [class]="state(d.slo.state).css" data-testid="slo-state">{{ state(d.slo.state).text }}</span>
262
+ <strong>{{ objective(d.slo) }}</strong> · {{ d.slo.category }} · {{ d.slo.service }} in {{ d.slo.environment }} · version {{ d.slo.version }}
263
+ @if (d.slo.pendingVersion) { <span class="jc-muted"> (version {{ d.slo.pendingVersion }} pending)</span> }
264
+ @if (d.slo.retired) { <span class="jc-muted"> · retired</span> }
265
+ </p>
266
+
267
+ <section class="jc-card" data-testid="slo-budget">
268
+ <h2>Error budget, last 30 days</h2>
269
+ @switch (d.slo.state) {
270
+ @case ('Unknown') {
271
+ <p data-testid="slo-budget-unknown">Only {{ percent(d.slo.coverage, 1) }} of the last 30 days' minutes are counted, so there's no budget to show yet. Minutes that weren't
272
+ read are never taken as good: either counting is still catching up, or telemetry didn't arrive.</p>
273
+ }
274
+ @case ('InsufficientData') {
275
+ <p>{{ d.slo.total.toLocaleString() }} requests in 30 days: too few to say whether the objective is met.</p>
276
+ }
277
+ @default {
278
+ <p><strong>{{ percent(d.slo.attainment, 3) }}</strong> of {{ d.slo.total.toLocaleString() }} requests were good, against an objective of {{ d.slo.target }}%.</p>
279
+ @if ((d.slo.budgetUsed ?? 0) <= 1) {
280
+ <p>{{ percent(d.slo.budgetUsed, 1) }} of the budget is used ({{ d.slo.bad.toLocaleString() }} bad of {{ allowed(d.slo).toLocaleString() }} allowed),
281
+ {{ percent(d.slo.budgetRemaining, 1) }} left.</p>
282
+ } @else {
283
+ <p class="jc-bad">The budget is overspent: {{ d.slo.bad.toLocaleString() }} bad requests against {{ allowed(d.slo).toLocaleString() }} allowed, {{ times(d.slo.budgetUsed!) }} the budget.</p>
284
+ }
285
+ }
286
+ }
287
+ </section>
288
+
289
+ <section class="jc-card" data-testid="slo-burn">
290
+ <h2>Burn rate</h2>
291
+ <p class="jc-muted jc-small">How fast the budget is being spent: 1× spends it exactly over 30 days. A window needs enough requests, and nearly all its minutes counted.</p>
292
+ <table class="jc-table">
293
+ <thead><tr><th>Window</th><th>Requests</th><th>Good</th><th>Burn rate</th></tr></thead>
294
+ <tbody>
295
+ @for (w of d.slo.burn; track w.name) {
296
+ <tr [attr.data-testid]="'slo-burn-' + w.name">
297
+ <td>{{ windowName(w.name) }}</td><td>{{ w.total.toLocaleString() }}</td><td>{{ percent(w.attainment, 2) }}</td><td>{{ burn(w) }}</td>
298
+ </tr>
299
+ }
300
+ </tbody>
301
+ </table>
302
+ </section>
303
+
304
+ <section class="jc-card" data-testid="slo-days">
305
+ <h2>By day</h2>
306
+ @if (d.days.length) {
307
+ <table class="jc-table">
308
+ <thead><tr><th>Day</th><th>Requests</th><th>Good</th><th>Left out</th><th>Minutes counted</th></tr></thead>
309
+ <tbody>
310
+ @for (day of daysNewestFirst(d.days); track day.day) {
311
+ <tr>
312
+ <td class="jc-nowrap">{{ day.day | date: 'MMM d' : 'UTC' }}</td>
313
+ <td>{{ day.total.toLocaleString() }}</td>
314
+ <td [class.jc-bad]="day.attainment !== null && day.attainment * 100 < d.slo.target">{{ percent(day.attainment, 3) }}</td>
315
+ <td class="jc-small">{{ excluded(day) }}</td>
316
+ <td [class.jc-bad]="day.minutes < day.expectedMinutes && !isToday(day)">{{ day.minutes }} of {{ day.expectedMinutes }}</td>
317
+ </tr>
318
+ }
319
+ </tbody>
320
+ </table>
321
+ } @else { <p class="jc-muted">Nothing counted yet.</p> }
322
+ </section>
323
+
324
+ <section class="jc-card" data-testid="slo-eligibility">
325
+ <h2>What counts</h2>
326
+ <ul class="jc-small">
327
+ <li>Requests to <strong>{{ d.definition.service }}</strong> in {{ d.definition.environment }}: its server and consumer spans,
328
+ {{ d.definition.operations.length ? 'only ' + d.definition.operations.join(', ') : 'every operation' }}.</li>
329
+ <li>Never counted: {{ d.definition.excludeOperations.join(', ') || 'nothing' }} (health checks and the like).</li>
330
+ <li>5xx, 429, a failed span and a failed message are bad.</li>
331
+ <li>Other 4xx (the client's mistake): {{ clientErrors(d.definition) }}.</li>
332
+ <li>408 and 499 (the client gave up): {{ d.definition.cancellations === 'Bad' ? 'counted as bad' : 'not counted' }}.</li>
333
+ <li>Retries: each attempt the service received is its own request.</li>
334
+ @if (d.definition.sli === 'Latency') { <li>Latency counts requests that succeeded: good at {{ d.definition.thresholdMs }} ms or less.</li> }
335
+ </ul>
336
+ </section>
337
+
338
+ <section class="jc-card" data-testid="slo-versions">
339
+ <h2>Versions</h2>
340
+ <table class="jc-table">
341
+ <thead><tr><th>Version</th><th>Objective</th><th>From</th><th>Status</th><th>Loaded</th></tr></thead>
342
+ <tbody>
343
+ @for (v of d.versions; track v.version) {
344
+ <tr [attr.data-testid]="'slo-version-' + v.version">
345
+ <td>{{ v.version }}</td><td>{{ objective(v.definition) }}</td><td class="jc-nowrap">{{ v.effectiveFrom | date: 'MMM d, HH:mm' }}</td>
346
+ <td>{{ v.status }}</td><td class="jc-small">{{ v.createdAt | date: 'MMM d, HH:mm' }} by {{ v.createdBy }}</td>
347
+ </tr>
348
+ }
349
+ </tbody>
350
+ </table>
351
+ <p class="jc-muted jc-small">Each minute is counted under the version in effect then, so a new objective doesn't rewrite the past.</p>
352
+ </section>
353
+ }
354
+ `
355
+ }]
356
+ }],
357
+ propDecorators: { key: [{
358
+ type: i0.Input,
359
+ args: [{
360
+ isSignal: true,
361
+ alias: "key",
362
+ required: true
363
+ }]
364
+ }] }
365
+ });
366
+ export { SloPage };
367
+
368
+ //# sourceMappingURL=juice-js-observability-slo.page-DZGsui_P.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"juice-js-observability-slo.page-DZGsui_P.mjs","names":[],"sources":["../../../../projects/juice-js/observability/src/lib/pages/slo.page.ts"],"sourcesContent":["import { DatePipe } from '@angular/common';\nimport { ChangeDetectionStrategy, Component, computed, inject, input } from '@angular/core';\nimport { MatProgressBarModule } from '@angular/material/progress-bar';\nimport { RouterLink } from '@angular/router';\nimport { ApiService } from '../core/api.service';\nimport { ContextService } from '../core/context.service';\nimport { SloDay, SloDefinition, SloSummary } from '../core/models';\nimport { LinkPipe } from '../core/options';\nimport { apiResource } from '../shared/resource';\nimport { problemText } from '../shared/telemetry';\nimport { ContextBar } from '../shared/ui';\nimport { burnText, objective, percent, sloState, times } from './slos.page';\n\nconst WINDOWS: Record<string, string> = { '5m': '5 minutes', '30m': '30 minutes', '1h': '1 hour', '6h': '6 hours', '3d': '3 days' };\n\n/**\n * One SLO (roadmap Phase 9): its budget over the last 30 days, how fast it burns in each window, its days, what counts as a request, and its versions.\n * A window with too few requests, or too many minutes that weren't counted, says so instead of a figure.\n */\n@Component({\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [RouterLink, LinkPipe, DatePipe, MatProgressBarModule, ContextBar],\n template: `\n <jc-context-bar>\n <a class=\"jc-crumb\" [routerLink]=\"['slos'] | jcLink\" [queryParams]=\"ctx.keep()\">SLOs</a><span class=\"jc-crumb-sep\">›</span>\n <h1>{{ detail.value()?.slo?.name ?? key() }}</h1>\n </jc-context-bar>\n @if (detail.isLoading() && !detail.value()) { <mat-progress-bar mode=\"indeterminate\" /> }\n @if (detail.error()) { <p class=\"jc-error\">{{ error() }}</p> }\n @if (detail.value(); as d) {\n <p class=\"jc-summary\">\n <span class=\"jc-badge\" [class]=\"state(d.slo.state).css\" data-testid=\"slo-state\">{{ state(d.slo.state).text }}</span>\n <strong>{{ objective(d.slo) }}</strong> · {{ d.slo.category }} · {{ d.slo.service }} in {{ d.slo.environment }} · version {{ d.slo.version }}\n @if (d.slo.pendingVersion) { <span class=\"jc-muted\"> (version {{ d.slo.pendingVersion }} pending)</span> }\n @if (d.slo.retired) { <span class=\"jc-muted\"> · retired</span> }\n </p>\n\n <section class=\"jc-card\" data-testid=\"slo-budget\">\n <h2>Error budget, last 30 days</h2>\n @switch (d.slo.state) {\n @case ('Unknown') {\n <p data-testid=\"slo-budget-unknown\">Only {{ percent(d.slo.coverage, 1) }} of the last 30 days' minutes are counted, so there's no budget to show yet. Minutes that weren't\n read are never taken as good: either counting is still catching up, or telemetry didn't arrive.</p>\n }\n @case ('InsufficientData') {\n <p>{{ d.slo.total.toLocaleString() }} requests in 30 days: too few to say whether the objective is met.</p>\n }\n @default {\n <p><strong>{{ percent(d.slo.attainment, 3) }}</strong> of {{ d.slo.total.toLocaleString() }} requests were good, against an objective of {{ d.slo.target }}%.</p>\n @if ((d.slo.budgetUsed ?? 0) <= 1) {\n <p>{{ percent(d.slo.budgetUsed, 1) }} of the budget is used ({{ d.slo.bad.toLocaleString() }} bad of {{ allowed(d.slo).toLocaleString() }} allowed),\n {{ percent(d.slo.budgetRemaining, 1) }} left.</p>\n } @else {\n <p class=\"jc-bad\">The budget is overspent: {{ d.slo.bad.toLocaleString() }} bad requests against {{ allowed(d.slo).toLocaleString() }} allowed, {{ times(d.slo.budgetUsed!) }} the budget.</p>\n }\n }\n }\n </section>\n\n <section class=\"jc-card\" data-testid=\"slo-burn\">\n <h2>Burn rate</h2>\n <p class=\"jc-muted jc-small\">How fast the budget is being spent: 1× spends it exactly over 30 days. A window needs enough requests, and nearly all its minutes counted.</p>\n <table class=\"jc-table\">\n <thead><tr><th>Window</th><th>Requests</th><th>Good</th><th>Burn rate</th></tr></thead>\n <tbody>\n @for (w of d.slo.burn; track w.name) {\n <tr [attr.data-testid]=\"'slo-burn-' + w.name\">\n <td>{{ windowName(w.name) }}</td><td>{{ w.total.toLocaleString() }}</td><td>{{ percent(w.attainment, 2) }}</td><td>{{ burn(w) }}</td>\n </tr>\n }\n </tbody>\n </table>\n </section>\n\n <section class=\"jc-card\" data-testid=\"slo-days\">\n <h2>By day</h2>\n @if (d.days.length) {\n <table class=\"jc-table\">\n <thead><tr><th>Day</th><th>Requests</th><th>Good</th><th>Left out</th><th>Minutes counted</th></tr></thead>\n <tbody>\n @for (day of daysNewestFirst(d.days); track day.day) {\n <tr>\n <td class=\"jc-nowrap\">{{ day.day | date: 'MMM d' : 'UTC' }}</td>\n <td>{{ day.total.toLocaleString() }}</td>\n <td [class.jc-bad]=\"day.attainment !== null && day.attainment * 100 < d.slo.target\">{{ percent(day.attainment, 3) }}</td>\n <td class=\"jc-small\">{{ excluded(day) }}</td>\n <td [class.jc-bad]=\"day.minutes < day.expectedMinutes && !isToday(day)\">{{ day.minutes }} of {{ day.expectedMinutes }}</td>\n </tr>\n }\n </tbody>\n </table>\n } @else { <p class=\"jc-muted\">Nothing counted yet.</p> }\n </section>\n\n <section class=\"jc-card\" data-testid=\"slo-eligibility\">\n <h2>What counts</h2>\n <ul class=\"jc-small\">\n <li>Requests to <strong>{{ d.definition.service }}</strong> in {{ d.definition.environment }}: its server and consumer spans,\n {{ d.definition.operations.length ? 'only ' + d.definition.operations.join(', ') : 'every operation' }}.</li>\n <li>Never counted: {{ d.definition.excludeOperations.join(', ') || 'nothing' }} (health checks and the like).</li>\n <li>5xx, 429, a failed span and a failed message are bad.</li>\n <li>Other 4xx (the client's mistake): {{ clientErrors(d.definition) }}.</li>\n <li>408 and 499 (the client gave up): {{ d.definition.cancellations === 'Bad' ? 'counted as bad' : 'not counted' }}.</li>\n <li>Retries: each attempt the service received is its own request.</li>\n @if (d.definition.sli === 'Latency') { <li>Latency counts requests that succeeded: good at {{ d.definition.thresholdMs }} ms or less.</li> }\n </ul>\n </section>\n\n <section class=\"jc-card\" data-testid=\"slo-versions\">\n <h2>Versions</h2>\n <table class=\"jc-table\">\n <thead><tr><th>Version</th><th>Objective</th><th>From</th><th>Status</th><th>Loaded</th></tr></thead>\n <tbody>\n @for (v of d.versions; track v.version) {\n <tr [attr.data-testid]=\"'slo-version-' + v.version\">\n <td>{{ v.version }}</td><td>{{ objective(v.definition) }}</td><td class=\"jc-nowrap\">{{ v.effectiveFrom | date: 'MMM d, HH:mm' }}</td>\n <td>{{ v.status }}</td><td class=\"jc-small\">{{ v.createdAt | date: 'MMM d, HH:mm' }} by {{ v.createdBy }}</td>\n </tr>\n }\n </tbody>\n </table>\n <p class=\"jc-muted jc-small\">Each minute is counted under the version in effect then, so a new objective doesn't rewrite the past.</p>\n </section>\n }\n `,\n})\nexport class SloPage {\n readonly key = input.required<string>();\n protected readonly ctx = inject(ContextService);\n private readonly api = inject(ApiService);\n protected readonly detail = apiResource({ params: () => this.key(), stream: ({ params }) => this.api.slo(params) });\n protected readonly error = computed(() => problemText(this.detail.error()));\n protected readonly objective = objective;\n protected readonly percent = percent;\n protected readonly burn = burnText;\n\n protected readonly state = sloState;\n protected readonly times = times;\n protected windowName(name: string) { return WINDOWS[name] ?? name; }\n /** The API's allowance: each version's requests at its own target, so it agrees with the budget used. */\n protected allowed(s: SloSummary) { return Math.round(s.budgetAllowed); }\n protected daysNewestFirst(days: SloDay[]) { return [...days].reverse(); }\n protected isToday(day: SloDay) { return day.day.slice(0, 10) === new Date().toISOString().slice(0, 10); }\n protected excluded(day: SloDay) {\n const parts = [[day.excludedHealth, 'health checks'], [day.excludedCancelled, 'given up'], [day.excludedClientErrors, 'client errors']]\n .filter(([n]) => (n as number) > 0).map(([n, what]) => `${(n as number).toLocaleString()} ${what}`);\n return parts.length ? parts.join(', ') : '—';\n }\n protected clientErrors(d: SloDefinition) { return d.clientErrors === 'Bad' ? 'bad' : d.clientErrors === 'Exclude' ? 'not counted' : 'counted as good'; }\n}\n"],"mappings":";;;;;;;;;AAaA,MAAM,UAA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1E,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuGX,CAAA"}
@@ -0,0 +1,267 @@
1
+ import { ApiService, ContextService, LinkPipe } from "./juice-js-observability.mjs";
2
+ import { c as ContextBar, h as apiResource, o as problemText } from "./juice-js-observability-telemetry-DVwUTHSz.mjs";
3
+ import * as i0 from "@angular/core";
4
+ import { ChangeDetectionStrategy, Component, computed, inject } from "@angular/core";
5
+ import { RouterLink } from "@angular/router";
6
+ import { NgTemplateOutlet } from "@angular/common";
7
+ import * as i1 from "@angular/material/progress-bar";
8
+ import { MatProgressBarModule } from "@angular/material/progress-bar";
9
+ const SLO_STATES = {
10
+ Met: {
11
+ text: "Met",
12
+ css: "jc-health-healthy"
13
+ },
14
+ AtRisk: {
15
+ text: "At risk",
16
+ css: "jc-health-degraded"
17
+ },
18
+ Exhausted: {
19
+ text: "Budget exhausted",
20
+ css: "jc-health-unhealthy"
21
+ },
22
+ InsufficientData: {
23
+ text: "Not enough data",
24
+ css: "jc-health-none"
25
+ },
26
+ Unknown: {
27
+ text: "Unknown",
28
+ css: "jc-health-none"
29
+ }
30
+ };
31
+ function percent(ratio, digits = 2) {
32
+ return ratio === null || ratio === void 0 ? "—" : `${(ratio * 100).toFixed(digits)}%`;
33
+ }
34
+ function objective(s) {
35
+ return s.sli === "Latency" ? `${s.target}% within ${s.thresholdMs} ms` : `${s.target}% available`;
36
+ }
37
+ function sloState(name) {
38
+ return SLO_STATES[name] ?? {
39
+ text: name,
40
+ css: "jc-health-none"
41
+ };
42
+ }
43
+ function times(used) {
44
+ return `${used >= 10 ? Math.round(used).toLocaleString() : used.toFixed(1)}×`;
45
+ }
46
+ function burnText(w) {
47
+ if (!w) return "—";
48
+ if (w.state === "Unknown") return "unknown";
49
+ if (w.state === "InsufficientData") return "too few requests";
50
+ return `${(w.burnRate ?? 0).toFixed(1)}×`;
51
+ }
52
+ var SlosPage = class SlosPage {
53
+ ctx = inject(ContextService);
54
+ api = inject(ApiService);
55
+ data = apiResource({
56
+ params: () => true,
57
+ stream: () => this.api.slos()
58
+ });
59
+ all = computed(() => this.data.value()?.items ?? [], ...ngDevMode ? [{ debugName: "all" }] : /* istanbul ignore next */ []);
60
+ technical = computed(() => this.all().filter((s) => s.category === "Technical"), ...ngDevMode ? [{ debugName: "technical" }] : /* istanbul ignore next */ []);
61
+ business = computed(() => this.all().filter((s) => s.category === "Business"), ...ngDevMode ? [{ debugName: "business" }] : /* istanbul ignore next */ []);
62
+ error = computed(() => problemText(this.data.error()), ...ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []);
63
+ objective = objective;
64
+ percent = percent;
65
+ state = sloState;
66
+ times = times;
67
+ burn(s, name) {
68
+ return burnText(s.burn.find((w) => w.name === name));
69
+ }
70
+ meter(remaining) {
71
+ return Math.max(0, Math.min(100, remaining * 100));
72
+ }
73
+ static ɵfac = i0.ɵɵngDeclareFactory({
74
+ minVersion: "12.0.0",
75
+ version: "22.2.4",
76
+ ngImport: i0,
77
+ type: SlosPage,
78
+ deps: [],
79
+ target: i0.ɵɵFactoryTarget.Component
80
+ });
81
+ static ɵcmp = i0.ɵɵngDeclareComponent({
82
+ minVersion: "17.0.0",
83
+ version: "22.2.4",
84
+ type: SlosPage,
85
+ isStandalone: true,
86
+ selector: "ng-component",
87
+ ngImport: i0,
88
+ template: `
89
+ <jc-context-bar><h1>SLOs</h1></jc-context-bar>
90
+ @if (data.isLoading()) { <mat-progress-bar mode="indeterminate" /> }
91
+ @if (data.error()) { <p class="jc-error">{{ error() }}</p> }
92
+
93
+ <section class="jc-card" data-testid="slos-technical">
94
+ <h2>Technical</h2>
95
+ <p class="jc-muted jc-small">Availability and latency of services, from their requests over the last 30 days. Defined in the deployment's SLO file.</p>
96
+ <ng-container *ngTemplateOutlet="table; context: { $implicit: technical() }" />
97
+ @if (!technical().length && !data.isLoading()) { <p class="jc-muted" data-testid="slos-none">No technical SLOs are defined: add them to the file named by <code>Slos:File</code>.</p> }
98
+ </section>
99
+
100
+ <section class="jc-card" data-testid="slos-business">
101
+ <h2>Business</h2>
102
+ @if (business().length) {
103
+ <ng-container *ngTemplateOutlet="table; context: { $implicit: business() }" />
104
+ } @else {
105
+ <p class="jc-muted">No business SLOs yet. Business measures (a business success rate, message processing, queue latency, data freshness) are kept apart from
106
+ technical ones, and come in a later version.</p>
107
+ }
108
+ </section>
109
+
110
+ <ng-template #table let-items>
111
+ @if (items.length) {
112
+ <table class="jc-table">
113
+ <thead><tr><th>SLO</th><th>Objective</th><th>State</th><th>Last 30 days</th><th>Budget left</th><th>Burn, 1 h</th><th>Burn, 6 h</th></tr></thead>
114
+ <tbody>
115
+ @for (s of items; track s.key) {
116
+ <tr [attr.data-testid]="'slo-' + s.key">
117
+ <td><a [routerLink]="['slos', s.key] | jcLink" [queryParams]="ctx.keep()">{{ s.name }}</a>
118
+ <div class="jc-muted jc-small">{{ s.service }} · {{ s.environment }}@if (s.pendingVersion) { · version {{ s.pendingVersion }} pending }</div></td>
119
+ <td>{{ objective(s) }}</td>
120
+ <td><span class="jc-badge" [class]="state(s.state).css" data-testid="slo-state">{{ state(s.state).text }}</span></td>
121
+ <td>{{ percent(s.attainment, 3) }}<div class="jc-muted jc-small">{{ s.total.toLocaleString() }} requests</div></td>
122
+ <td data-testid="slo-budget-left">@if (s.budgetRemaining !== null && s.budgetUsed !== null) {
123
+ @if (s.budgetRemaining >= 0) { <div class="jc-meter"><span [style.width.%]="meter(s.budgetRemaining)"></span></div>{{ percent(s.budgetRemaining, 0) }} }
124
+ @else { <span class="jc-bad">none: overspent {{ times(s.budgetUsed) }}</span> }
125
+ } @else { — }</td>
126
+ <td>{{ burn(s, '1h') }}</td>
127
+ <td>{{ burn(s, '6h') }}</td>
128
+ </tr>
129
+ }
130
+ </tbody>
131
+ </table>
132
+ }
133
+ </ng-template>
134
+ `,
135
+ isInline: true,
136
+ styles: [".jc-meter{display:inline-block;width:64px;height:6px;margin-right:8px;border-radius:3px;background:var(--jc-border, rgba(127,127,127,.25));vertical-align:middle;overflow:hidden}.jc-meter span{display:block;height:100%;background:currentColor}\n"],
137
+ dependencies: [
138
+ {
139
+ kind: "directive",
140
+ type: NgTemplateOutlet,
141
+ selector: "[ngTemplateOutlet]",
142
+ inputs: [
143
+ "ngTemplateOutletContext",
144
+ "ngTemplateOutlet",
145
+ "ngTemplateOutletInjector"
146
+ ]
147
+ },
148
+ {
149
+ kind: "directive",
150
+ type: RouterLink,
151
+ selector: "[routerLink]",
152
+ inputs: [
153
+ "target",
154
+ "queryParams",
155
+ "fragment",
156
+ "queryParamsHandling",
157
+ "state",
158
+ "info",
159
+ "relativeTo",
160
+ "preserveFragment",
161
+ "skipLocationChange",
162
+ "replaceUrl",
163
+ "browserUrl",
164
+ "routerLink"
165
+ ]
166
+ },
167
+ {
168
+ kind: "ngmodule",
169
+ type: MatProgressBarModule
170
+ },
171
+ {
172
+ kind: "component",
173
+ type: i1.MatProgressBar,
174
+ selector: "mat-progress-bar",
175
+ inputs: [
176
+ "color",
177
+ "value",
178
+ "bufferValue",
179
+ "mode"
180
+ ],
181
+ outputs: ["animationEnd"],
182
+ exportAs: ["matProgressBar"]
183
+ },
184
+ {
185
+ kind: "component",
186
+ type: ContextBar,
187
+ selector: "jc-context-bar"
188
+ },
189
+ {
190
+ kind: "pipe",
191
+ type: LinkPipe,
192
+ name: "jcLink"
193
+ }
194
+ ],
195
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
196
+ });
197
+ };
198
+ i0.ɵɵngDeclareClassMetadata({
199
+ minVersion: "12.0.0",
200
+ version: "22.2.4",
201
+ ngImport: i0,
202
+ type: SlosPage,
203
+ decorators: [{
204
+ type: Component,
205
+ args: [{
206
+ changeDetection: ChangeDetectionStrategy.OnPush,
207
+ imports: [
208
+ NgTemplateOutlet,
209
+ RouterLink,
210
+ LinkPipe,
211
+ MatProgressBarModule,
212
+ ContextBar
213
+ ],
214
+ template: `
215
+ <jc-context-bar><h1>SLOs</h1></jc-context-bar>
216
+ @if (data.isLoading()) { <mat-progress-bar mode="indeterminate" /> }
217
+ @if (data.error()) { <p class="jc-error">{{ error() }}</p> }
218
+
219
+ <section class="jc-card" data-testid="slos-technical">
220
+ <h2>Technical</h2>
221
+ <p class="jc-muted jc-small">Availability and latency of services, from their requests over the last 30 days. Defined in the deployment's SLO file.</p>
222
+ <ng-container *ngTemplateOutlet="table; context: { $implicit: technical() }" />
223
+ @if (!technical().length && !data.isLoading()) { <p class="jc-muted" data-testid="slos-none">No technical SLOs are defined: add them to the file named by <code>Slos:File</code>.</p> }
224
+ </section>
225
+
226
+ <section class="jc-card" data-testid="slos-business">
227
+ <h2>Business</h2>
228
+ @if (business().length) {
229
+ <ng-container *ngTemplateOutlet="table; context: { $implicit: business() }" />
230
+ } @else {
231
+ <p class="jc-muted">No business SLOs yet. Business measures (a business success rate, message processing, queue latency, data freshness) are kept apart from
232
+ technical ones, and come in a later version.</p>
233
+ }
234
+ </section>
235
+
236
+ <ng-template #table let-items>
237
+ @if (items.length) {
238
+ <table class="jc-table">
239
+ <thead><tr><th>SLO</th><th>Objective</th><th>State</th><th>Last 30 days</th><th>Budget left</th><th>Burn, 1 h</th><th>Burn, 6 h</th></tr></thead>
240
+ <tbody>
241
+ @for (s of items; track s.key) {
242
+ <tr [attr.data-testid]="'slo-' + s.key">
243
+ <td><a [routerLink]="['slos', s.key] | jcLink" [queryParams]="ctx.keep()">{{ s.name }}</a>
244
+ <div class="jc-muted jc-small">{{ s.service }} · {{ s.environment }}@if (s.pendingVersion) { · version {{ s.pendingVersion }} pending }</div></td>
245
+ <td>{{ objective(s) }}</td>
246
+ <td><span class="jc-badge" [class]="state(s.state).css" data-testid="slo-state">{{ state(s.state).text }}</span></td>
247
+ <td>{{ percent(s.attainment, 3) }}<div class="jc-muted jc-small">{{ s.total.toLocaleString() }} requests</div></td>
248
+ <td data-testid="slo-budget-left">@if (s.budgetRemaining !== null && s.budgetUsed !== null) {
249
+ @if (s.budgetRemaining >= 0) { <div class="jc-meter"><span [style.width.%]="meter(s.budgetRemaining)"></span></div>{{ percent(s.budgetRemaining, 0) }} }
250
+ @else { <span class="jc-bad">none: overspent {{ times(s.budgetUsed) }}</span> }
251
+ } @else { — }</td>
252
+ <td>{{ burn(s, '1h') }}</td>
253
+ <td>{{ burn(s, '6h') }}</td>
254
+ </tr>
255
+ }
256
+ </tbody>
257
+ </table>
258
+ }
259
+ </ng-template>
260
+ `,
261
+ styles: [".jc-meter{display:inline-block;width:64px;height:6px;margin-right:8px;border-radius:3px;background:var(--jc-border, rgba(127,127,127,.25));vertical-align:middle;overflow:hidden}.jc-meter span{display:block;height:100%;background:currentColor}\n"]
262
+ }]
263
+ }]
264
+ });
265
+ export { SlosPage, burnText, objective, percent, sloState, times };
266
+
267
+ //# sourceMappingURL=juice-js-observability-slos.page-DNG6g6_R.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"juice-js-observability-slos.page-DNG6g6_R.mjs","names":[],"sources":["../../../../projects/juice-js/observability/src/lib/pages/slos.page.ts"],"sourcesContent":["import { NgTemplateOutlet } from '@angular/common';\nimport { ChangeDetectionStrategy, Component, computed, inject } from '@angular/core';\nimport { MatProgressBarModule } from '@angular/material/progress-bar';\nimport { RouterLink } from '@angular/router';\nimport { ApiService } from '../core/api.service';\nimport { ContextService } from '../core/context.service';\nimport { SloSummary, SloWindow } from '../core/models';\nimport { LinkPipe } from '../core/options';\nimport { apiResource } from '../shared/resource';\nimport { problemText } from '../shared/telemetry';\nimport { ContextBar } from '../shared/ui';\n\n/** How a state reads, and how its badge looks. */\nexport const SLO_STATES: Record<string, { text: string; css: string }> = {\n Met: { text: 'Met', css: 'jc-health-healthy' },\n AtRisk: { text: 'At risk', css: 'jc-health-degraded' },\n Exhausted: { text: 'Budget exhausted', css: 'jc-health-unhealthy' },\n InsufficientData: { text: 'Not enough data', css: 'jc-health-none' },\n Unknown: { text: 'Unknown', css: 'jc-health-none' },\n};\n\n/** `99.5` → `99.5%`; an attainment ratio → percent with enough decimals to see it move. */\nexport function percent(ratio: number | null | undefined, digits = 2): string {\n return ratio === null || ratio === undefined ? '—' : `${(ratio * 100).toFixed(digits)}%`;\n}\n\nexport function objective(s: { sli: string; target: number; thresholdMs: number | null }): string {\n return s.sli === 'Latency' ? `${s.target}% within ${s.thresholdMs} ms` : `${s.target}% available`;\n}\n\n/** A state's badge text and class; an unknown name shows as itself. */\nexport function sloState(name: string): { text: string; css: string } {\n return SLO_STATES[name] ?? { text: name, css: 'jc-health-none' };\n}\n\n/** How many times over the budget is: `3.5×`, `91×`. */\nexport function times(used: number): string {\n return `${used >= 10 ? Math.round(used).toLocaleString() : used.toFixed(1)}×`;\n}\n\nexport function burnText(w: SloWindow | undefined): string {\n if (!w) return '—';\n if (w.state === 'Unknown') return 'unknown';\n if (w.state === 'InsufficientData') return 'too few requests';\n return `${(w.burnRate ?? 0).toFixed(1)}×`;\n}\n\n/**\n * Service level objectives (roadmap Phase 9), as the deployment's file defines them: technical ones (availability, latency) and business ones apart.\n * Missing data never reads as good: an SLO without enough counted minutes or requests says so instead of showing a budget.\n */\n@Component({\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [NgTemplateOutlet, RouterLink, LinkPipe, MatProgressBarModule, ContextBar],\n template: `\n <jc-context-bar><h1>SLOs</h1></jc-context-bar>\n @if (data.isLoading()) { <mat-progress-bar mode=\"indeterminate\" /> }\n @if (data.error()) { <p class=\"jc-error\">{{ error() }}</p> }\n\n <section class=\"jc-card\" data-testid=\"slos-technical\">\n <h2>Technical</h2>\n <p class=\"jc-muted jc-small\">Availability and latency of services, from their requests over the last 30 days. Defined in the deployment's SLO file.</p>\n <ng-container *ngTemplateOutlet=\"table; context: { $implicit: technical() }\" />\n @if (!technical().length && !data.isLoading()) { <p class=\"jc-muted\" data-testid=\"slos-none\">No technical SLOs are defined: add them to the file named by <code>Slos:File</code>.</p> }\n </section>\n\n <section class=\"jc-card\" data-testid=\"slos-business\">\n <h2>Business</h2>\n @if (business().length) {\n <ng-container *ngTemplateOutlet=\"table; context: { $implicit: business() }\" />\n } @else {\n <p class=\"jc-muted\">No business SLOs yet. Business measures (a business success rate, message processing, queue latency, data freshness) are kept apart from\n technical ones, and come in a later version.</p>\n }\n </section>\n\n <ng-template #table let-items>\n @if (items.length) {\n <table class=\"jc-table\">\n <thead><tr><th>SLO</th><th>Objective</th><th>State</th><th>Last 30 days</th><th>Budget left</th><th>Burn, 1 h</th><th>Burn, 6 h</th></tr></thead>\n <tbody>\n @for (s of items; track s.key) {\n <tr [attr.data-testid]=\"'slo-' + s.key\">\n <td><a [routerLink]=\"['slos', s.key] | jcLink\" [queryParams]=\"ctx.keep()\">{{ s.name }}</a>\n <div class=\"jc-muted jc-small\">{{ s.service }} · {{ s.environment }}@if (s.pendingVersion) { · version {{ s.pendingVersion }} pending }</div></td>\n <td>{{ objective(s) }}</td>\n <td><span class=\"jc-badge\" [class]=\"state(s.state).css\" data-testid=\"slo-state\">{{ state(s.state).text }}</span></td>\n <td>{{ percent(s.attainment, 3) }}<div class=\"jc-muted jc-small\">{{ s.total.toLocaleString() }} requests</div></td>\n <td data-testid=\"slo-budget-left\">@if (s.budgetRemaining !== null && s.budgetUsed !== null) {\n @if (s.budgetRemaining >= 0) { <div class=\"jc-meter\"><span [style.width.%]=\"meter(s.budgetRemaining)\"></span></div>{{ percent(s.budgetRemaining, 0) }} }\n @else { <span class=\"jc-bad\">none: overspent {{ times(s.budgetUsed) }}</span> }\n } @else { — }</td>\n <td>{{ burn(s, '1h') }}</td>\n <td>{{ burn(s, '6h') }}</td>\n </tr>\n }\n </tbody>\n </table>\n }\n </ng-template>\n `,\n styles: [`\n .jc-meter { display: inline-block; width: 64px; height: 6px; margin-right: 8px; border-radius: 3px; background: var(--jc-border, rgba(127,127,127,.25)); vertical-align: middle; overflow: hidden; }\n .jc-meter span { display: block; height: 100%; background: currentColor; }\n `],\n})\nexport class SlosPage {\n protected readonly ctx = inject(ContextService);\n private readonly api = inject(ApiService);\n protected readonly data = apiResource({ params: () => true, stream: () => this.api.slos() });\n private readonly all = computed(() => this.data.value()?.items ?? []);\n protected readonly technical = computed(() => this.all().filter(s => s.category === 'Technical'));\n protected readonly business = computed(() => this.all().filter(s => s.category === 'Business'));\n protected readonly error = computed(() => problemText(this.data.error()));\n protected readonly objective = objective;\n protected readonly percent = percent;\n\n protected readonly state = sloState;\n protected readonly times = times;\n protected burn(s: SloSummary, name: string) { return burnText(s.burn.find(w => w.name === name)); }\n protected meter(remaining: number) { return Math.max(0, Math.min(100, remaining * 100)); }\n}\n"],"mappings":";;;;;;;;AAaA,MAAa,aAA4D;CACvE,KAAK;EAAE,MAAM;EAAO,KAAK;CAAmB;CAC5C,QAAQ;EAAE,MAAM;EAAW,KAAK;CAAoB;CACpD,WAAW;EAAE,MAAM;EAAoB,KAAK;CAAqB;CACjE,kBAAkB;EAAE,MAAM;EAAmB,KAAK;CAAgB;CAClE,SAAS;EAAE,MAAM;EAAW,KAAK;CAAgB;AAClD;AAGD,SAAgB,QAAQ,OAAkC,SAAS,GAAC;CAClE,OAAO,UAAU,QAAQ,UAAU,SAAY,MAAM,IAAI,QAAQ,IAAA,CAAK,QAAQ,MAAM,EAAC;AACvF;AAEA,SAAgB,UAAU,GAA8D;CACtF,OAAO,EAAE,QAAQ,YAAY,GAAG,EAAE,OAAM,WAAY,EAAE,YAAW,OAAQ,GAAG,EAAE,OAAM;AACtF;AAGA,SAAgB,SAAS,MAAY;CACnC,OAAO,WAAW,SAAS;EAAE,MAAM;EAAM,KAAK;CAAgB;AAChE;AAGA,SAAgB,MAAM,MAAY;CAChC,OAAO,GAAG,QAAQ,KAAK,KAAK,MAAM,IAAI,CAAC,CAAC,eAAc,IAAK,KAAK,QAAQ,CAAC,EAAC;AAC5E;AAEA,SAAgB,SAAS,GAAwB;CAC/C,IAAI,CAAC,GAAG,OAAO;CACf,IAAI,EAAE,UAAU,WAAW,OAAO;CAClC,IAAI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AAA,UAAA;EAAA,UAAA;EAAA,UApDT;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8CT,UAAA;EAAA,QAAA,CAAA,sPAAA;EAAA,cAAA;GAAA;IAAA,MAAA;IAAA,MA/CS;IAAgB,UAAA;IAAA,QAAA;KAAA;KAAA;KAAA;IAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAE;IAAU,UAAA;IAAA,QAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;IAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAY;GAAoB;GAAA;IAAA,MAAA;IAAA,MAAA,GAAA;IAAA,UAAA;IAAA,QAAA;KAAA;KAAA;KAAA;KAAA;IAAA;IAAA,SAAA,CAAA,cAAA;IAAA,UAAA,CAAA,gBAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAE;IAAU,UAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAA1C;IAAQ,MAAA;GAAA;EAAA;EAAA,iBAAA,GAAA,wBAAA;CAAA,CAAA;;AAqDrC,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAQ,YAAA,CAAA;EAvDpB,MAAA;EACkB,MAAA,CAAA;GAAA,iBAAA,wBAAwB;GAAM,SACtC;IAAC;IAAkB;IAAY;IAAU;IAAsB;GAAU;GAAC,UACzE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CT,QAAA,CAAA,sPAAA;EAAA,CAAA"}
@@ -205,6 +205,12 @@ var ApiService = class ApiService {
205
205
  observe: "response"
206
206
  })));
207
207
  }
208
+ slos(category) {
209
+ return this.get("/slos", { category });
210
+ }
211
+ slo(key) {
212
+ return this.get(`/slos/${encodeURIComponent(key)}`);
213
+ }
208
214
  waitingRequests() {
209
215
  return this.get("/action-requests/waiting");
210
216
  }
@@ -663,6 +669,8 @@ const OBSERVABILITY_ROUTES = [
663
669
  page("agents", "Agents", () => import("./juice-js-observability-agents.page-Ch-tBwQO.mjs").then((m) => m.AgentsPage)),
664
670
  page("agents/:id", "Agent", () => import("./juice-js-observability-agent.page-Vb7LDThl.mjs").then((m) => m.AgentPage)),
665
671
  page("approvals", "Approvals", () => import("./juice-js-observability-approvals.page-DBLw-vl1.mjs").then((m) => m.ApprovalsPage)),
672
+ page("slos", "SLOs", () => import("./juice-js-observability-slos.page-DNG6g6_R.mjs").then((m) => m.SlosPage)),
673
+ page("slos/:key", "SLO", () => import("./juice-js-observability-slo.page-DZGsui_P.mjs").then((m) => m.SloPage)),
666
674
  page("timeline", "Timeline", () => import("./juice-js-observability-timeline.page-CFSigOgk.mjs").then((m) => m.TimelinePage)),
667
675
  page("load-runs", "Load runs", () => import("./juice-js-observability-load-runs.page-DVuO4zFp.mjs").then((m) => m.LoadRunsPage))
668
676
  ];
@@ -742,6 +750,12 @@ function observabilityMenus(basePath = "/", order = 1) {
742
750
  icon: "campaign",
743
751
  routerLink: link("notifications")
744
752
  },
753
+ {
754
+ id: "slos",
755
+ label: "SLOs",
756
+ icon: "track_changes",
757
+ routerLink: link("slos")
758
+ },
745
759
  {
746
760
  id: "agents",
747
761
  label: "Agents",
@@ -1 +1 @@
1
- {"version":3,"file":"juice-js-observability.mjs","names":[],"sources":["../../../../projects/juice-js/observability/src/lib/core/api.service.ts","../../../../projects/juice-js/observability/src/lib/core/approval-count.ts","../../../../projects/juice-js/observability/src/lib/core/options.ts","../../../../projects/juice-js/observability/src/lib/core/context.service.ts","../../../../projects/juice-js/observability/src/lib/observability.routes.ts"],"sourcesContent":["import { HttpClient, HttpParams } from '@angular/common/http';\nimport { Injectable, inject, signal } from '@angular/core';\nimport { EMPTY, Observable, expand, map, reduce, shareReplay, switchMap, tap } from 'rxjs';\nimport { OBSERVABILITY_OPTIONS } from './options';\nimport {\n ActionRequest, ActionRequestsWaiting, ActionTarget, Agent, AgentActions, AgentCommand, AgentPackage, EnrollmentToken, AlertDetail, AlertNotifications, Alert, AllowlistEntry, Application, Channel, ChannelTestResult, Delivery, EscalationPolicy, IncidentDetail, IncidentEvent, IncidentSummary, Silence, DependencyEvidence, DependencyStatsPage, DeploymentEnvironment, LoadRun, LoadRunResults, Related, Timeline, Health, LogRecord, MetricInfo, Operation,\n Page, ResourceDetail, ResourceSummary, Rule, SearchHit, Series, Capacity, ServiceStats, Tenant, TelemetryPage, Topology, Trace,\n TraceSummary,\n} from './models';\n\n/**\n * A random UUID v4 for `Idempotency-Key`. Not `crypto.randomUUID()`: browsers offer it only in a secure context (HTTPS or localhost), so it\n * throws on a Console opened over plain HTTP at the machine's address, as the local stack is. `getRandomValues` works everywhere.\n */\nexport function idempotencyKey(): string {\n const b = crypto.getRandomValues(new Uint8Array(16));\n b[6] = (b[6] & 0x0f) | 0x40;\n b[8] = (b[8] & 0x3f) | 0x80;\n const hex = Array.from(b, x => x.toString(16).padStart(2, '0')).join('');\n return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;\n}\n\nexport type Query =Record<string, string | number | boolean | string[] | null | undefined>;\n\n/**\n * The Console's only backend: the Juice API (Console requirements §3). One deployment serves one tenant, the one the\n * signed-in user's token names.\n */\n@Injectable({ providedIn: 'root' })\nexport class ApiService {\n private readonly http = inject(HttpClient);\n private readonly base = `${inject(OBSERVABILITY_OPTIONS).apiBase}/api/v1`;\n\n /** Set once a page has fetched the caller's tenant: the user is signed in, so background calls such as {@link ApprovalCount}'s may start. */\n readonly tenantKnown = signal(false);\n\n /** The caller's tenant, fetched once. */\n readonly tenant$: Observable<Tenant> = this.http.get<Page<Tenant>>(`${this.base}/tenants`).pipe(\n map(page => {\n if (page.items.length === 0) throw new Error('No tenant is authorized for this user.');\n return page.items[0];\n }),\n tap(() => this.tenantKnown.set(true)),\n shareReplay(1),\n );\n\n private get<T>(path: string, query: Query = {}): Observable<T> {\n let params = new HttpParams();\n for (const [key, value] of Object.entries(query)) {\n if (value === null || value === undefined || value === '') continue;\n for (const item of Array.isArray(value) ? value : [value]) params = params.append(key, String(item));\n }\n return this.tenant$.pipe(switchMap(t => this.http.get<T>(`${this.base}/tenants/${t.id}${path}`, { params })));\n }\n\n /** A change. `Idempotency-Key` on what can be retried, so a repeated click or a lost response doesn't do it twice. */\n private send<T>(method: 'POST' | 'PUT' | 'DELETE', path: string, body?: unknown, headers: Record<string, string> = {}): Observable<T> {\n return this.tenant$.pipe(switchMap(t => this.http.request<T>(method, `${this.base}/tenants/${t.id}${path}`, { body, headers })));\n }\n private once<T>(path: string, body: unknown): Observable<T> { return this.send<T>('POST', path, body, { 'Idempotency-Key': idempotencyKey() }); }\n\n /** Every page of a cursor-paged list (bounded: at most `maxPages` requests). */\n private all<T>(path: string, query: Query = {}, maxPages = 25): Observable<Page<T>> {\n let pages = 0;\n return this.get<Page<T>>(path, { ...query, limit: 200 }).pipe(\n expand(page => page.nextCursor && ++pages < maxPages ? this.get<Page<T>>(path, { ...query, limit: 200, cursor: page.nextCursor }) : EMPTY),\n reduce((all, page) => ({ items: [...all.items, ...page.items], nextCursor: page.nextCursor }), { items: [] as T[], nextCursor: null as string | null }),\n );\n }\n\n environments() { return this.get<Page<DeploymentEnvironment>>('/environments'); }\n applications() { return this.get<Page<Application>>('/applications', { limit: 200 }); }\n resources(type?: string) { return this.all<ResourceSummary>('/resources', { type }); }\n resource(id: string) { return this.get<ResourceDetail>(`/resources/${id}`); }\n health(query: Query) { return this.all<Health>('/health', query); }\n topology(environment?: string | null) { return this.get<Topology>('/topology', { environment }); }\n\n rules() { return this.get<Page<Rule>>('/rules', { limit: 200 }); }\n createRule(definition: unknown) { return this.send<Rule>('POST', '/rules', definition); }\n /** With the rule's etag, so a change made since it was read isn't overwritten. */\n updateRule(key: string, definition: unknown, etag: string) { return this.send<Rule>('PUT', `/rules/${key}`, definition, { 'If-Match': `\"${etag}\"` }); }\n\n channels() { return this.get<Page<Channel>>('/webhooks'); }\n createChannel(body: unknown) { return this.send<Channel>('POST', '/webhooks', body); }\n updateChannel(id: string, body: unknown) { return this.send<Channel>('PUT', `/webhooks/${id}`, body); }\n deliveries(id: string, query: Query = {}) { return this.get<Page<Delivery>>(`/webhooks/${id}/deliveries`, { limit: 50, ...query }); }\n testChannel(id: string) { return this.send<ChannelTestResult>('POST', `/webhooks/${id}/test`); }\n retryDelivery(channelId: string, deliveryId: string) { return this.send<Delivery>('POST', `/webhooks/${channelId}/deliveries/${deliveryId}/retry`); }\n allowlist() { return this.get<Page<AllowlistEntry>>('/webhooks/allowlist'); }\n putAllowlist(destination: string, ports: number[]) { return this.send<AllowlistEntry>('PUT', '/webhooks/allowlist', { destination, ports }); }\n removeAllowlist(destination: string) { return this.send<void>('DELETE', `/webhooks/allowlist?destination=${encodeURIComponent(destination)}`); }\n\n escalationPolicies() { return this.get<Page<EscalationPolicy>>('/escalation-policies'); }\n createEscalationPolicy(body: unknown) { return this.send<EscalationPolicy>('POST', '/escalation-policies', body); }\n updateEscalationPolicy(key: string, body: unknown) { return this.send<EscalationPolicy>('PUT', `/escalation-policies/${key}`, body); }\n\n silences(query: Query = {}) { return this.get<Page<Silence>>('/silences', { limit: 200, ...query }); }\n createSilence(body: unknown) { return this.once<Silence>('/silences', body); }\n cancelSilence(id: string) { return this.send<void>('DELETE', `/silences/${id}`); }\n\n incidents(query: Query = {}) { return this.get<Page<IncidentSummary>>('/incidents', { limit: 100, ...query }); }\n incident(id: string) { return this.get<IncidentDetail>(`/incidents/${id}`); }\n createIncident(body: unknown) { return this.once<IncidentSummary>('/incidents', body); }\n moveIncident(id: string, to: string, comment: string) { return this.once<IncidentSummary>(`/incidents/${id}/transitions`, { to, comment }); }\n addIncidentNote(id: string, text: string) { return this.once<IncidentEvent>(`/incidents/${id}/notes`, { text }); }\n removeIncidentAlert(id: string, alertId: string) { return this.send<void>('DELETE', `/incidents/${id}/alerts/${alertId}`); }\n /** Active agents, or with `all` the revoked ones too (at most 500). */\n agents(all = false) { return this.get<Page<Agent>>('/agents', { all: all || null }); }\n agent(id: string) { return this.get<Agent>(`/agents/${id}`); }\n createEnrollmentToken(purpose: string, expiresInMinutes: number) { return this.send<EnrollmentToken>('POST', '/agents/enrollment-tokens', { purpose, expiresInMinutes }); }\n revokeAgent(id: string, reason: string) { return this.send<Agent>('POST', `/agents/${id}/revocation`, { reason }); }\n /** What the agent reported it can run, custom actions included, with what its host permits; the built-ins if it never reported. */\n agentActions(id: string) { return this.get<AgentActions>(`/agents/${id}/actions`); }\n agentPackages() { return this.get<Page<AgentPackage>>('/agents/packages'); }\n /** Idempotent: a repeated click or a lost response signs one command, not two. */\n issueCommand(id: string, action: string, parameters: Record<string, unknown>) { return this.once<AgentCommand>(`/agents/${id}/commands`, { action, parameters }); }\n /** Asks for an action under its approval policy: issued at once when nobody else needs to approve, otherwise waiting. */\n requestAction(agentId: string, action: string, parameters: Record<string, unknown>, reason: string, target: ActionTarget | null = null) {\n return this.once<ActionRequest>(`/agents/${agentId}/action-requests`, { action, parameters, reason, target });\n }\n actionRequests(query: Query = {}) { return this.get<Page<ActionRequest>>('/action-requests', { limit: 100, ...query }); }\n /** A diagnostic bundle's zip (operators and admins; audited). */\n downloadBundle(agentId: string, bundleId: string) {\n return this.tenant$.pipe(switchMap(t => this.http.get(`${this.base}/tenants/${t.id}/agents/${agentId}/bundles/${bundleId}`, { responseType: 'blob', observe: 'response' })));\n }\n /** How many requests wait, and how many of them the signed-in user can decide. */\n waitingRequests() { return this.get<ActionRequestsWaiting>('/action-requests/waiting'); }\n approveRequest(id: string, comment: string) { return this.send<ActionRequest>('POST', `/action-requests/${id}/approval`, { comment }); }\n rejectRequest(id: string, comment: string) { return this.send<ActionRequest>('POST', `/action-requests/${id}/rejection`, { comment }); }\n cancelRequest(id: string) { return this.send<ActionRequest>('POST', `/action-requests/${id}/cancellation`, {}); }\n agentCommands(id: string, cursor?: string | null) { return this.get<Page<AgentCommand>>(`/agents/${id}/commands`, { limit: 25, cursor }); }\n\n alertNotifications(id: string) { return this.get<AlertNotifications>(`/alerts/${id}/notifications`); }\n\n /** One page of alerts, newest first; pass the previous page's `nextCursor` as `cursor` for the next. */\n alerts(query: Query) { return this.get<Page<Alert>>('/alerts', { limit: 100, ...query }); }\n /** Every alert matching the query (bounded, like the other complete lists). */\n allAlerts(query: Query) { return this.all<Alert>('/alerts', query); }\n alert(id: string) { return this.get<AlertDetail>(`/alerts/${id}`); }\n acknowledge(id: string, comment: string): Observable<Alert> {\n return this.tenant$.pipe(switchMap(t => this.http.post<Alert>(`${this.base}/tenants/${t.id}/alerts/${id}/acknowledgement`,\n { comment }, { headers: { 'Idempotency-Key': idempotencyKey() } })));\n }\n\n traces(query: Query) { return this.get<TelemetryPage<TraceSummary>>('/telemetry/traces', query); }\n trace(traceId: string) { return this.get<Trace>(`/telemetry/traces/${traceId}`); }\n logs(query: Query) { return this.get<TelemetryPage<LogRecord>>('/telemetry/logs', query); }\n operations(query: Query) { return this.get<TelemetryPage<Operation>>('/telemetry/operations', query); }\n metrics(query: Query) { return this.get<TelemetryPage<MetricInfo>>('/telemetry/metrics', query); }\n series(query: Query) { return this.get<Series>('/telemetry/metrics/series', query); }\n serviceStats(query: Query) { return this.get<ServiceStats>('/telemetry/service-stats', query); }\n capacity(query: Query) { return this.get<Capacity>('/telemetry/capacity', query); }\n timeline(query: Query) { return this.get<Timeline>('/timeline', query); }\n relatedToAlert(id: string) { return this.get<Related>(`/alerts/${id}/related`); }\n loadRuns(query: Query) { return this.get<Page<LoadRun>>('/load-runs', query); }\n loadRunResults(id: string) { return this.get<LoadRunResults>(`/load-runs/${id}/results`); }\n dependencyStats(query: Query) { return this.get<DependencyStatsPage>('/telemetry/dependencies', query); }\n dependency(id: string, query: Query) { return this.get<DependencyEvidence>(`/telemetry/dependencies/${id}`, query); }\n search(q: string) { return this.get<TelemetryPage<SearchHit>>('/search', { q }); }\n}\n","import { DestroyRef, Injectable, effect, inject, signal, untracked } from '@angular/core';\nimport { NavigationEnd, Router } from '@angular/router';\nimport { Subscription, filter, timer, switchMap } from 'rxjs';\nimport { ApiService } from './api.service';\n\n/**\n * How many action requests wait for the signed-in user to decide, refreshed every 30 seconds from whatever page is open, and at once\n * when a page made or decided one ({@link refresh}). It starts only once a page has fetched the tenant: before that the user may still be\n * signing in, and an early call would fail, along with the page's own call sharing it. It stops on an error (signed out, or no rights)\n * until the next navigation, so a signed-out tab doesn't keep asking.\n */\n@Injectable({ providedIn: 'root' })\nexport class ApprovalCount {\n static readonly Every = 30_000;\n\n private readonly api = inject(ApiService);\n private polling: Subscription | null = null;\n /** Requests the signed-in user can approve or reject now. */\n readonly forYou = signal(0);\n\n constructor() {\n effect(() => { if (this.api.tenantKnown() && !untracked(() => this.polling)) untracked(() => this.start()); });\n const navigations = inject(Router).events.pipe(filter(e => e instanceof NavigationEnd))\n .subscribe(() => { if (!this.polling && this.api.tenantKnown()) this.start(); });\n inject(DestroyRef).onDestroy(() => { navigations.unsubscribe(); this.polling?.unsubscribe(); });\n }\n\n /** Asks again now, for a page that just changed what waits. */\n refresh() { if (this.api.tenantKnown()) this.start(); }\n\n private start() {\n this.polling?.unsubscribe();\n this.polling = timer(0, ApprovalCount.Every).pipe(switchMap(() => this.api.waitingRequests())).subscribe({\n next: w => this.forYou.set(w.forYou),\n error: () => { this.forYou.set(0); this.polling = null; },\n });\n }\n}\n\n/**\n * Shows {@link ApprovalCount} on the Approvals entry of juice-layout's side menu, found by its icon. juice-layout's menu has no badge of its\n * own, so this adds one beside the label and puts it back whenever the menu is drawn again.\n */\n@Injectable({ providedIn: 'root' })\nexport class ApprovalMenuBadge {\n static readonly Icon = 'approval';\n\n private readonly count = inject(ApprovalCount);\n private observer: MutationObserver | null = null;\n\n constructor() {\n if (typeof document === 'undefined' || typeof MutationObserver === 'undefined') return;\n effect(() => this.apply(this.count.forYou()));\n let scheduled = false;\n this.observer = new MutationObserver(() => {\n if (scheduled) return;\n scheduled = true;\n requestAnimationFrame(() => { scheduled = false; this.apply(this.count.forYou()); });\n });\n this.observer.observe(document.body, { childList: true, subtree: true });\n inject(DestroyRef).onDestroy(() => this.observer?.disconnect());\n }\n\n private apply(count: number) {\n for (const icon of Array.from(document.querySelectorAll<HTMLElement>('juice-nav-menu mat-icon'))) {\n if (icon.textContent?.trim() !== ApprovalMenuBadge.Icon) continue;\n const item = icon.closest<HTMLElement>('mat-list-item, .mat-mdc-list-item');\n const title = item?.querySelector<HTMLElement>('[matListItemTitle], .mdc-list-item__primary-text');\n if (!item || !title) continue;\n let badge = title.querySelector<HTMLElement>('.jc-menu-badge');\n if (count <= 0) { badge?.remove(); item.removeAttribute('title'); continue; }\n if (!badge) {\n badge = document.createElement('span');\n badge.className = 'jc-menu-badge';\n badge.setAttribute('data-testid', 'approvals-badge');\n badge.style.cssText = 'display:inline-block;min-width:1.25rem;margin-left:.5rem;padding:0 .375rem;border-radius:999px;font-size:.75rem;'\n + 'line-height:1.25rem;text-align:center;font-weight:600;background:var(--mat-sys-error,#b3261e);color:var(--mat-sys-on-error,#fff)';\n title.appendChild(badge);\n }\n const text = count > 99 ? '99+' : String(count);\n if (badge.textContent !== text) badge.textContent = text;\n const hint = `${count} request${count === 1 ? '' : 's'} waiting for your approval`;\n if (item.getAttribute('title') !== hint) item.setAttribute('title', hint);\n }\n }\n}\n","import { EnvironmentProviders, Injectable, InjectionToken, Pipe, PipeTransform, inject, makeEnvironmentProviders, provideEnvironmentInitializer } from '@angular/core';\nimport { ApprovalMenuBadge } from './approval-count';\n\n/** How the host app mounts Juice Observability. */\nexport interface ObservabilityOptions {\n /** The Juice API origin; empty when the API serves the app (same origin). */\n apiBase: string;\n /** Where the host mounts {@link OBSERVABILITY_ROUTES}: `/` for the whole app, or a path such as `/observability`. */\n basePath: string;\n /**\n * A link to the audit records of a trace, shown on the trace page: for the Juice Audit pages mounted at `/audit`,\n * `id => ['/audit/traces', id]`. A string is an external URL. Without it, no link.\n */\n auditLink?: ((traceId: string) => unknown[] | string | null) | null;\n /** Show on the Approvals menu entry how many action requests wait for the signed-in user. On unless false. */\n approvalCount?: boolean;\n}\n\nexport const OBSERVABILITY_OPTIONS = new InjectionToken<ObservabilityOptions>('OBSERVABILITY_OPTIONS', {\n providedIn: 'root',\n factory: () => ({ apiBase: '', basePath: '/', auditLink: null }),\n});\n\n/**\n * Configures the pages: where the API is, where the host mounted the routes, and where a trace's audit records open. Also shows the count\n * of requests waiting for approval on the Approvals menu entry, unless `approvalCount: false`.\n */\nexport function provideJuiceObservability(options: Partial<ObservabilityOptions> = {}): EnvironmentProviders {\n return makeEnvironmentProviders([\n {\n provide: OBSERVABILITY_OPTIONS,\n useValue: {\n apiBase: options.apiBase ?? '',\n basePath: options.basePath ?? '/',\n auditLink: options.auditLink ?? null,\n } satisfies ObservabilityOptions,\n },\n ...(options.approvalCount === false ? [] : [provideEnvironmentInitializer(() => { inject(ApprovalMenuBadge); })]),\n ]);\n}\n\n/** `/observability/` → `/observability`; `` and `/` → `/`. */\nexport function normalizeBasePath(basePath: string): string {\n const trimmed = basePath.trim().replace(/^\\/+|\\/+$/g, '');\n return trimmed ? `/${trimmed}` : '/';\n}\n\n/** Router links to the pages, under the host's mount path. */\n@Injectable({ providedIn: 'root' })\nexport class ObservabilityLinks {\n private readonly options = inject(OBSERVABILITY_OPTIONS);\n readonly base = normalizeBasePath(this.options.basePath);\n\n /** `to('services', id)` → `['/observability', 'services', id]`. */\n to(...segments: unknown[]): unknown[] { return [this.base, ...segments]; }\n\n /** The host's link to the audit records of a trace, if it gave one. */\n audit(traceId: string | null | undefined): { route: unknown[] } | { href: string } | null {\n if (!traceId || !this.options.auditLink) return null;\n const link = this.options.auditLink(traceId);\n if (!link) return null;\n return typeof link === 'string' ? { href: link } : { route: link };\n }\n}\n\n/** `['services', id] | jcLink`: the same as {@link ObservabilityLinks.to} in a template. */\n@Pipe({ name: 'jcLink' })\nexport class LinkPipe implements PipeTransform {\n private readonly links = inject(ObservabilityLinks);\n transform(segments: unknown[]): unknown[] { return this.links.to(...segments); }\n}\n","import { Injectable, computed, inject } from '@angular/core';\nimport { toSignal } from '@angular/core/rxjs-interop';\nimport { ActivatedRoute, NavigationEnd, Params, Router } from '@angular/router';\nimport { filter, map, startWith } from 'rxjs';\n\nexport const RANGES: Record<string, number> = {\n '15m': 15 * 60_000, '1h': 3_600_000, '6h': 6 * 3_600_000, '24h': 24 * 3_600_000, '7d': 7 * 24 * 3_600_000,\n};\n\n/** Search ranges are at most 24 hours (the API's bound); series and operations take up to 7 days. */\nexport const MAX_SEARCH_MS = RANGES['24h'];\n\n/**\n * The investigation context that follows the user between pages (Console requirements §17): environment and time\n * range. It lives in the URL (`env`, and `range` or `from`/`to`), so every page is a deep link and the browser's back\n * button restores it.\n */\n@Injectable({ providedIn: 'root' })\nexport class ContextService {\n private readonly router = inject(Router);\n\n // Created on first use, after the first navigation may already have ended: start from the current URL.\n private readonly params = toSignal(this.router.events.pipe(\n filter(e => e instanceof NavigationEnd),\n startWith(null),\n map(() => this.leaf().snapshot.queryParams),\n ), { initialValue: {} as Params });\n\n readonly environment = computed(() => (this.params()['env'] as string | undefined) ?? '');\n readonly range = computed(() => {\n const p = this.params();\n return p['from'] && p['to'] ? 'custom' : ((p['range'] as string | undefined) ?? '1h');\n });\n readonly absolute = computed(() => {\n const p = this.params();\n return p['from'] && p['to'] ? { from: p['from'] as string, to: p['to'] as string } : null;\n });\n\n /** The window as ISO strings, evaluated now for a relative range. */\n window(maxMs?: number): { from: string; to: string } {\n const absolute = this.absolute();\n if (absolute) return absolute;\n const to = Date.now();\n const span = Math.min(RANGES[this.range()] ?? RANGES['1h'], maxMs ?? Number.MAX_SAFE_INTEGER);\n return { from: new Date(to - span).toISOString(), to: new Date(to).toISOString() };\n }\n\n /** Query parameters for a link: the context plus the target page's own. */\n keep(extra: Params = {}): Params {\n const p = this.params();\n const context: Params = {};\n for (const key of ['env', 'range', 'from', 'to']) if (p[key]) context[key] = p[key];\n return { ...context, ...extra };\n }\n\n /** Changes the context on the current page, keeping its other parameters. */\n set(change: { env?: string | null; range?: string | null; from?: string | null; to?: string | null }) {\n const queryParams: Params = { ...change };\n if (change.range) Object.assign(queryParams, { from: null, to: null });\n void this.router.navigate([], { relativeTo: this.leaf(), queryParams, queryParamsHandling: 'merge' });\n }\n\n /** A time window centred on a moment, for \"around this span\" links. */\n around(at: string, durationMs: number, paddingMs = 5 * 60_000): Params {\n const start = new Date(at).getTime();\n return this.keep({\n from: new Date(start - paddingMs).toISOString(),\n to: new Date(start + durationMs + paddingMs).toISOString(),\n range: null,\n });\n }\n\n private leaf(): ActivatedRoute {\n let route = this.router.routerState.root;\n while (route.firstChild) route = route.firstChild;\n return route;\n }\n}\n","import { Routes } from '@angular/router';\nimport { Menus } from '@juice-js/core';\nimport { normalizeBasePath } from './core/options';\n\nfunction page(path: string, title: string, load: Routes[number]['loadComponent']): Routes[number] {\n return { path, title: `${title} · Juice Observability`, loadComponent: load };\n}\n\n/**\n * The pages, investigation first (Console requirements §4): services, traces, topology, logs and metrics; alerts and\n * rules after. Detail pages are deep links (§17) and carry the environment and time range in their query parameters.\n * The host mounts them at its `basePath` (see {@link provideJuiceObservability}) and adds its own guards.\n */\nexport const OBSERVABILITY_ROUTES: Routes = [\n page('', 'Overview', () => import('./pages/overview.page').then(m => m.OverviewPage)),\n page('services', 'Services', () => import('./pages/services.page').then(m => m.ServicesPage)),\n page('services/:id', 'Service', () => import('./pages/service.page').then(m => m.ServicePage)),\n page('traces', 'Traces', () => import('./pages/traces.page').then(m => m.TracesPage)),\n page('traces/:traceId', 'Trace', () => import('./pages/trace.page').then(m => m.TracePage)),\n page('topology', 'Dependencies', () => import('./pages/topology.page').then(m => m.TopologyPage)),\n page('logs', 'Logs', () => import('./pages/logs.page').then(m => m.LogsPage)),\n page('metrics', 'Metrics', () => import('./pages/metrics.page').then(m => m.MetricsPage)),\n page('resources', 'Resources', () => import('./pages/resources.page').then(m => m.ResourcesPage)),\n page('resources/:id', 'Resource', () => import('./pages/resource.page').then(m => m.ResourcePage)),\n page('alerts', 'Alerts', () => import('./pages/alerts.page').then(m => m.AlertsPage)),\n page('alerts/:id', 'Alert', () => import('./pages/alert.page').then(m => m.AlertPage)),\n page('rules', 'Rules', () => import('./pages/rules.page').then(m => m.RulesPage)),\n page('notifications', 'Notifications', () => import('./pages/notifications.page').then(m => m.NotificationsPage)),\n page('silences', 'Silences', () => import('./pages/silences.page').then(m => m.SilencesPage)),\n page('incidents', 'Incidents', () => import('./pages/incidents.page').then(m => m.IncidentsPage)),\n page('incidents/:id', 'Incident', () => import('./pages/incident.page').then(m => m.IncidentPage)),\n page('agents', 'Agents', () => import('./pages/agents.page').then(m => m.AgentsPage)),\n page('agents/:id', 'Agent', () => import('./pages/agent.page').then(m => m.AgentPage)),\n page('approvals', 'Approvals', () => import('./pages/approvals.page').then(m => m.ApprovalsPage)),\n page('timeline', 'Timeline', () => import('./pages/timeline.page').then(m => m.TimelinePage)),\n page('load-runs', 'Load runs', () => import('./pages/load-runs.page').then(m => m.LoadRunsPage)),\n];\n\n/** The side menu entries (juice-layout), investigation pages first, linking under `basePath`. */\nexport function observabilityMenus(basePath = '/', order = 1): Menus {\n const base = normalizeBasePath(basePath);\n const link = (path: string) => (base === '/' ? `/${path}` : path ? `${base}/${path}` : base);\n return [\n { id: 'overview', label: 'Overview', icon: 'dashboard', routerLink: link('') },\n { id: 'services', label: 'Services', icon: 'hub', routerLink: link('services') },\n { id: 'traces', label: 'Traces', icon: 'timeline', routerLink: link('traces') },\n { id: 'topology', label: 'Dependencies', icon: 'account_tree', routerLink: link('topology') },\n { id: 'logs', label: 'Logs', icon: 'notes', routerLink: link('logs') },\n { id: 'metrics', label: 'Metrics', icon: 'show_chart', routerLink: link('metrics') },\n { id: 'resources', label: 'Resources', icon: 'dns', routerLink: link('resources') },\n { id: 'alerts', label: 'Alerts', icon: 'notifications', routerLink: link('alerts') },\n { id: 'incidents', label: 'Incidents', icon: 'emergency', routerLink: link('incidents') },\n { id: 'rules', label: 'Rules', icon: 'rule', routerLink: link('rules') },\n { id: 'silences', label: 'Silences', icon: 'notifications_paused', routerLink: link('silences') },\n { id: 'notifications', label: 'Notifications', icon: 'campaign', routerLink: link('notifications') },\n { id: 'agents', label: 'Agents', icon: 'smart_toy', routerLink: link('agents') },\n { id: 'approvals', label: 'Approvals', icon: 'approval', routerLink: link('approvals') },\n { id: 'timeline', label: 'Timeline', icon: 'history', routerLink: link('timeline') },\n { id: 'load-runs', label: 'Load runs', icon: 'speed', routerLink: link('load-runs') },\n ].map((menu, index) => ({ ...menu, order: order + index }));\n}\n"],"mappings":";;;;;;AAcA,SAAgB,iBAAc;CAC5B,MAAM,IAAI,OAAO,gCAAgB,IAAI,WAAW,EAAE,CAAC;CACnD,EAAE,KAAM,EAAE,KAAK,KAAQ;CACvB,EAAE,KAAM,EAAE,KAAK,KAAQ;CACvB,MAAM,MAAM,MAAM,KAAK,IAAG,MAAK,EAAE,SAAS,EAAE,CAAC,CAAC,SAAS,GAAG,GAAG,CAAC,CAAC,CAAC,KAAK,EAAE;CACvE,OAAO,GAAG,IAAI,MAAM,GAAG,CAAC,EAAC,GAAI,IAAI,MAAM,GAAG,EAAE,EAAC,GAAI,IAAI,MAAM,IAAI,EAAE,EAAC,GAAI,IAAI,MAAM,IAAI,EAAE,EAAC,GAAI,IAAI,MAAM,EAAE;AACzG;AASA,IAAa,aAAb,MAAa,WAAU;CACJ,OAAO,OAAO,UAAU;CACxB,OAAO,GAAG,OAAO,qBAAqB,CAAC,CAAC,QAAO;CAGvD,cAAc,OAAO,OAAM,GAAA,YAAA,CAAA,EAAA,WAAA,cAAA,CAAA,+BAAA,CAAA,CAAA;CAG3B,UAA8B,KAAK,KAAK,IAAkB,GAAG,KAAK,KAAI,SAAU,CAAC,CAAC,KACzF,KAAI,SAAO;EACT,IAAI,KAAK,MAAM,WAAW,GAAG,MAAM,IAAI,MAAM,wCAAwC;EACrF,OAAO,KAAK,MAAM;CACpB,CAAC,GACD,UAAU,KAAK,YAAY,IAAI,IAAI,CAAC,GACpC,YAAY,CAAC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AK,WAAW;EAAC;EACtF;GAAE,IAAI;GAAY,OAAO;GAAY,MAAM;GAAW,YAAY,KAAK,UAAU;EAAC;EAClF;GAAE,IAAI;GAAa,OAAO;GAAa,MAAM;GAAS,YAAY,KAAK,WAAW;EAAC;CACpF,CAAA,CAAC,KAAK,MAAM,WAAW;EAAE,GAAG;EAAM,OAAO,QAAQ;CAAK,EAAG;AAC5D"}
1
+ {"version":3,"file":"juice-js-observability.mjs","names":[],"sources":["../../../../projects/juice-js/observability/src/lib/core/api.service.ts","../../../../projects/juice-js/observability/src/lib/core/approval-count.ts","../../../../projects/juice-js/observability/src/lib/core/options.ts","../../../../projects/juice-js/observability/src/lib/core/context.service.ts","../../../../projects/juice-js/observability/src/lib/observability.routes.ts"],"sourcesContent":["import { HttpClient, HttpParams } from '@angular/common/http';\nimport { Injectable, inject, signal } from '@angular/core';\nimport { EMPTY, Observable, expand, map, reduce, shareReplay, switchMap, tap } from 'rxjs';\nimport { OBSERVABILITY_OPTIONS } from './options';\nimport {\n ActionRequest, ActionRequestsWaiting, ActionTarget, Agent, SloDetail, SloSummary, AgentActions, AgentCommand, AgentPackage, EnrollmentToken, AlertDetail, AlertNotifications, Alert, AllowlistEntry, Application, Channel, ChannelTestResult, Delivery, EscalationPolicy, IncidentDetail, IncidentEvent, IncidentSummary, Silence, DependencyEvidence, DependencyStatsPage, DeploymentEnvironment, LoadRun, LoadRunResults, Related, Timeline, Health, LogRecord, MetricInfo, Operation,\n Page, ResourceDetail, ResourceSummary, Rule, SearchHit, Series, Capacity, ServiceStats, Tenant, TelemetryPage, Topology, Trace,\n TraceSummary,\n} from './models';\n\n/**\n * A random UUID v4 for `Idempotency-Key`. Not `crypto.randomUUID()`: browsers offer it only in a secure context (HTTPS or localhost), so it\n * throws on a Console opened over plain HTTP at the machine's address, as the local stack is. `getRandomValues` works everywhere.\n */\nexport function idempotencyKey(): string {\n const b = crypto.getRandomValues(new Uint8Array(16));\n b[6] = (b[6] & 0x0f) | 0x40;\n b[8] = (b[8] & 0x3f) | 0x80;\n const hex = Array.from(b, x => x.toString(16).padStart(2, '0')).join('');\n return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;\n}\n\nexport type Query =Record<string, string | number | boolean | string[] | null | undefined>;\n\n/**\n * The Console's only backend: the Juice API (Console requirements §3). One deployment serves one tenant, the one the\n * signed-in user's token names.\n */\n@Injectable({ providedIn: 'root' })\nexport class ApiService {\n private readonly http = inject(HttpClient);\n private readonly base = `${inject(OBSERVABILITY_OPTIONS).apiBase}/api/v1`;\n\n /** Set once a page has fetched the caller's tenant: the user is signed in, so background calls such as {@link ApprovalCount}'s may start. */\n readonly tenantKnown = signal(false);\n\n /** The caller's tenant, fetched once. */\n readonly tenant$: Observable<Tenant> = this.http.get<Page<Tenant>>(`${this.base}/tenants`).pipe(\n map(page => {\n if (page.items.length === 0) throw new Error('No tenant is authorized for this user.');\n return page.items[0];\n }),\n tap(() => this.tenantKnown.set(true)),\n shareReplay(1),\n );\n\n private get<T>(path: string, query: Query = {}): Observable<T> {\n let params = new HttpParams();\n for (const [key, value] of Object.entries(query)) {\n if (value === null || value === undefined || value === '') continue;\n for (const item of Array.isArray(value) ? value : [value]) params = params.append(key, String(item));\n }\n return this.tenant$.pipe(switchMap(t => this.http.get<T>(`${this.base}/tenants/${t.id}${path}`, { params })));\n }\n\n /** A change. `Idempotency-Key` on what can be retried, so a repeated click or a lost response doesn't do it twice. */\n private send<T>(method: 'POST' | 'PUT' | 'DELETE', path: string, body?: unknown, headers: Record<string, string> = {}): Observable<T> {\n return this.tenant$.pipe(switchMap(t => this.http.request<T>(method, `${this.base}/tenants/${t.id}${path}`, { body, headers })));\n }\n private once<T>(path: string, body: unknown): Observable<T> { return this.send<T>('POST', path, body, { 'Idempotency-Key': idempotencyKey() }); }\n\n /** Every page of a cursor-paged list (bounded: at most `maxPages` requests). */\n private all<T>(path: string, query: Query = {}, maxPages = 25): Observable<Page<T>> {\n let pages = 0;\n return this.get<Page<T>>(path, { ...query, limit: 200 }).pipe(\n expand(page => page.nextCursor && ++pages < maxPages ? this.get<Page<T>>(path, { ...query, limit: 200, cursor: page.nextCursor }) : EMPTY),\n reduce((all, page) => ({ items: [...all.items, ...page.items], nextCursor: page.nextCursor }), { items: [] as T[], nextCursor: null as string | null }),\n );\n }\n\n environments() { return this.get<Page<DeploymentEnvironment>>('/environments'); }\n applications() { return this.get<Page<Application>>('/applications', { limit: 200 }); }\n resources(type?: string) { return this.all<ResourceSummary>('/resources', { type }); }\n resource(id: string) { return this.get<ResourceDetail>(`/resources/${id}`); }\n health(query: Query) { return this.all<Health>('/health', query); }\n topology(environment?: string | null) { return this.get<Topology>('/topology', { environment }); }\n\n rules() { return this.get<Page<Rule>>('/rules', { limit: 200 }); }\n createRule(definition: unknown) { return this.send<Rule>('POST', '/rules', definition); }\n /** With the rule's etag, so a change made since it was read isn't overwritten. */\n updateRule(key: string, definition: unknown, etag: string) { return this.send<Rule>('PUT', `/rules/${key}`, definition, { 'If-Match': `\"${etag}\"` }); }\n\n channels() { return this.get<Page<Channel>>('/webhooks'); }\n createChannel(body: unknown) { return this.send<Channel>('POST', '/webhooks', body); }\n updateChannel(id: string, body: unknown) { return this.send<Channel>('PUT', `/webhooks/${id}`, body); }\n deliveries(id: string, query: Query = {}) { return this.get<Page<Delivery>>(`/webhooks/${id}/deliveries`, { limit: 50, ...query }); }\n testChannel(id: string) { return this.send<ChannelTestResult>('POST', `/webhooks/${id}/test`); }\n retryDelivery(channelId: string, deliveryId: string) { return this.send<Delivery>('POST', `/webhooks/${channelId}/deliveries/${deliveryId}/retry`); }\n allowlist() { return this.get<Page<AllowlistEntry>>('/webhooks/allowlist'); }\n putAllowlist(destination: string, ports: number[]) { return this.send<AllowlistEntry>('PUT', '/webhooks/allowlist', { destination, ports }); }\n removeAllowlist(destination: string) { return this.send<void>('DELETE', `/webhooks/allowlist?destination=${encodeURIComponent(destination)}`); }\n\n escalationPolicies() { return this.get<Page<EscalationPolicy>>('/escalation-policies'); }\n createEscalationPolicy(body: unknown) { return this.send<EscalationPolicy>('POST', '/escalation-policies', body); }\n updateEscalationPolicy(key: string, body: unknown) { return this.send<EscalationPolicy>('PUT', `/escalation-policies/${key}`, body); }\n\n silences(query: Query = {}) { return this.get<Page<Silence>>('/silences', { limit: 200, ...query }); }\n createSilence(body: unknown) { return this.once<Silence>('/silences', body); }\n cancelSilence(id: string) { return this.send<void>('DELETE', `/silences/${id}`); }\n\n incidents(query: Query = {}) { return this.get<Page<IncidentSummary>>('/incidents', { limit: 100, ...query }); }\n incident(id: string) { return this.get<IncidentDetail>(`/incidents/${id}`); }\n createIncident(body: unknown) { return this.once<IncidentSummary>('/incidents', body); }\n moveIncident(id: string, to: string, comment: string) { return this.once<IncidentSummary>(`/incidents/${id}/transitions`, { to, comment }); }\n addIncidentNote(id: string, text: string) { return this.once<IncidentEvent>(`/incidents/${id}/notes`, { text }); }\n removeIncidentAlert(id: string, alertId: string) { return this.send<void>('DELETE', `/incidents/${id}/alerts/${alertId}`); }\n /** Active agents, or with `all` the revoked ones too (at most 500). */\n agents(all = false) { return this.get<Page<Agent>>('/agents', { all: all || null }); }\n agent(id: string) { return this.get<Agent>(`/agents/${id}`); }\n createEnrollmentToken(purpose: string, expiresInMinutes: number) { return this.send<EnrollmentToken>('POST', '/agents/enrollment-tokens', { purpose, expiresInMinutes }); }\n revokeAgent(id: string, reason: string) { return this.send<Agent>('POST', `/agents/${id}/revocation`, { reason }); }\n /** What the agent reported it can run, custom actions included, with what its host permits; the built-ins if it never reported. */\n agentActions(id: string) { return this.get<AgentActions>(`/agents/${id}/actions`); }\n agentPackages() { return this.get<Page<AgentPackage>>('/agents/packages'); }\n /** Idempotent: a repeated click or a lost response signs one command, not two. */\n issueCommand(id: string, action: string, parameters: Record<string, unknown>) { return this.once<AgentCommand>(`/agents/${id}/commands`, { action, parameters }); }\n /** Asks for an action under its approval policy: issued at once when nobody else needs to approve, otherwise waiting. */\n requestAction(agentId: string, action: string, parameters: Record<string, unknown>, reason: string, target: ActionTarget | null = null) {\n return this.once<ActionRequest>(`/agents/${agentId}/action-requests`, { action, parameters, reason, target });\n }\n actionRequests(query: Query = {}) { return this.get<Page<ActionRequest>>('/action-requests', { limit: 100, ...query }); }\n /** A diagnostic bundle's zip (operators and admins; audited). */\n downloadBundle(agentId: string, bundleId: string) {\n return this.tenant$.pipe(switchMap(t => this.http.get(`${this.base}/tenants/${t.id}/agents/${agentId}/bundles/${bundleId}`, { responseType: 'blob', observe: 'response' })));\n }\n /** SLOs, technical or business apart (category), with their budgets and burn rates. */\n slos(category?: string) { return this.get<Page<SloSummary>>('/slos', { category }); }\n slo(key: string) { return this.get<SloDetail>(`/slos/${encodeURIComponent(key)}`); }\n /** How many requests wait, and how many of them the signed-in user can decide. */\n waitingRequests() { return this.get<ActionRequestsWaiting>('/action-requests/waiting'); }\n approveRequest(id: string, comment: string) { return this.send<ActionRequest>('POST', `/action-requests/${id}/approval`, { comment }); }\n rejectRequest(id: string, comment: string) { return this.send<ActionRequest>('POST', `/action-requests/${id}/rejection`, { comment }); }\n cancelRequest(id: string) { return this.send<ActionRequest>('POST', `/action-requests/${id}/cancellation`, {}); }\n agentCommands(id: string, cursor?: string | null) { return this.get<Page<AgentCommand>>(`/agents/${id}/commands`, { limit: 25, cursor }); }\n\n alertNotifications(id: string) { return this.get<AlertNotifications>(`/alerts/${id}/notifications`); }\n\n /** One page of alerts, newest first; pass the previous page's `nextCursor` as `cursor` for the next. */\n alerts(query: Query) { return this.get<Page<Alert>>('/alerts', { limit: 100, ...query }); }\n /** Every alert matching the query (bounded, like the other complete lists). */\n allAlerts(query: Query) { return this.all<Alert>('/alerts', query); }\n alert(id: string) { return this.get<AlertDetail>(`/alerts/${id}`); }\n acknowledge(id: string, comment: string): Observable<Alert> {\n return this.tenant$.pipe(switchMap(t => this.http.post<Alert>(`${this.base}/tenants/${t.id}/alerts/${id}/acknowledgement`,\n { comment }, { headers: { 'Idempotency-Key': idempotencyKey() } })));\n }\n\n traces(query: Query) { return this.get<TelemetryPage<TraceSummary>>('/telemetry/traces', query); }\n trace(traceId: string) { return this.get<Trace>(`/telemetry/traces/${traceId}`); }\n logs(query: Query) { return this.get<TelemetryPage<LogRecord>>('/telemetry/logs', query); }\n operations(query: Query) { return this.get<TelemetryPage<Operation>>('/telemetry/operations', query); }\n metrics(query: Query) { return this.get<TelemetryPage<MetricInfo>>('/telemetry/metrics', query); }\n series(query: Query) { return this.get<Series>('/telemetry/metrics/series', query); }\n serviceStats(query: Query) { return this.get<ServiceStats>('/telemetry/service-stats', query); }\n capacity(query: Query) { return this.get<Capacity>('/telemetry/capacity', query); }\n timeline(query: Query) { return this.get<Timeline>('/timeline', query); }\n relatedToAlert(id: string) { return this.get<Related>(`/alerts/${id}/related`); }\n loadRuns(query: Query) { return this.get<Page<LoadRun>>('/load-runs', query); }\n loadRunResults(id: string) { return this.get<LoadRunResults>(`/load-runs/${id}/results`); }\n dependencyStats(query: Query) { return this.get<DependencyStatsPage>('/telemetry/dependencies', query); }\n dependency(id: string, query: Query) { return this.get<DependencyEvidence>(`/telemetry/dependencies/${id}`, query); }\n search(q: string) { return this.get<TelemetryPage<SearchHit>>('/search', { q }); }\n}\n","import { DestroyRef, Injectable, effect, inject, signal, untracked } from '@angular/core';\nimport { NavigationEnd, Router } from '@angular/router';\nimport { Subscription, filter, timer, switchMap } from 'rxjs';\nimport { ApiService } from './api.service';\n\n/**\n * How many action requests wait for the signed-in user to decide, refreshed every 30 seconds from whatever page is open, and at once\n * when a page made or decided one ({@link refresh}). It starts only once a page has fetched the tenant: before that the user may still be\n * signing in, and an early call would fail, along with the page's own call sharing it. It stops on an error (signed out, or no rights)\n * until the next navigation, so a signed-out tab doesn't keep asking.\n */\n@Injectable({ providedIn: 'root' })\nexport class ApprovalCount {\n static readonly Every = 30_000;\n\n private readonly api = inject(ApiService);\n private polling: Subscription | null = null;\n /** Requests the signed-in user can approve or reject now. */\n readonly forYou = signal(0);\n\n constructor() {\n effect(() => { if (this.api.tenantKnown() && !untracked(() => this.polling)) untracked(() => this.start()); });\n const navigations = inject(Router).events.pipe(filter(e => e instanceof NavigationEnd))\n .subscribe(() => { if (!this.polling && this.api.tenantKnown()) this.start(); });\n inject(DestroyRef).onDestroy(() => { navigations.unsubscribe(); this.polling?.unsubscribe(); });\n }\n\n /** Asks again now, for a page that just changed what waits. */\n refresh() { if (this.api.tenantKnown()) this.start(); }\n\n private start() {\n this.polling?.unsubscribe();\n this.polling = timer(0, ApprovalCount.Every).pipe(switchMap(() => this.api.waitingRequests())).subscribe({\n next: w => this.forYou.set(w.forYou),\n error: () => { this.forYou.set(0); this.polling = null; },\n });\n }\n}\n\n/**\n * Shows {@link ApprovalCount} on the Approvals entry of juice-layout's side menu, found by its icon. juice-layout's menu has no badge of its\n * own, so this adds one beside the label and puts it back whenever the menu is drawn again.\n */\n@Injectable({ providedIn: 'root' })\nexport class ApprovalMenuBadge {\n static readonly Icon = 'approval';\n\n private readonly count = inject(ApprovalCount);\n private observer: MutationObserver | null = null;\n\n constructor() {\n if (typeof document === 'undefined' || typeof MutationObserver === 'undefined') return;\n effect(() => this.apply(this.count.forYou()));\n let scheduled = false;\n this.observer = new MutationObserver(() => {\n if (scheduled) return;\n scheduled = true;\n requestAnimationFrame(() => { scheduled = false; this.apply(this.count.forYou()); });\n });\n this.observer.observe(document.body, { childList: true, subtree: true });\n inject(DestroyRef).onDestroy(() => this.observer?.disconnect());\n }\n\n private apply(count: number) {\n for (const icon of Array.from(document.querySelectorAll<HTMLElement>('juice-nav-menu mat-icon'))) {\n if (icon.textContent?.trim() !== ApprovalMenuBadge.Icon) continue;\n const item = icon.closest<HTMLElement>('mat-list-item, .mat-mdc-list-item');\n const title = item?.querySelector<HTMLElement>('[matListItemTitle], .mdc-list-item__primary-text');\n if (!item || !title) continue;\n let badge = title.querySelector<HTMLElement>('.jc-menu-badge');\n if (count <= 0) { badge?.remove(); item.removeAttribute('title'); continue; }\n if (!badge) {\n badge = document.createElement('span');\n badge.className = 'jc-menu-badge';\n badge.setAttribute('data-testid', 'approvals-badge');\n badge.style.cssText = 'display:inline-block;min-width:1.25rem;margin-left:.5rem;padding:0 .375rem;border-radius:999px;font-size:.75rem;'\n + 'line-height:1.25rem;text-align:center;font-weight:600;background:var(--mat-sys-error,#b3261e);color:var(--mat-sys-on-error,#fff)';\n title.appendChild(badge);\n }\n const text = count > 99 ? '99+' : String(count);\n if (badge.textContent !== text) badge.textContent = text;\n const hint = `${count} request${count === 1 ? '' : 's'} waiting for your approval`;\n if (item.getAttribute('title') !== hint) item.setAttribute('title', hint);\n }\n }\n}\n","import { EnvironmentProviders, Injectable, InjectionToken, Pipe, PipeTransform, inject, makeEnvironmentProviders, provideEnvironmentInitializer } from '@angular/core';\nimport { ApprovalMenuBadge } from './approval-count';\n\n/** How the host app mounts Juice Observability. */\nexport interface ObservabilityOptions {\n /** The Juice API origin; empty when the API serves the app (same origin). */\n apiBase: string;\n /** Where the host mounts {@link OBSERVABILITY_ROUTES}: `/` for the whole app, or a path such as `/observability`. */\n basePath: string;\n /**\n * A link to the audit records of a trace, shown on the trace page: for the Juice Audit pages mounted at `/audit`,\n * `id => ['/audit/traces', id]`. A string is an external URL. Without it, no link.\n */\n auditLink?: ((traceId: string) => unknown[] | string | null) | null;\n /** Show on the Approvals menu entry how many action requests wait for the signed-in user. On unless false. */\n approvalCount?: boolean;\n}\n\nexport const OBSERVABILITY_OPTIONS = new InjectionToken<ObservabilityOptions>('OBSERVABILITY_OPTIONS', {\n providedIn: 'root',\n factory: () => ({ apiBase: '', basePath: '/', auditLink: null }),\n});\n\n/**\n * Configures the pages: where the API is, where the host mounted the routes, and where a trace's audit records open. Also shows the count\n * of requests waiting for approval on the Approvals menu entry, unless `approvalCount: false`.\n */\nexport function provideJuiceObservability(options: Partial<ObservabilityOptions> = {}): EnvironmentProviders {\n return makeEnvironmentProviders([\n {\n provide: OBSERVABILITY_OPTIONS,\n useValue: {\n apiBase: options.apiBase ?? '',\n basePath: options.basePath ?? '/',\n auditLink: options.auditLink ?? null,\n } satisfies ObservabilityOptions,\n },\n ...(options.approvalCount === false ? [] : [provideEnvironmentInitializer(() => { inject(ApprovalMenuBadge); })]),\n ]);\n}\n\n/** `/observability/` → `/observability`; `` and `/` → `/`. */\nexport function normalizeBasePath(basePath: string): string {\n const trimmed = basePath.trim().replace(/^\\/+|\\/+$/g, '');\n return trimmed ? `/${trimmed}` : '/';\n}\n\n/** Router links to the pages, under the host's mount path. */\n@Injectable({ providedIn: 'root' })\nexport class ObservabilityLinks {\n private readonly options = inject(OBSERVABILITY_OPTIONS);\n readonly base = normalizeBasePath(this.options.basePath);\n\n /** `to('services', id)` → `['/observability', 'services', id]`. */\n to(...segments: unknown[]): unknown[] { return [this.base, ...segments]; }\n\n /** The host's link to the audit records of a trace, if it gave one. */\n audit(traceId: string | null | undefined): { route: unknown[] } | { href: string } | null {\n if (!traceId || !this.options.auditLink) return null;\n const link = this.options.auditLink(traceId);\n if (!link) return null;\n return typeof link === 'string' ? { href: link } : { route: link };\n }\n}\n\n/** `['services', id] | jcLink`: the same as {@link ObservabilityLinks.to} in a template. */\n@Pipe({ name: 'jcLink' })\nexport class LinkPipe implements PipeTransform {\n private readonly links = inject(ObservabilityLinks);\n transform(segments: unknown[]): unknown[] { return this.links.to(...segments); }\n}\n","import { Injectable, computed, inject } from '@angular/core';\nimport { toSignal } from '@angular/core/rxjs-interop';\nimport { ActivatedRoute, NavigationEnd, Params, Router } from '@angular/router';\nimport { filter, map, startWith } from 'rxjs';\n\nexport const RANGES: Record<string, number> = {\n '15m': 15 * 60_000, '1h': 3_600_000, '6h': 6 * 3_600_000, '24h': 24 * 3_600_000, '7d': 7 * 24 * 3_600_000,\n};\n\n/** Search ranges are at most 24 hours (the API's bound); series and operations take up to 7 days. */\nexport const MAX_SEARCH_MS = RANGES['24h'];\n\n/**\n * The investigation context that follows the user between pages (Console requirements §17): environment and time\n * range. It lives in the URL (`env`, and `range` or `from`/`to`), so every page is a deep link and the browser's back\n * button restores it.\n */\n@Injectable({ providedIn: 'root' })\nexport class ContextService {\n private readonly router = inject(Router);\n\n // Created on first use, after the first navigation may already have ended: start from the current URL.\n private readonly params = toSignal(this.router.events.pipe(\n filter(e => e instanceof NavigationEnd),\n startWith(null),\n map(() => this.leaf().snapshot.queryParams),\n ), { initialValue: {} as Params });\n\n readonly environment = computed(() => (this.params()['env'] as string | undefined) ?? '');\n readonly range = computed(() => {\n const p = this.params();\n return p['from'] && p['to'] ? 'custom' : ((p['range'] as string | undefined) ?? '1h');\n });\n readonly absolute = computed(() => {\n const p = this.params();\n return p['from'] && p['to'] ? { from: p['from'] as string, to: p['to'] as string } : null;\n });\n\n /** The window as ISO strings, evaluated now for a relative range. */\n window(maxMs?: number): { from: string; to: string } {\n const absolute = this.absolute();\n if (absolute) return absolute;\n const to = Date.now();\n const span = Math.min(RANGES[this.range()] ?? RANGES['1h'], maxMs ?? Number.MAX_SAFE_INTEGER);\n return { from: new Date(to - span).toISOString(), to: new Date(to).toISOString() };\n }\n\n /** Query parameters for a link: the context plus the target page's own. */\n keep(extra: Params = {}): Params {\n const p = this.params();\n const context: Params = {};\n for (const key of ['env', 'range', 'from', 'to']) if (p[key]) context[key] = p[key];\n return { ...context, ...extra };\n }\n\n /** Changes the context on the current page, keeping its other parameters. */\n set(change: { env?: string | null; range?: string | null; from?: string | null; to?: string | null }) {\n const queryParams: Params = { ...change };\n if (change.range) Object.assign(queryParams, { from: null, to: null });\n void this.router.navigate([], { relativeTo: this.leaf(), queryParams, queryParamsHandling: 'merge' });\n }\n\n /** A time window centred on a moment, for \"around this span\" links. */\n around(at: string, durationMs: number, paddingMs = 5 * 60_000): Params {\n const start = new Date(at).getTime();\n return this.keep({\n from: new Date(start - paddingMs).toISOString(),\n to: new Date(start + durationMs + paddingMs).toISOString(),\n range: null,\n });\n }\n\n private leaf(): ActivatedRoute {\n let route = this.router.routerState.root;\n while (route.firstChild) route = route.firstChild;\n return route;\n }\n}\n","import { Routes } from '@angular/router';\nimport { Menus } from '@juice-js/core';\nimport { normalizeBasePath } from './core/options';\n\nfunction page(path: string, title: string, load: Routes[number]['loadComponent']): Routes[number] {\n return { path, title: `${title} · Juice Observability`, loadComponent: load };\n}\n\n/**\n * The pages, investigation first (Console requirements §4): services, traces, topology, logs and metrics; alerts and\n * rules after. Detail pages are deep links (§17) and carry the environment and time range in their query parameters.\n * The host mounts them at its `basePath` (see {@link provideJuiceObservability}) and adds its own guards.\n */\nexport const OBSERVABILITY_ROUTES: Routes = [\n page('', 'Overview', () => import('./pages/overview.page').then(m => m.OverviewPage)),\n page('services', 'Services', () => import('./pages/services.page').then(m => m.ServicesPage)),\n page('services/:id', 'Service', () => import('./pages/service.page').then(m => m.ServicePage)),\n page('traces', 'Traces', () => import('./pages/traces.page').then(m => m.TracesPage)),\n page('traces/:traceId', 'Trace', () => import('./pages/trace.page').then(m => m.TracePage)),\n page('topology', 'Dependencies', () => import('./pages/topology.page').then(m => m.TopologyPage)),\n page('logs', 'Logs', () => import('./pages/logs.page').then(m => m.LogsPage)),\n page('metrics', 'Metrics', () => import('./pages/metrics.page').then(m => m.MetricsPage)),\n page('resources', 'Resources', () => import('./pages/resources.page').then(m => m.ResourcesPage)),\n page('resources/:id', 'Resource', () => import('./pages/resource.page').then(m => m.ResourcePage)),\n page('alerts', 'Alerts', () => import('./pages/alerts.page').then(m => m.AlertsPage)),\n page('alerts/:id', 'Alert', () => import('./pages/alert.page').then(m => m.AlertPage)),\n page('rules', 'Rules', () => import('./pages/rules.page').then(m => m.RulesPage)),\n page('notifications', 'Notifications', () => import('./pages/notifications.page').then(m => m.NotificationsPage)),\n page('silences', 'Silences', () => import('./pages/silences.page').then(m => m.SilencesPage)),\n page('incidents', 'Incidents', () => import('./pages/incidents.page').then(m => m.IncidentsPage)),\n page('incidents/:id', 'Incident', () => import('./pages/incident.page').then(m => m.IncidentPage)),\n page('agents', 'Agents', () => import('./pages/agents.page').then(m => m.AgentsPage)),\n page('agents/:id', 'Agent', () => import('./pages/agent.page').then(m => m.AgentPage)),\n page('approvals', 'Approvals', () => import('./pages/approvals.page').then(m => m.ApprovalsPage)),\n page('slos', 'SLOs', () => import('./pages/slos.page').then(m => m.SlosPage)),\n page('slos/:key', 'SLO', () => import('./pages/slo.page').then(m => m.SloPage)),\n page('timeline', 'Timeline', () => import('./pages/timeline.page').then(m => m.TimelinePage)),\n page('load-runs', 'Load runs', () => import('./pages/load-runs.page').then(m => m.LoadRunsPage)),\n];\n\n/** The side menu entries (juice-layout), investigation pages first, linking under `basePath`. */\nexport function observabilityMenus(basePath = '/', order = 1): Menus {\n const base = normalizeBasePath(basePath);\n const link = (path: string) => (base === '/' ? `/${path}` : path ? `${base}/${path}` : base);\n return [\n { id: 'overview', label: 'Overview', icon: 'dashboard', routerLink: link('') },\n { id: 'services', label: 'Services', icon: 'hub', routerLink: link('services') },\n { id: 'traces', label: 'Traces', icon: 'timeline', routerLink: link('traces') },\n { id: 'topology', label: 'Dependencies', icon: 'account_tree', routerLink: link('topology') },\n { id: 'logs', label: 'Logs', icon: 'notes', routerLink: link('logs') },\n { id: 'metrics', label: 'Metrics', icon: 'show_chart', routerLink: link('metrics') },\n { id: 'resources', label: 'Resources', icon: 'dns', routerLink: link('resources') },\n { id: 'alerts', label: 'Alerts', icon: 'notifications', routerLink: link('alerts') },\n { id: 'incidents', label: 'Incidents', icon: 'emergency', routerLink: link('incidents') },\n { id: 'rules', label: 'Rules', icon: 'rule', routerLink: link('rules') },\n { id: 'silences', label: 'Silences', icon: 'notifications_paused', routerLink: link('silences') },\n { id: 'notifications', label: 'Notifications', icon: 'campaign', routerLink: link('notifications') },\n { id: 'slos', label: 'SLOs', icon: 'track_changes', routerLink: link('slos') },\n { id: 'agents', label: 'Agents', icon: 'smart_toy', routerLink: link('agents') },\n { id: 'approvals', label: 'Approvals', icon: 'approval', routerLink: link('approvals') },\n { id: 'timeline', label: 'Timeline', icon: 'history', routerLink: link('timeline') },\n { id: 'load-runs', label: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C5E;GAAE,IAAI;GAAU,OAAO;GAAU,MAAM;GAAa,YAAY,KAAK,QAAQ;EAAC;EAC9E;GAAE,IAAI;GAAa,OAAO;GAAa,MAAM;GAAY,YAAY,KAAK,WAAW;EAAC;EACtF;GAAE,IAAI;GAAY,OAAO;GAAY,MAAM;GAAW,YAAY,KAAK,UAAU;EAAC;EAClF;GAAE,IAAI;GAAa,OAAO;GAAa,MAAM;GAAS,YAAY,KAAK,WAAW;EAAC;CACpF,CAAA,CAAC,KAAK,MAAM,WAAW;EAAE,GAAG;EAAM,OAAO,QAAQ;CAAK,EAAG;AAC5D"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juice-js/observability",
3
- "version": "1.1.0-alpha.31",
3
+ "version": "1.1.0-alpha.32",
4
4
  "description": "Juice Observability pages (services, traces, topology, logs, metrics, resources, alerts, rules) for an Angular app on juice-layout",
5
5
  "author": "jack@creatorflow.io",
6
6
  "license": "MIT",
@@ -718,6 +718,82 @@ export interface SearchHit {
718
718
  title: string;
719
719
  traceId: string | null;
720
720
  }
721
+ /** One window of an SLO: its SLI events, attainment and burn rate, or why it has none (state InsufficientData or Unknown). */
722
+ export interface SloWindow {
723
+ name: string;
724
+ total: number;
725
+ good: number;
726
+ bad: number;
727
+ attainment: number | null;
728
+ burnRate: number | null;
729
+ coverage: number;
730
+ state: string;
731
+ }
732
+ /** An SLO as it stands now. State is Met, AtRisk, Exhausted, InsufficientData or Unknown; the last two have no budget figures. */
733
+ export interface SloSummary {
734
+ key: string;
735
+ name: string;
736
+ category: string;
737
+ sli: string;
738
+ service: string;
739
+ environment: string;
740
+ target: number;
741
+ thresholdMs: number | null;
742
+ version: number;
743
+ pendingVersion: number | null;
744
+ retired: boolean;
745
+ state: string;
746
+ attainment: number | null;
747
+ budgetUsed: number | null;
748
+ budgetRemaining: number | null;
749
+ total: number;
750
+ good: number;
751
+ bad: number;
752
+ budgetAllowed: number;
753
+ coverage: number;
754
+ burn: SloWindow[];
755
+ }
756
+ export interface SloDefinition {
757
+ name: string;
758
+ sli: string;
759
+ service: string;
760
+ environment: string;
761
+ target: number;
762
+ thresholdMs: number | null;
763
+ operations: string[];
764
+ excludeOperations: string[];
765
+ clientErrors: string;
766
+ cancellations: string;
767
+ }
768
+ export interface SloVersion {
769
+ version: number;
770
+ target: number;
771
+ effectiveFrom: string;
772
+ createdAt: string;
773
+ createdBy: string;
774
+ hash: string;
775
+ status: string;
776
+ definition: SloDefinition;
777
+ }
778
+ export interface SloDay {
779
+ day: string;
780
+ total: number;
781
+ good: number;
782
+ bad: number;
783
+ attainment: number | null;
784
+ excludedHealth: number;
785
+ excludedCancelled: number;
786
+ excludedClientErrors: number;
787
+ minutes: number;
788
+ expectedMinutes: number;
789
+ }
790
+ export interface SloDetail {
791
+ slo: SloSummary;
792
+ definition: SloDefinition;
793
+ versions: SloVersion[];
794
+ days: SloDay[];
795
+ countedThrough: string | null;
796
+ }
721
797
  /**
722
798
  * A random UUID v4 for `Idempotency-Key`. Not `crypto.randomUUID()`: browsers offer it only in a secure context (HTTPS or localhost), so it
723
799
  * throws on a Console opened over plain HTTP at the machine's address, as the local stack is. `getRandomValues` works everywhere.
@@ -787,6 +863,9 @@ export declare class ApiService {
787
863
  actionRequests(query?: Query): Observable<Page<ActionRequest>>;
788
864
  /** A diagnostic bundle's zip (operators and admins; audited). */
789
865
  downloadBundle(agentId: string, bundleId: string): Observable<import("@angular/common/http").HttpResponse<Blob>>;
866
+ /** SLOs, technical or business apart (category), with their budgets and burn rates. */
867
+ slos(category?: string): Observable<Page<SloSummary>>;
868
+ slo(key: string): Observable<SloDetail>;
790
869
  /** How many requests wait, and how many of them the signed-in user can decide. */
791
870
  waitingRequests(): Observable<ActionRequestsWaiting>;
792
871
  approveRequest(id: string, comment: string): Observable<ActionRequest>;