@juice-js/observability 1.1.0-alpha.31 → 1.1.0-alpha.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/{juice-js-observability-alert.page-BNlH9IdQ.mjs → juice-js-observability-alert.page-2kfKksIG.mjs} +46 -2
- package/fesm2022/juice-js-observability-alert.page-2kfKksIG.mjs.map +1 -0
- package/fesm2022/{juice-js-observability-incident.page-C2ZK3MRh.mjs → juice-js-observability-incident.page-D2GvuIft.mjs} +38 -2
- package/fesm2022/juice-js-observability-incident.page-D2GvuIft.mjs.map +1 -0
- package/fesm2022/{juice-js-observability-rules.page-CWaADAe4.mjs → juice-js-observability-rules.page-CARCWaw_.mjs} +8 -7
- package/fesm2022/juice-js-observability-rules.page-CARCWaw_.mjs.map +1 -0
- package/fesm2022/juice-js-observability-slo.page-l7TOat-D.mjs +414 -0
- package/fesm2022/juice-js-observability-slo.page-l7TOat-D.mjs.map +1 -0
- package/fesm2022/juice-js-observability-slos.page-DNG6g6_R.mjs +267 -0
- package/fesm2022/juice-js-observability-slos.page-DNG6g6_R.mjs.map +1 -0
- package/fesm2022/juice-js-observability-suggestions-eQK_z0Nd.mjs +367 -0
- package/fesm2022/juice-js-observability-suggestions-eQK_z0Nd.mjs.map +1 -0
- package/fesm2022/juice-js-observability.mjs +29 -3
- package/fesm2022/juice-js-observability.mjs.map +1 -1
- package/package.json +1 -1
- package/types/juice-js-observability.d.ts +126 -0
- package/fesm2022/juice-js-observability-alert.page-BNlH9IdQ.mjs.map +0 -1
- package/fesm2022/juice-js-observability-incident.page-C2ZK3MRh.mjs.map +0 -1
- package/fesm2022/juice-js-observability-rules.page-CWaADAe4.mjs.map +0 -1
|
@@ -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":"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"}
|
|
@@ -0,0 +1,367 @@
|
|
|
1
|
+
import { ApiService, ContextService, LinkPipe } from "./juice-js-observability.mjs";
|
|
2
|
+
import { o as problemText } from "./juice-js-observability-telemetry-DVwUTHSz.mjs";
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
import { ChangeDetectionStrategy, Component, inject, input, output, signal } from "@angular/core";
|
|
5
|
+
import { RouterLink } from "@angular/router";
|
|
6
|
+
import { DatePipe, DecimalPipe } from "@angular/common";
|
|
7
|
+
import * as i1 from "@angular/forms";
|
|
8
|
+
import { FormsModule } from "@angular/forms";
|
|
9
|
+
import * as i2 from "@angular/material/button";
|
|
10
|
+
import { MatButtonModule } from "@angular/material/button";
|
|
11
|
+
import { MatFormFieldModule } from "@angular/material/form-field";
|
|
12
|
+
import * as i4 from "@angular/material/input";
|
|
13
|
+
import { MatInputModule } from "@angular/material/input";
|
|
14
|
+
import * as i3 from "@angular/material/select";
|
|
15
|
+
var SuggestionsCard = class SuggestionsCard {
|
|
16
|
+
ctx = inject(ContextService);
|
|
17
|
+
api = inject(ApiService);
|
|
18
|
+
suggestions = input(...ngDevMode ? [void 0, { debugName: "suggestions" }] : /* istanbul ignore next */ []);
|
|
19
|
+
withAlert = input(false, ...ngDevMode ? [{ debugName: "withAlert" }] : /* istanbul ignore next */ []);
|
|
20
|
+
incident = input(null, ...ngDevMode ? [{ debugName: "incident" }] : /* istanbul ignore next */ []);
|
|
21
|
+
decided = output();
|
|
22
|
+
sending = signal(false, ...ngDevMode ? [{ debugName: "sending" }] : /* istanbul ignore next */ []);
|
|
23
|
+
error = signal("", ...ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []);
|
|
24
|
+
dismissing = signal("", ...ngDevMode ? [{ debugName: "dismissing" }] : /* istanbul ignore next */ []);
|
|
25
|
+
reason = "";
|
|
26
|
+
key(x) {
|
|
27
|
+
return `${x.alert.id}:${x.other.id}`;
|
|
28
|
+
}
|
|
29
|
+
acceptLabel(x) {
|
|
30
|
+
if (!x.incidentId) return "Merge into a new incident";
|
|
31
|
+
return x.incidentId === this.incident() ? "Add to this incident" : "Add to its incident";
|
|
32
|
+
}
|
|
33
|
+
accept(x) {
|
|
34
|
+
this.run(this.api.acceptSuggestion(x.alert.id, x.other.id));
|
|
35
|
+
}
|
|
36
|
+
dismiss(x) {
|
|
37
|
+
this.run(this.api.dismissSuggestion(x.alert.id, x.other.id, this.reason.trim()));
|
|
38
|
+
}
|
|
39
|
+
run(request) {
|
|
40
|
+
this.sending.set(true);
|
|
41
|
+
this.error.set("");
|
|
42
|
+
request.subscribe({
|
|
43
|
+
next: (d) => {
|
|
44
|
+
this.sending.set(false);
|
|
45
|
+
this.dismissing.set("");
|
|
46
|
+
this.decided.emit(d);
|
|
47
|
+
},
|
|
48
|
+
error: (e) => {
|
|
49
|
+
const status = e.status;
|
|
50
|
+
this.sending.set(false);
|
|
51
|
+
this.error.set(status === 403 ? "Deciding needs the operator or admin role." : problemText(e));
|
|
52
|
+
if (status === 409) {
|
|
53
|
+
this.dismissing.set("");
|
|
54
|
+
this.decided.emit(null);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
60
|
+
minVersion: "12.0.0",
|
|
61
|
+
version: "22.2.4",
|
|
62
|
+
ngImport: i0,
|
|
63
|
+
type: SuggestionsCard,
|
|
64
|
+
deps: [],
|
|
65
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
66
|
+
});
|
|
67
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
68
|
+
minVersion: "17.0.0",
|
|
69
|
+
version: "22.2.4",
|
|
70
|
+
type: SuggestionsCard,
|
|
71
|
+
isStandalone: true,
|
|
72
|
+
selector: "jc-suggestions",
|
|
73
|
+
inputs: {
|
|
74
|
+
suggestions: {
|
|
75
|
+
classPropertyName: "suggestions",
|
|
76
|
+
publicName: "suggestions",
|
|
77
|
+
isSignal: true,
|
|
78
|
+
isRequired: false,
|
|
79
|
+
transformFunction: null
|
|
80
|
+
},
|
|
81
|
+
withAlert: {
|
|
82
|
+
classPropertyName: "withAlert",
|
|
83
|
+
publicName: "withAlert",
|
|
84
|
+
isSignal: true,
|
|
85
|
+
isRequired: false,
|
|
86
|
+
transformFunction: null
|
|
87
|
+
},
|
|
88
|
+
incident: {
|
|
89
|
+
classPropertyName: "incident",
|
|
90
|
+
publicName: "incident",
|
|
91
|
+
isSignal: true,
|
|
92
|
+
isRequired: false,
|
|
93
|
+
transformFunction: null
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
outputs: { decided: "decided" },
|
|
97
|
+
ngImport: i0,
|
|
98
|
+
template: `
|
|
99
|
+
@if (suggestions(); as s) {
|
|
100
|
+
<p class="jc-notice" data-testid="suggestions-note">{{ s.note }}</p>
|
|
101
|
+
<table class="jc-table"><tbody>
|
|
102
|
+
@for (x of s.items; track x.alert.id + x.other.id) {
|
|
103
|
+
<tr data-testid="suggestion">
|
|
104
|
+
<td>
|
|
105
|
+
<a [routerLink]="['alerts', x.other.id] | jcLink" [queryParams]="ctx.keep()"><strong>{{ x.other.rule }}</strong></a>
|
|
106
|
+
<div class="jc-small">{{ x.other.subjectKey }} · {{ x.other.severity }} · fired {{ x.other.firedAt | date: 'HH:mm:ss' }}</div>
|
|
107
|
+
@if (withAlert()) { <div class="jc-muted jc-small">with {{ x.alert.rule }} on {{ x.alert.subjectKey }}</div> }
|
|
108
|
+
</td>
|
|
109
|
+
<td class="jc-nowrap"><strong data-testid="suggestion-score">{{ x.score | number: '1.2-2' }}</strong></td>
|
|
110
|
+
<td class="jc-small"><ul class="jc-reasons">@for (e of x.evidence; track e.code) { <li>{{ e.text }} <span class="jc-muted">(+{{ e.weight | number: '1.2-2' }})</span></li> }</ul></td>
|
|
111
|
+
<td class="jc-row-actions">
|
|
112
|
+
@if (dismissing() === key(x)) {
|
|
113
|
+
<form class="jc-filter-form" (ngSubmit)="dismiss(x)">
|
|
114
|
+
<mat-form-field subscriptSizing="dynamic"><mat-label>Why not related</mat-label><input matInput name="reason" data-testid="suggestion-reason" [(ngModel)]="reason" maxlength="500" required></mat-form-field>
|
|
115
|
+
<button mat-stroked-button type="submit" data-testid="suggestion-dismiss-confirm" [disabled]="sending() || !reason.trim()">Dismiss</button>
|
|
116
|
+
<button mat-button type="button" (click)="dismissing.set('')">Cancel</button>
|
|
117
|
+
</form>
|
|
118
|
+
} @else {
|
|
119
|
+
<button mat-flat-button type="button" data-testid="suggestion-accept" [disabled]="sending()" (click)="accept(x)">{{ acceptLabel(x) }}</button>
|
|
120
|
+
<button mat-button type="button" data-testid="suggestion-dismiss" [disabled]="sending()" (click)="dismissing.set(key(x)); reason = ''">Dismiss</button>
|
|
121
|
+
}
|
|
122
|
+
</td>
|
|
123
|
+
</tr>
|
|
124
|
+
} @empty { <tr><td class="jc-muted">No alerts fired with this one closely enough, or with enough in common, to suggest (a score of {{ s.threshold | number: '1.1-1' }} or more).</td></tr> }
|
|
125
|
+
</tbody></table>
|
|
126
|
+
@if (error()) { <p class="jc-error" data-testid="suggestion-error">{{ error() }}</p> }
|
|
127
|
+
}`,
|
|
128
|
+
isInline: true,
|
|
129
|
+
dependencies: [
|
|
130
|
+
{
|
|
131
|
+
kind: "directive",
|
|
132
|
+
type: RouterLink,
|
|
133
|
+
selector: "[routerLink]",
|
|
134
|
+
inputs: [
|
|
135
|
+
"target",
|
|
136
|
+
"queryParams",
|
|
137
|
+
"fragment",
|
|
138
|
+
"queryParamsHandling",
|
|
139
|
+
"state",
|
|
140
|
+
"info",
|
|
141
|
+
"relativeTo",
|
|
142
|
+
"preserveFragment",
|
|
143
|
+
"skipLocationChange",
|
|
144
|
+
"replaceUrl",
|
|
145
|
+
"browserUrl",
|
|
146
|
+
"routerLink"
|
|
147
|
+
]
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
kind: "ngmodule",
|
|
151
|
+
type: FormsModule
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
kind: "directive",
|
|
155
|
+
type: i1.ɵNgNoValidate,
|
|
156
|
+
selector: "form:not([ngNoForm]):not([ngNativeValidate])"
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
kind: "directive",
|
|
160
|
+
type: i1.DefaultValueAccessor,
|
|
161
|
+
selector: "input:not([type=checkbox]):not([ngNoCva])[formControlName],textarea:not([ngNoCva])[formControlName],input:not([type=checkbox]):not([ngNoCva])[formControl],textarea:not([ngNoCva])[formControl],input:not([type=checkbox]):not([ngNoCva])[ngModel],textarea:not([ngNoCva])[ngModel],[ngDefaultControl]"
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
kind: "directive",
|
|
165
|
+
type: i1.NgControlStatus,
|
|
166
|
+
selector: "[formControlName],[ngModel],[formControl]"
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
kind: "directive",
|
|
170
|
+
type: i1.NgControlStatusGroup,
|
|
171
|
+
selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]"
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
kind: "directive",
|
|
175
|
+
type: i1.RequiredValidator,
|
|
176
|
+
selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]",
|
|
177
|
+
inputs: ["required"]
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
kind: "directive",
|
|
181
|
+
type: i1.MaxLengthValidator,
|
|
182
|
+
selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]",
|
|
183
|
+
inputs: ["maxlength"]
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
kind: "directive",
|
|
187
|
+
type: i1.NgModel,
|
|
188
|
+
selector: "[ngModel]:not([formControlName]):not([formControl])",
|
|
189
|
+
inputs: [
|
|
190
|
+
"name",
|
|
191
|
+
"disabled",
|
|
192
|
+
"ngModel",
|
|
193
|
+
"ngModelOptions"
|
|
194
|
+
],
|
|
195
|
+
outputs: ["ngModelChange"],
|
|
196
|
+
exportAs: ["ngModel"]
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
kind: "directive",
|
|
200
|
+
type: i1.NgForm,
|
|
201
|
+
selector: "form:not([ngNoForm]):not([formGroup]):not([formArray]),ng-form,[ngForm]",
|
|
202
|
+
inputs: ["ngFormOptions"],
|
|
203
|
+
outputs: ["ngSubmit"],
|
|
204
|
+
exportAs: ["ngForm"]
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
kind: "ngmodule",
|
|
208
|
+
type: MatButtonModule
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
kind: "component",
|
|
212
|
+
type: i2.MatButton,
|
|
213
|
+
selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ",
|
|
214
|
+
inputs: ["matButton"],
|
|
215
|
+
exportAs: ["matButton", "matAnchor"]
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
kind: "ngmodule",
|
|
219
|
+
type: MatFormFieldModule
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
kind: "component",
|
|
223
|
+
type: i3.MatFormField,
|
|
224
|
+
selector: "mat-form-field",
|
|
225
|
+
inputs: [
|
|
226
|
+
"hideRequiredMarker",
|
|
227
|
+
"color",
|
|
228
|
+
"floatLabel",
|
|
229
|
+
"appearance",
|
|
230
|
+
"subscriptSizing",
|
|
231
|
+
"hintLabel"
|
|
232
|
+
],
|
|
233
|
+
exportAs: ["matFormField"]
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
kind: "directive",
|
|
237
|
+
type: i3.MatLabel,
|
|
238
|
+
selector: "mat-label"
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
kind: "ngmodule",
|
|
242
|
+
type: MatInputModule
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
kind: "directive",
|
|
246
|
+
type: i4.MatInput,
|
|
247
|
+
selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]",
|
|
248
|
+
inputs: [
|
|
249
|
+
"disabled",
|
|
250
|
+
"id",
|
|
251
|
+
"placeholder",
|
|
252
|
+
"name",
|
|
253
|
+
"required",
|
|
254
|
+
"type",
|
|
255
|
+
"errorStateMatcher",
|
|
256
|
+
"aria-describedby",
|
|
257
|
+
"value",
|
|
258
|
+
"readonly",
|
|
259
|
+
"disabledInteractive"
|
|
260
|
+
],
|
|
261
|
+
exportAs: ["matInput"]
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
kind: "pipe",
|
|
265
|
+
type: LinkPipe,
|
|
266
|
+
name: "jcLink"
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
kind: "pipe",
|
|
270
|
+
type: DatePipe,
|
|
271
|
+
name: "date"
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
kind: "pipe",
|
|
275
|
+
type: DecimalPipe,
|
|
276
|
+
name: "number"
|
|
277
|
+
}
|
|
278
|
+
],
|
|
279
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
280
|
+
});
|
|
281
|
+
};
|
|
282
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
283
|
+
minVersion: "12.0.0",
|
|
284
|
+
version: "22.2.4",
|
|
285
|
+
ngImport: i0,
|
|
286
|
+
type: SuggestionsCard,
|
|
287
|
+
decorators: [{
|
|
288
|
+
type: Component,
|
|
289
|
+
args: [{
|
|
290
|
+
selector: "jc-suggestions",
|
|
291
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
292
|
+
imports: [
|
|
293
|
+
LinkPipe,
|
|
294
|
+
RouterLink,
|
|
295
|
+
DatePipe,
|
|
296
|
+
DecimalPipe,
|
|
297
|
+
FormsModule,
|
|
298
|
+
MatButtonModule,
|
|
299
|
+
MatFormFieldModule,
|
|
300
|
+
MatInputModule
|
|
301
|
+
],
|
|
302
|
+
template: `
|
|
303
|
+
@if (suggestions(); as s) {
|
|
304
|
+
<p class="jc-notice" data-testid="suggestions-note">{{ s.note }}</p>
|
|
305
|
+
<table class="jc-table"><tbody>
|
|
306
|
+
@for (x of s.items; track x.alert.id + x.other.id) {
|
|
307
|
+
<tr data-testid="suggestion">
|
|
308
|
+
<td>
|
|
309
|
+
<a [routerLink]="['alerts', x.other.id] | jcLink" [queryParams]="ctx.keep()"><strong>{{ x.other.rule }}</strong></a>
|
|
310
|
+
<div class="jc-small">{{ x.other.subjectKey }} · {{ x.other.severity }} · fired {{ x.other.firedAt | date: 'HH:mm:ss' }}</div>
|
|
311
|
+
@if (withAlert()) { <div class="jc-muted jc-small">with {{ x.alert.rule }} on {{ x.alert.subjectKey }}</div> }
|
|
312
|
+
</td>
|
|
313
|
+
<td class="jc-nowrap"><strong data-testid="suggestion-score">{{ x.score | number: '1.2-2' }}</strong></td>
|
|
314
|
+
<td class="jc-small"><ul class="jc-reasons">@for (e of x.evidence; track e.code) { <li>{{ e.text }} <span class="jc-muted">(+{{ e.weight | number: '1.2-2' }})</span></li> }</ul></td>
|
|
315
|
+
<td class="jc-row-actions">
|
|
316
|
+
@if (dismissing() === key(x)) {
|
|
317
|
+
<form class="jc-filter-form" (ngSubmit)="dismiss(x)">
|
|
318
|
+
<mat-form-field subscriptSizing="dynamic"><mat-label>Why not related</mat-label><input matInput name="reason" data-testid="suggestion-reason" [(ngModel)]="reason" maxlength="500" required></mat-form-field>
|
|
319
|
+
<button mat-stroked-button type="submit" data-testid="suggestion-dismiss-confirm" [disabled]="sending() || !reason.trim()">Dismiss</button>
|
|
320
|
+
<button mat-button type="button" (click)="dismissing.set('')">Cancel</button>
|
|
321
|
+
</form>
|
|
322
|
+
} @else {
|
|
323
|
+
<button mat-flat-button type="button" data-testid="suggestion-accept" [disabled]="sending()" (click)="accept(x)">{{ acceptLabel(x) }}</button>
|
|
324
|
+
<button mat-button type="button" data-testid="suggestion-dismiss" [disabled]="sending()" (click)="dismissing.set(key(x)); reason = ''">Dismiss</button>
|
|
325
|
+
}
|
|
326
|
+
</td>
|
|
327
|
+
</tr>
|
|
328
|
+
} @empty { <tr><td class="jc-muted">No alerts fired with this one closely enough, or with enough in common, to suggest (a score of {{ s.threshold | number: '1.1-1' }} or more).</td></tr> }
|
|
329
|
+
</tbody></table>
|
|
330
|
+
@if (error()) { <p class="jc-error" data-testid="suggestion-error">{{ error() }}</p> }
|
|
331
|
+
}`
|
|
332
|
+
}]
|
|
333
|
+
}],
|
|
334
|
+
propDecorators: {
|
|
335
|
+
suggestions: [{
|
|
336
|
+
type: i0.Input,
|
|
337
|
+
args: [{
|
|
338
|
+
isSignal: true,
|
|
339
|
+
alias: "suggestions",
|
|
340
|
+
required: false
|
|
341
|
+
}]
|
|
342
|
+
}],
|
|
343
|
+
withAlert: [{
|
|
344
|
+
type: i0.Input,
|
|
345
|
+
args: [{
|
|
346
|
+
isSignal: true,
|
|
347
|
+
alias: "withAlert",
|
|
348
|
+
required: false
|
|
349
|
+
}]
|
|
350
|
+
}],
|
|
351
|
+
incident: [{
|
|
352
|
+
type: i0.Input,
|
|
353
|
+
args: [{
|
|
354
|
+
isSignal: true,
|
|
355
|
+
alias: "incident",
|
|
356
|
+
required: false
|
|
357
|
+
}]
|
|
358
|
+
}],
|
|
359
|
+
decided: [{
|
|
360
|
+
type: i0.Output,
|
|
361
|
+
args: ["decided"]
|
|
362
|
+
}]
|
|
363
|
+
}
|
|
364
|
+
});
|
|
365
|
+
export { SuggestionsCard as t };
|
|
366
|
+
|
|
367
|
+
//# sourceMappingURL=juice-js-observability-suggestions-eQK_z0Nd.mjs.map
|