@juice-js/observability 1.1.0-alpha.30 → 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.
@@ -24,7 +24,8 @@ const LABELS = {
24
24
  "tcp.reachability": "TCP reachability",
25
25
  "agent.update": "Update the agent",
26
26
  "service.restart": "Restart a service",
27
- "files.cleanup": "Clean up old files"
27
+ "files.cleanup": "Clean up old files",
28
+ "diagnostics.bundle": "Diagnostic bundle"
28
29
  };
29
30
  const PARAMETER_LABELS = {
30
31
  pathPrefix: "Only under this path",
@@ -34,7 +35,8 @@ const PARAMETER_LABELS = {
34
35
  service: "Service",
35
36
  folder: "Folder",
36
37
  keepHours: "Keep files from the last (hours)",
37
- dryRun: "Dry run: only report what would go"
38
+ dryRun: "Dry run: only report what would go",
39
+ logLines: "Lines from each log"
38
40
  };
39
41
  function formatBytes(bytes) {
40
42
  if (bytes === null || bytes === void 0) return "—";
@@ -190,6 +192,38 @@ var AgentPage = class AgentPage {
190
192
  summary(c) {
191
193
  return c.result;
192
194
  }
195
+ bundle(c) {
196
+ return c.result;
197
+ }
198
+ downloading = signal(null, ...ngDevMode ? [{ debugName: "downloading" }] : /* istanbul ignore next */ []);
199
+ downloadErrors = signal({}, ...ngDevMode ? [{ debugName: "downloadErrors" }] : /* istanbul ignore next */ []);
200
+ download(b) {
201
+ this.downloading.set(b.bundleId);
202
+ this.downloadErrors.update((e) => ({
203
+ ...e,
204
+ [b.bundleId]: ""
205
+ }));
206
+ this.api.downloadBundle(this.id(), b.bundleId).subscribe({
207
+ next: (response) => {
208
+ this.downloading.set(null);
209
+ const name = /filename="?([^";]+)"?/.exec(response.headers.get("content-disposition") ?? "")?.[1] ?? `juice-bundle-${b.bundleId}.zip`;
210
+ const url = URL.createObjectURL(response.body);
211
+ const link = document.createElement("a");
212
+ link.href = url;
213
+ link.download = name;
214
+ link.click();
215
+ setTimeout(() => URL.revokeObjectURL(url), 1e4);
216
+ },
217
+ error: (e) => {
218
+ this.downloading.set(null);
219
+ const reason = e?.status === 404 ? "The bundle is gone: bundles are kept 14 days by default." : e?.status === 403 ? "Downloading a bundle takes an operator or an admin: its log excerpts can say more than the rest of the Console." : problemText(e);
220
+ this.downloadErrors.update((errors) => ({
221
+ ...errors,
222
+ [b.bundleId]: reason
223
+ }));
224
+ }
225
+ });
226
+ }
193
227
  disk(c) {
194
228
  return c.result;
195
229
  }
@@ -548,6 +582,15 @@ var AgentPage = class AgentPage {
548
582
  @else { <div class="jc-bad">Not reachable after {{ t.elapsedMs }} ms: {{ t.error }}</div> }
549
583
  }
550
584
  }
585
+ @case ('diagnostics.bundle') {
586
+ @if (bundle(c); as b) {
587
+ <div data-testid="bundle-result">{{ bytes(b.sizeBytes) }} zip: {{ b.entries.length }} files@if (b.redacted) { · {{ b.redacted }} {{ b.redacted === 1 ? 'value' : 'values' }} redacted }
588
+ <button mat-button type="button" [attr.data-testid]="'bundle-download-' + c.id" [disabled]="downloading() === b.bundleId" (click)="download(b)">Download</button>
589
+ </div>
590
+ @for (s of b.skipped; track s) { <div class="jc-muted">Left out: {{ s }}</div> }
591
+ @if (downloadErrors()[b.bundleId]; as e) { <div class="jc-error" [attr.data-testid]="'bundle-error-' + c.id">{{ e }}</div> }
592
+ }
593
+ }
551
594
  @default {
552
595
  @if (flat(c.result); as rows) {
553
596
  <table class="jc-kv" data-testid="custom-result">@for (r of rows; track r[0]) { <tr><td>{{ r[0] }}</td><td class="jc-mono">{{ r[1] }}</td></tr> }</table>
@@ -1042,6 +1085,15 @@ i0.ɵɵngDeclareClassMetadata({
1042
1085
  @else { <div class="jc-bad">Not reachable after {{ t.elapsedMs }} ms: {{ t.error }}</div> }
1043
1086
  }
1044
1087
  }
1088
+ @case ('diagnostics.bundle') {
1089
+ @if (bundle(c); as b) {
1090
+ <div data-testid="bundle-result">{{ bytes(b.sizeBytes) }} zip: {{ b.entries.length }} files@if (b.redacted) { · {{ b.redacted }} {{ b.redacted === 1 ? 'value' : 'values' }} redacted }
1091
+ <button mat-button type="button" [attr.data-testid]="'bundle-download-' + c.id" [disabled]="downloading() === b.bundleId" (click)="download(b)">Download</button>
1092
+ </div>
1093
+ @for (s of b.skipped; track s) { <div class="jc-muted">Left out: {{ s }}</div> }
1094
+ @if (downloadErrors()[b.bundleId]; as e) { <div class="jc-error" [attr.data-testid]="'bundle-error-' + c.id">{{ e }}</div> }
1095
+ }
1096
+ }
1045
1097
  @default {
1046
1098
  @if (flat(c.result); as rows) {
1047
1099
  <table class="jc-kv" data-testid="custom-result">@for (r of rows; track r[0]) { <tr><td>{{ r[0] }}</td><td class="jc-mono">{{ r[1] }}</td></tr> }</table>
@@ -1089,4 +1141,4 @@ i0.ɵɵngDeclareClassMetadata({
1089
1141
  });
1090
1142
  export { AgentPage };
1091
1143
 
1092
- //# sourceMappingURL=juice-js-observability-agent.page-CKcuCUVP.mjs.map
1144
+ //# sourceMappingURL=juice-js-observability-agent.page-Vb7LDThl.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"juice-js-observability-agent.page-Vb7LDThl.mjs","names":[],"sources":["../../../../projects/juice-js/observability/src/lib/pages/agent.page.ts"],"sourcesContent":["import { LinkPipe } from '../core/options';\nimport { ChangeDetectionStrategy, Component, computed, effect, inject, input, signal, untracked } from '@angular/core';\nimport { DatePipe } from '@angular/common';\nimport { FormsModule } from '@angular/forms';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatFormFieldModule } from '@angular/material/form-field';\nimport { MatInputModule } from '@angular/material/input';\nimport { MatProgressBarModule } from '@angular/material/progress-bar';\nimport { MatSelectModule } from '@angular/material/select';\nimport { RouterLink } from '@angular/router';\nimport { ApiService } from '../core/api.service';\nimport { ApprovalCount } from '../core/approval-count';\nimport { ContextService } from '../core/context.service';\nimport { ActionParameter, AgentAction, AgentCommand, BundleSummary, EnrollmentToken } from '../core/models';\nimport { MatCheckboxModule } from '@angular/material/checkbox';\nimport { AgoPipe, ReasonPipe, copyText } from '../shared/format';\nimport { apiResource } from '../shared/resource';\nimport { problemText } from '../shared/telemetry';\nimport { ContextBar } from '../shared/ui';\n\n/** What the actions return (Juice.Observability.Agent's Diagnostics). */\ninterface HostSummary {\n hostname: string; operatingSystem: string; architecture: string; uptimeSeconds: number; processorCount: number; loadAverage: number[] | null;\n memoryTotalBytes: number | null; memoryAvailableBytes: number | null; agentVersion: string;\n}\ninterface Filesystem { mountPoint: string; format: string; totalBytes: number; freeBytes: number; availableBytes: number; }\ninterface DiskUsage { filesystems: Filesystem[]; truncated: boolean; }\ninterface TcpReachability { host: string; port: number; reachable: boolean; address: string | null; elapsedMs: number; error: string | null; }\n\nconst WAITING = ['Pending', 'Delivered'];\nconst LABELS: Record<string, string> = {\n 'host.summary': 'Host summary', 'disk.usage': 'Disk usage', 'tcp.reachability': 'TCP reachability', 'agent.update': 'Update the agent',\n 'service.restart': 'Restart a service', 'files.cleanup': 'Clean up old files', 'diagnostics.bundle': 'Diagnostic bundle',\n};\nconst PARAMETER_LABELS: Record<string, string> = {\n pathPrefix: 'Only under this path', host: 'Host', port: 'Port', timeoutMs: 'Wait (ms)', service: 'Service', folder: 'Folder',\n keepHours: 'Keep files from the last (hours)', dryRun: 'Dry run: only report what would go', logLines: 'Lines from each log',\n};\n\nfunction formatBytes(bytes: number | null | undefined): string {\n if (bytes === null || bytes === undefined) return '—';\n const units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB'];\n let value = bytes;\n let unit = 0;\n while (value >= 1024 && unit < units.length - 1) { value /= 1024; unit++; }\n return `${value < 10 && unit > 0 ? value.toFixed(1) : Math.round(value)} ${units[unit]}`;\n}\n\nfunction formatUptime(seconds: number): string {\n const days = Math.floor(seconds / 86_400);\n const hours = Math.floor((seconds % 86_400) / 3600);\n return days > 0 ? `${days} d ${hours} h` : hours > 0 ? `${hours} h ${Math.floor((seconds % 3600) / 60)} min` : `${Math.floor(seconds / 60)} min`;\n}\n\n/**\n * One Juice Agent: whether it's calling in, what it was asked and what it answered. Operators run the read-only diagnostics; admins update and\n * revoke it. The platform signs each command, and the agent's own allowlist on its host still decides: a refusal there shows as `Rejected`.\n */\n@Component({\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [LinkPipe, RouterLink, DatePipe, FormsModule, MatButtonModule, MatCheckboxModule, MatFormFieldModule, MatInputModule, MatProgressBarModule, MatSelectModule, ContextBar, AgoPipe, ReasonPipe],\n template: `\n <jc-context-bar>\n <a [routerLink]=\"['agents'] | jcLink\" [queryParams]=\"ctx.keep()\" class=\"jc-crumb\">Agents</a><span class=\"jc-crumb-sep\">›</span>\n <h1>{{ agent.value()?.hostname ?? '…' }}</h1>\n </jc-context-bar>\n @if (agent.isLoading() && !agent.value()) { <mat-progress-bar mode=\"indeterminate\" /> }\n @if (agent.error()) { <p class=\"jc-error\">{{ error() }}</p> }\n @if (agent.value(); as a) {\n <div class=\"jc-summary\" data-testid=\"agent-summary\">\n <span class=\"jc-badge\" data-testid=\"agent-state\" [class.jc-health-healthy]=\"a.online\" [class.jc-health-offline]=\"!a.online && a.status === 'Active'\" [class.jc-health-none]=\"a.status !== 'Active'\">\n {{ a.status !== 'Active' ? a.status : a.online ? 'Online' : 'Not calling in' }}</span>\n <span>{{ a.operatingSystem }}</span>\n <span>version <span class=\"jc-mono\" data-testid=\"agent-version\">{{ a.version }}</span></span>\n <span class=\"jc-muted\">last seen {{ a.lastSeenAt | ago }}</span>\n @if (a.resourceId) { <a [routerLink]=\"['resources', a.resourceId] | jcLink\" [queryParams]=\"ctx.keep()\">Host resource</a> }\n </div>\n <p class=\"jc-muted jc-small\">Enrolled {{ a.enrolledAt | date: 'MMM d, y, HH:mm' }} by {{ a.enrolledBy }}. Certificate valid until {{ a.certificateNotAfter | date: 'MMM d, HH:mm' }}; the agent renews it when a third is left.</p>\n @if (a.status !== 'Active') {\n <p class=\"jc-notice\" data-testid=\"agent-revoked\">Revoked {{ a.revokedAt | date: 'MMM d, y, HH:mm' }} by {{ a.revokedBy }}: {{ a.revokeReason }}. The platform refuses its certificate for good.</p>\n @if (successor(); as s) {\n <p data-testid=\"agent-successor\">{{ a.hostname }} enrolled again {{ s.enrolledAt | date: 'MMM d, HH:mm' }} as <a [routerLink]=\"['agents', s.id] | jcLink\" [queryParams]=\"ctx.keep()\">a new agent</a>.</p>\n } @else {\n <section class=\"jc-card\" data-testid=\"reenroll\">\n <h2>Bring this host back</h2>\n <p class=\"jc-muted jc-small\">The host comes back as a new agent, with a new key: this one stays revoked, with its history. It needs a new token from an admin, put on the host.</p>\n <button mat-flat-button type=\"button\" data-testid=\"reenroll-create\" [disabled]=\"creating()\" (click)=\"reenroll(a.hostname)\">Create a token for {{ a.hostname }}</button>\n @if (reenrollError()) { <span class=\"jc-error\" data-testid=\"reenroll-error\"> {{ reenrollError() }}</span> }\n @if (token(); as t) {\n <div class=\"jc-notice\" data-testid=\"reenroll-token\">\n <p>Replace the token in the agent's token file (<span class=\"jc-mono\">Agent:EnrollmentTokenFile</span>) with this one. It works once, until {{ t.expiresAt | date: 'MMM d, HH:mm' }}, and <strong>won't be shown again</strong>.</p>\n <p class=\"jc-row\"><span class=\"jc-mono\" data-testid=\"reenroll-token-value\">{{ t.token }}</span>\n <button mat-button type=\"button\" (click)=\"copy(t.token)\">{{ copied() === 'copied' ? 'Copied' : copied() === 'selected' ? 'Selected: press Ctrl+C' : 'Copy' }}</button></p>\n <p>The agent notices it within seconds, sets its old identity aside and enrolls again: nothing else on the host changes. An agent from before 9 November doesn't: clear its data directory's identity files and restart it.</p>\n </div>\n }\n </section>\n }\n } @else {\n <section class=\"jc-card\">\n <h2>Ask the agent</h2>\n <form class=\"jc-form\" data-testid=\"command-form\" (ngSubmit)=\"issue()\">\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-wide\"><mat-label>Action</mat-label>\n <mat-select name=\"action\" data-testid=\"command-action\" [ngModel]=\"action()\" (ngModelChange)=\"choose($event)\">\n @for (o of actionList(); track o.name) {\n <mat-option [value]=\"o.name\" [disabled]=\"o.permitted === false\" [attr.data-testid]=\"'action-' + o.name\">\n {{ label(o.name) }}@if (o.custom) { <span class=\"jc-muted\"> · custom</span> }@if (o.permitted === false) { <span class=\"jc-muted\"> · not allowed on this host</span> }\n </mat-option>\n }\n </mat-select>\n </mat-form-field>\n @if (action() === 'agent.update') {\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-md\"><mat-label>Version</mat-label>\n <mat-select name=\"version\" data-testid=\"command-version\" [(ngModel)]=\"version\">\n @for (p of packages.value()?.items ?? []; track p.version) { <mat-option [value]=\"p.version\">{{ p.version }}</mat-option> }\n </mat-select>\n </mat-form-field>\n @if (packages.value()?.items?.length === 0) { <span class=\"jc-muted jc-small\">No signed packages are offered: see Agents:PackageDirectory.</span> }\n } @else {\n @for (p of selected()?.parameters ?? []; track p.name) {\n @if (p.type === 'boolean') {\n <mat-checkbox [name]=\"p.name\" [attr.data-testid]=\"'command-param-' + p.name\" [ngModel]=\"values()[p.name] === true\" (ngModelChange)=\"set(p.name, $event)\">{{ title(p) }}</mat-checkbox>\n } @else if (p.allowed?.length) {\n <mat-form-field subscriptSizing=\"dynamic\" [class.jc-field-md]=\"p.type !== 'string'\" [class.jc-field-wide]=\"p.type === 'string'\"><mat-label>{{ title(p) }}</mat-label>\n <mat-select [name]=\"p.name\" [attr.data-testid]=\"'command-param-' + p.name\" [ngModel]=\"values()[p.name] ?? ''\" (ngModelChange)=\"set(p.name, $event)\">\n @if (!p.required) { <mat-option value=\"\">Any</mat-option> }\n @for (v of p.allowed; track v) { <mat-option [value]=\"v\">{{ v }}</mat-option> }\n </mat-select>\n </mat-form-field>\n } @else {\n <mat-form-field subscriptSizing=\"dynamic\" [class.jc-field-sm]=\"p.type === 'integer'\" [class.jc-field-wide]=\"p.type === 'string'\"><mat-label>{{ title(p) }}</mat-label>\n <input matInput [type]=\"p.type === 'integer' ? 'number' : 'text'\" [name]=\"p.name\" [attr.data-testid]=\"'command-param-' + p.name\" [attr.min]=\"p.minimum\" [attr.max]=\"p.maximum\"\n [attr.maxlength]=\"p.maxLength\" [placeholder]=\"p.description ?? ''\" [ngModel]=\"values()[p.name] ?? ''\" (ngModelChange)=\"set(p.name, $event)\">\n </mat-form-field>\n }\n }\n }\n @if (needsApproval()) {\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-wide\"><mat-label>Why (for whoever approves it)</mat-label>\n <input matInput name=\"requestReason\" data-testid=\"request-reason\" maxlength=\"500\" [(ngModel)]=\"requestReason\">\n </mat-form-field>\n @if (selected()?.changing && agent.value()?.resourceId) {\n <mat-checkbox name=\"watchHost\" data-testid=\"request-watch-host\" [(ngModel)]=\"watchHost\">Fix this host's health: run only while it's unhealthy, and confirm recovery after</mat-checkbox>\n }\n }\n <div class=\"jc-form-actions\">\n <button mat-flat-button type=\"submit\" data-testid=\"command-issue\" [disabled]=\"issuing() || selected()?.permitted === false\">{{ needsApproval() ? 'Request' : action() === 'agent.update' ? 'Update' : 'Run' }}</button>\n @if (issueError()) { <span class=\"jc-error\" data-testid=\"command-error\">{{ issueError() }}</span> }\n @if (issued()) { <span class=\"jc-muted\" data-testid=\"command-issued\">{{ issued() }}</span> }\n </div>\n @if (selected(); as s) {\n <div class=\"jc-muted jc-small jc-form-actions\" data-testid=\"command-hint\">\n <div>{{ s.description }} <span data-testid=\"command-approval\">{{ s.risk }} risk: {{ approvalText(s.approval) }}.</span></div>\n @if (s.limits.length) { <div data-testid=\"command-limits\">On this host: {{ s.limits.join('; ') }}.</div> }\n </div>\n }\n </form>\n @if (actions.value(); as list) {\n @if (!list.reportedAt) {\n <p class=\"jc-notice\" data-testid=\"actions-not-reported\">This agent doesn't report what its host allows (it's older than this platform): the list shows the built-in actions, and one its host doesn't permit comes back <strong>Rejected</strong>.</p>\n } @else {\n <p class=\"jc-muted jc-small\">As the agent reported {{ list.reportedAt | ago }}, when it started. Its host still checks every command.</p>\n }\n }\n </section>\n }\n\n @if (requestList().length) {\n <section class=\"jc-card\" data-testid=\"requests\">\n <h2>Requests</h2>\n <table class=\"jc-table\">\n <thead><tr><th>Asked</th><th>Action</th><th>By, and why</th><th>State</th><th>Decided</th><th></th></tr></thead>\n <tbody>\n @for (r of requestList(); track r.id) {\n <tr [attr.data-testid]=\"'request-' + r.id\">\n <td class=\"jc-nowrap\">{{ r.requestedAt | date: 'MMM d, HH:mm:ss' }}</td>\n <td><strong>{{ r.action }}</strong><div class=\"jc-muted jc-small\">{{ r.risk }} risk</div></td>\n <td>{{ r.requestedBy }}<div class=\"jc-small\">{{ r.reason }}</div></td>\n <td class=\"jc-nowrap\"><span class=\"jc-badge\" [class.jc-health-degraded]=\"r.state === 'Pending'\" [class.jc-health-healthy]=\"r.state === 'Issued'\"\n [class.jc-health-none]=\"r.state !== 'Pending' && r.state !== 'Issued'\" data-testid=\"request-state\">{{ r.state === 'Pending' ? 'Waiting for approval' : r.state }}</span>\n @if (r.state === 'Pending') { <div class=\"jc-muted jc-small\">until {{ r.expiresAt | date: 'HH:mm' }}</div> }\n @if (r.verification && r.verification !== 'None') {\n <div class=\"jc-small\" data-testid=\"request-verification\" [class.jc-error]=\"r.verification === 'NotVerified'\" [title]=\"r.verificationNote ?? ''\">{{ verificationText(r.verification) }}</div>\n }</td>\n <td class=\"jc-small\">@if (r.decidedBy) { {{ r.decidedBy }}, {{ r.decidedAt | date: 'HH:mm' }} }@if (r.comment) { <div>{{ r.comment }}</div> }</td>\n <td class=\"jc-row-actions\">@if (r.state === 'Pending') { <button mat-button type=\"button\" [attr.data-testid]=\"'request-cancel-' + r.id\" (click)=\"cancelRequest(r.id)\">Cancel</button> }</td>\n </tr>\n }\n </tbody>\n </table>\n </section>\n }\n\n <section class=\"jc-card\" data-testid=\"commands\">\n <h2>Commands</h2>\n @if (commands.error()) { <p class=\"jc-error\">{{ commandsError() }}</p> }\n <table class=\"jc-table\">\n <thead><tr><th>Issued</th><th>Action</th><th>By</th><th>State</th><th>Answer</th></tr></thead>\n <tbody>\n @for (c of allCommands(); track c.id) {\n <tr [attr.data-testid]=\"'command-' + c.id\">\n <td class=\"jc-nowrap\">{{ c.issuedAt | date: 'MMM d, HH:mm:ss' }}</td>\n <td><strong>{{ c.action }}</strong>@if (describe(c); as d) { <div class=\"jc-small jc-mono\">{{ d }}</div> }</td>\n <td>{{ c.issuedBy }}</td>\n <td class=\"jc-nowrap\">\n <span class=\"jc-badge\" [class.jc-health-healthy]=\"c.state === 'Succeeded'\" [class.jc-health-unhealthy]=\"c.state === 'Failed' || c.state === 'Rejected'\"\n [class.jc-health-degraded]=\"waiting(c)\" [class.jc-health-none]=\"c.state === 'Expired' || c.state === 'Cancelled'\" data-testid=\"command-state\">{{ c.state }}</span>\n @if (c.durationMs !== null) { <div class=\"jc-muted jc-small\">{{ c.durationMs }} ms</div> }\n </td>\n <td class=\"jc-small\" data-testid=\"command-answer\">\n @if (c.reason) { <div [class.jc-bad]=\"c.state !== 'Succeeded'\">{{ c.reason | reason }}</div> }\n @if (c.state === 'Succeeded' && c.result) {\n @switch (c.action) {\n @case ('host.summary') {\n @if (summary(c); as h) {\n <div>{{ h.hostname }} · {{ h.operatingSystem }} {{ h.architecture }} · up {{ uptime(h.uptimeSeconds) }}</div>\n <div>{{ h.processorCount }} CPUs@if (h.loadAverage) { · load {{ h.loadAverage.join(' ') }} }@if (h.memoryTotalBytes) { · memory {{ bytes(h.memoryAvailableBytes) }} of {{ bytes(h.memoryTotalBytes) }} available }</div>\n }\n }\n @case ('disk.usage') {\n @if (disk(c); as d) {\n <table class=\"jc-kv\" data-testid=\"disk-result\">\n @for (f of fullestFirst(d, expanded().has(c.id)); track f.mountPoint) {\n <tr [class.jc-bad]=\"low(f)\">\n <td class=\"jc-mono\">{{ f.mountPoint }}</td><td>{{ f.format }}</td><td class=\"jc-nowrap\">{{ bytes(f.availableBytes) }} free of {{ bytes(f.totalBytes) }}</td>\n </tr>\n } @empty { <tr><td class=\"jc-muted\">No filesystems there.</td></tr> }\n </table>\n @if (d.filesystems.length > shown) {\n <button mat-button type=\"button\" [attr.data-testid]=\"'disk-toggle-' + c.id\" (click)=\"toggle(c.id)\">\n {{ expanded().has(c.id) ? 'Show the fullest ' + shown : 'Show all ' + d.filesystems.length }}</button>\n }\n @if (d.truncated) { <div class=\"jc-muted\">More filesystems than the agent reports at once.</div> }\n }\n }\n @case ('tcp.reachability') {\n @if (tcp(c); as t) {\n @if (t.reachable) { <div>Reachable at {{ t.address }} in {{ t.elapsedMs }} ms</div> }\n @else { <div class=\"jc-bad\">Not reachable after {{ t.elapsedMs }} ms: {{ t.error }}</div> }\n }\n }\n @case ('diagnostics.bundle') {\n @if (bundle(c); as b) {\n <div data-testid=\"bundle-result\">{{ bytes(b.sizeBytes) }} zip: {{ b.entries.length }} files@if (b.redacted) { · {{ b.redacted }} {{ b.redacted === 1 ? 'value' : 'values' }} redacted }\n <button mat-button type=\"button\" [attr.data-testid]=\"'bundle-download-' + c.id\" [disabled]=\"downloading() === b.bundleId\" (click)=\"download(b)\">Download</button>\n </div>\n @for (s of b.skipped; track s) { <div class=\"jc-muted\">Left out: {{ s }}</div> }\n @if (downloadErrors()[b.bundleId]; as e) { <div class=\"jc-error\" [attr.data-testid]=\"'bundle-error-' + c.id\">{{ e }}</div> }\n }\n }\n @default {\n @if (flat(c.result); as rows) {\n <table class=\"jc-kv\" data-testid=\"custom-result\">@for (r of rows; track r[0]) { <tr><td>{{ r[0] }}</td><td class=\"jc-mono\">{{ r[1] }}</td></tr> }</table>\n } @else { <pre class=\"jc-mono\" style=\"white-space: pre-wrap; margin: 0\" data-testid=\"custom-result\">{{ json(c.result) }}</pre> }\n }\n }\n }\n @if (waiting(c)) { <div class=\"jc-muted\">{{ c.state === 'Pending' ? 'Waiting for the agent to call in' : 'Handed to the agent' }}, until {{ c.expiresAt | date: 'HH:mm:ss' }}</div> }\n </td>\n </tr>\n } @empty { <tr><td colspan=\"5\" class=\"jc-muted\">Nothing asked yet.</td></tr> }\n </tbody>\n </table>\n @if (nextCursor()) { <button mat-button type=\"button\" data-testid=\"commands-older\" (click)=\"loadOlder()\">Older</button> }\n </section>\n\n @if (a.status === 'Active') {\n <section class=\"jc-card\">\n <h2>Revoke</h2>\n <p class=\"jc-muted jc-small\">The agent stops at its next call: the platform refuses its certificate from then on, and commands still waiting are cancelled. It can't be undone; the host would enroll again with a new token.</p>\n <form class=\"jc-form\" (ngSubmit)=\"revoke()\">\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-wide\"><mat-label>Why</mat-label><input matInput name=\"reason\" data-testid=\"revoke-reason\" [(ngModel)]=\"reason\" maxlength=\"500\" (ngModelChange)=\"confirming.set(false)\"></mat-form-field>\n @if (confirming()) {\n <button mat-flat-button color=\"warn\" type=\"submit\" data-testid=\"revoke-confirm\" [disabled]=\"revoking()\">Revoke {{ a.hostname }}</button>\n <button mat-button type=\"button\" (click)=\"confirming.set(false)\">Cancel</button>\n } @else {\n <button mat-stroked-button type=\"submit\" data-testid=\"revoke\" [disabled]=\"!reason.trim()\">Revoke</button>\n }\n @if (revokeError()) { <span class=\"jc-error\" data-testid=\"revoke-error\">{{ revokeError() }}</span> }\n </form>\n </section>\n }\n }`,\n})\nexport class AgentPage {\n protected readonly ctx = inject(ContextService);\n private readonly api = inject(ApiService);\n private readonly approvalCount = inject(ApprovalCount);\n readonly id = input.required<string>();\n protected readonly action = signal('host.summary');\n /** The form's values for the chosen action, by parameter name. */\n protected readonly values = signal<Record<string, unknown>>({});\n protected readonly issuing = signal(false);\n protected readonly issueError = signal('');\n protected readonly confirming = signal(false);\n protected readonly revoking = signal(false);\n protected readonly revokeError = signal('');\n protected version = '';\n protected reason = '';\n protected requestReason = '';\n /** Aim the request at this agent's host: checked unhealthy before it runs, and watched for recovery after. */\n protected watchHost = false;\n /** What happened to the last request, when it didn't simply run. */\n protected readonly issued = signal('');\n protected readonly needsApproval = computed(() => (this.selected()?.approval ?? 'None') !== 'None');\n protected readonly requests = apiResource({ params: () => this.id(), stream: ({ params }) => this.api.actionRequests({ agentId: params, limit: 20 }) });\n protected readonly requestList = computed(() => this.requests.value()?.items ?? []);\n protected readonly creating = signal(false);\n protected readonly reenrollError = signal('');\n protected readonly token = signal<EnrollmentToken | null>(null);\n protected readonly copied = signal<'' | 'copied' | 'selected'>('');\n\n /** For a revoked agent: the active one its host enrolled as since, if any. */\n private readonly everyone = apiResource({ params: () => this.agent.value()?.status === 'Revoked' || undefined, stream: () => this.api.agents(true) });\n protected readonly successor = computed(() => {\n const revoked = this.agent.value();\n if (!revoked?.revokedAt) return undefined;\n return (this.everyone.value()?.items ?? []).find(a => a.status === 'Active' && a.hostname === revoked.hostname && Date.parse(a.enrolledAt) > Date.parse(revoked.revokedAt!));\n });\n\n /** What the agent reported it can run, with its host's bounds: the menu and the form come from it, custom actions included. */\n protected readonly actions = apiResource({ params: () => this.id(), stream: ({ params }) => this.api.agentActions(params) });\n protected readonly actionList = computed(() => this.actions.value()?.items ?? []);\n protected readonly selected = computed<AgentAction | undefined>(() => this.actionList().find(a => a.name === this.action()));\n\n protected readonly agent = apiResource({ params: () => this.id(), stream: ({ params }) => this.api.agent(params) });\n protected readonly error = computed(() => problemText(this.agent.error()));\n protected readonly commands = apiResource({ params: () => this.id(), stream: ({ params }) => this.api.agentCommands(params) });\n protected readonly commandsError = computed(() => problemText(this.commands.error()));\n /** Asked for only once someone picks an update, since only admins can use it. */\n protected readonly packages = apiResource({ params: () => this.action() === 'agent.update' || undefined, stream: () => this.api.agentPackages() });\n private readonly older = signal<{ items: AgentCommand[]; cursor: string | null } | null>(null);\n protected readonly allCommands = computed(() => {\n const first = this.commands.value()?.items ?? [];\n const seen = new Set(first.map(c => c.id));\n return [...first, ...(this.older()?.items ?? []).filter(c => !seen.has(c.id))];\n });\n protected readonly nextCursor = computed(() => this.older() ? this.older()!.cursor : this.commands.value()?.nextCursor ?? null);\n\n constructor() {\n // Once the list is in, start on an action the host permits, with its defaults filled in.\n effect(() => {\n const list = this.actionList();\n if (list.length === 0) return;\n const current = list.find(a => a.name === untracked(this.action));\n if (!current || current.permitted === false) this.choose((list.find(a => a.permitted !== false) ?? list[0]).name);\n else if (Object.keys(untracked(this.values)).length === 0) this.choose(current.name);\n });\n // While a command waits, look again every 2 seconds, and at the agent too, since an update changes its version. While a request waits for\n // approval, every 5: someone else decides it.\n effect(onCleanup => {\n const running = this.allCommands().some(c => this.waiting(c));\n const deciding = this.requestList().some(r => r.state === 'Pending');\n if (!running && !deciding) return;\n const timer = setTimeout(() => { this.commands.reload(); this.agent.reload(); this.requests.reload(); }, running ? 2000 : 5000);\n onCleanup(() => clearTimeout(timer));\n });\n }\n\n protected waiting(c: AgentCommand): boolean { return WAITING.includes(c.state) && new Date(c.expiresAt).getTime() > Date.now(); }\n\n protected describe(c: AgentCommand): string {\n const p = c.parameters ?? {};\n switch (c.action) {\n case 'disk.usage': return p['pathPrefix'] ? `under ${p['pathPrefix']}` : 'all filesystems';\n case 'tcp.reachability': return `${p['host']}:${p['port']}, wait ${p['timeoutMs']} ms`;\n case 'agent.update': return `to ${p['version']}`;\n default: return Object.entries(p).map(([k, v]) => `${k}=${typeof v === 'string' ? v : JSON.stringify(v)}`).join(', ');\n }\n }\n\n /** The built-ins by name as people say them; a custom action by its own name. */\n protected label(name: string): string { return LABELS[name] ?? name; }\n\n protected title(p: ActionParameter): string {\n const words = PARAMETER_LABELS[p.name] ?? p.name.replace(/([A-Z])/g, ' $1').replace(/^./, c => c.toUpperCase());\n return p.required || p.type === 'boolean' ? words : `${words} (optional)`;\n }\n\n protected choose(name: string) {\n this.action.set(name);\n this.issueError.set('');\n const defaults: Record<string, unknown> = {};\n for (const p of this.actionList().find(a => a.name === name)?.parameters ?? []) {\n if (p.default !== null) defaults[p.name] = p.type === 'integer' ? Number(p.default) : p.type === 'boolean' ? p.default === 'true' : p.default;\n else if (p.required && p.allowed?.length === 1) defaults[p.name] = p.allowed[0];\n }\n this.values.set(defaults);\n }\n\n protected set(name: string, value: unknown) { this.values.update(v => ({ ...v, [name]: value })); }\n\n /** A result of plain values reads as a table; anything nested as JSON. */\n protected flat(result: unknown): [string, string][] | null {\n if (!result || typeof result !== 'object' || Array.isArray(result)) return null;\n const entries = Object.entries(result as Record<string, unknown>);\n return entries.every(([, v]) => v === null || ['string', 'number', 'boolean'].includes(typeof v)) ? entries.map(([k, v]) => [k, v === null ? '—' : String(v)]) : null;\n }\n\n protected summary(c: AgentCommand) { return c.result as unknown as HostSummary; }\n protected bundle(c: AgentCommand) { return c.result as unknown as BundleSummary; }\n protected readonly downloading = signal<string | null>(null);\n /** A failed download's reason, by bundle: shown under that bundle only. */\n protected readonly downloadErrors = signal<Record<string, string>>({});\n\n /** Fetches the zip with the user's token and hands it to the browser as a file. */\n protected download(b: BundleSummary) {\n this.downloading.set(b.bundleId);\n this.downloadErrors.update(e => ({ ...e, [b.bundleId]: '' }));\n this.api.downloadBundle(this.id(), b.bundleId).subscribe({\n next: response => {\n this.downloading.set(null);\n const name = /filename=\"?([^\";]+)\"?/.exec(response.headers.get('content-disposition') ?? '')?.[1] ?? `juice-bundle-${b.bundleId}.zip`;\n const url = URL.createObjectURL(response.body!);\n const link = document.createElement('a');\n link.href = url;\n link.download = name;\n link.click();\n setTimeout(() => URL.revokeObjectURL(url), 10_000);\n },\n error: e => {\n this.downloading.set(null);\n const reason = e?.status === 404 ? 'The bundle is gone: bundles are kept 14 days by default.'\n : e?.status === 403 ? 'Downloading a bundle takes an operator or an admin: its log excerpts can say more than the rest of the Console.' : problemText(e);\n this.downloadErrors.update(errors => ({ ...errors, [b.bundleId]: reason }));\n },\n });\n }\n protected disk(c: AgentCommand) { return c.result as unknown as DiskUsage; }\n protected tcp(c: AgentCommand) { return c.result as unknown as TcpReachability; }\n /** A whole host can have dozens of mounts: the fullest come first, and the rest on request. */\n protected readonly shown = 8;\n protected readonly expanded = signal(new Set<string>());\n protected toggle(id: string) { this.expanded.update(s => { const next = new Set(s); if (!next.delete(id)) next.add(id); return next; }); }\n protected fullestFirst(d: DiskUsage, all: boolean): Filesystem[] {\n const free = (f: Filesystem) => (f.totalBytes > 0 ? f.availableBytes / f.totalBytes : 1);\n const sizable = (f: Filesystem) => Number(f.totalBytes >= 1024 ** 3);\n const sorted = [...d.filesystems].sort((a, b) => Number(this.low(b)) - Number(this.low(a)) || sizable(b) - sizable(a) || free(a) - free(b));\n return all ? sorted : sorted.slice(0, this.shown);\n }\n /** Under 10 % free. Small read-only images (ISO, modules, squashfs) are always full by design, so only filesystems of 1 GB or more count. */\n protected low(f: Filesystem): boolean { return f.totalBytes >= 1024 ** 3 && f.availableBytes / f.totalBytes < 0.1; }\n protected bytes(n: number | null) { return formatBytes(n); }\n protected uptime(s: number) { return formatUptime(s); }\n protected json(v: unknown) { return JSON.stringify(v, null, 2); }\n\n /** The form's values, typed as the action declares them; an empty optional one left out. The API and the agent check them again. */\n private parameters(): Record<string, unknown> {\n if (this.action() === 'agent.update') return { version: this.version };\n const values = this.values();\n const out: Record<string, unknown> = {};\n for (const p of this.selected()?.parameters ?? []) {\n const v = values[p.name];\n if (p.type === 'boolean') { if (v === true || p.required) out[p.name] = v === true; continue; }\n if (v === undefined || v === null || v === '') continue;\n out[p.name] = p.type === 'integer' ? Number(v) : String(v).trim();\n }\n return out;\n }\n\n /** Whether it fixed what it was for: only health from telemetry after the action says so, never the agent. */\n protected verificationText(verification: string): string {\n switch (verification) {\n case 'Verifying': return 'Watching health for recovery';\n case 'Verified': return 'Recovery confirmed by health';\n case 'NotVerified': return 'Recovery not confirmed';\n default: return verification;\n }\n }\n\n protected approvalText(policy: string): string {\n switch (policy) {\n case 'None': return 'runs when asked';\n case 'Admin': return 'needs an admin: an admin\\'s request runs at once, an operator\\'s waits for an admin to approve it';\n default: return 'needs a second person: an admin other than whoever asks approves it';\n }\n }\n\n /** What needs no one else runs; what needs approval becomes a request, which runs once approved. */\n protected issue() {\n const action = this.action();\n this.issuing.set(true);\n this.issueError.set('');\n this.issued.set('');\n const failed = (e: unknown) => {\n this.issuing.set(false);\n this.issueError.set((e as { status?: number }).status === 403 ? 'Asking an agent needs the operator or admin role.' : problemText(e));\n };\n if (!this.needsApproval()) {\n this.api.issueCommand(this.id(), action, this.parameters()).subscribe({ next: () => { this.issuing.set(false); this.commands.reload(); }, error: failed });\n return;\n }\n const host = this.watchHost && this.selected()?.changing ? this.agent.value()?.resourceId : null;\n this.api.requestAction(this.id(), action, this.parameters(), this.requestReason.trim(), host ? { type: 'Host', id: host } : null).subscribe({\n next: r => {\n this.issuing.set(false);\n this.requestReason = '';\n this.issued.set(r.state !== 'Issued' ? 'Requested: it runs once approved, on the Approvals page.' : r.policy === 'None' ? 'Needs no approval as asked: running.' : 'Approved by your role: running.');\n this.requests.reload();\n this.commands.reload();\n this.approvalCount.refresh();\n },\n error: failed,\n });\n }\n\n protected cancelRequest(id: string) {\n this.api.cancelRequest(id).subscribe({ next: () => { this.requests.reload(); this.approvalCount.refresh(); }, error: e => this.issueError.set(problemText(e)) });\n }\n\n protected loadOlder() {\n const cursor = this.nextCursor();\n if (!cursor) return;\n this.api.agentCommands(this.id(), cursor).subscribe({\n next: page => this.older.update(o => ({ items: [...(o?.items ?? []), ...page.items], cursor: page.nextCursor })),\n error: e => this.issueError.set(problemText(e)),\n });\n }\n\n /** A token for this host to enroll again with. Admins only; shown once. */\n protected reenroll(hostname: string) {\n this.creating.set(true);\n this.reenrollError.set('');\n this.copied.set('');\n this.api.createEnrollmentToken(`re-enroll ${hostname}`, 60).subscribe({\n next: t => { this.creating.set(false); this.token.set(t); },\n error: e => { this.creating.set(false); this.reenrollError.set((e as { status?: number }).status === 403 ? 'Enrolling an agent needs the admin role.' : problemText(e)); },\n });\n }\n\n protected copy(text: string) {\n copyText(text, document.querySelector('[data-testid=reenroll-token-value]')).then(done => this.copied.set(done));\n }\n\n protected revoke() {\n if (!this.confirming()) { this.confirming.set(true); return; }\n this.revoking.set(true);\n this.revokeError.set('');\n this.api.revokeAgent(this.id(), this.reason.trim()).subscribe({\n next: () => { this.revoking.set(false); this.confirming.set(false); this.agent.reload(); this.commands.reload(); },\n error: e => { this.revoking.set(false); this.revokeError.set((e as { status?: number }).status === 403 ? 'Revoking an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AiB;IAAmB;IAAoB;IAAgB;IAAsB;IAAiB;IAAY;IAAS;GAAU;GACrM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8NX,CAAA"}
@@ -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,UAAkC;CAAE,MAAM;CAAa,OAAO;CAAc,MAAM;CAAU,MAAM;CAAW,MAAM;AAAQ;AAiHjI,IAAa,UAAb,MAAa,QAAO;CACT,MAAM,MAAM,SAAkB,GAAA,YAAA,CAAA,EAAA,WAAA,MAAA,CAAA,+BAAA,CAAA,CAAA;CACpB,MAAM,OAAO,cAAc;CAC7B,MAAM,OAAO,UAAU;CACrB,SAAS,YAAY;EAAE,cAAc,KAAK,IAAG;EAAI,SAAS,EAAE,aAAa,KAAK,IAAI,IAAI,MAAM;CAAC,CAAE;CAC/F,QAAQ,eAAe,YAAY,KAAK,OAAO,MAAK,CAAE,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CACxD,YAAY;CACZ,UAAU;CACV,OAAO;CAEP,QAAQ;CACR,QAAQ;CACjB,WAAW,MAAY;EAAI,OAAO,QAAQ,SAAS;CAAM;CAEzD,QAAQ,GAAa;EAAI,OAAO,KAAK,MAAM,EAAE,aAAa;CAAG;CAC7D,gBAAgB,MAAc;EAAI,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC,QAAO;CAAI;CAC9D,QAAQ,KAAW;EAAI,OAAO,IAAI,IAAI,MAAM,GAAG,EAAE,uBAAM,IAAI,KAAI,EAAE,CAAC,YAAW,CAAE,CAAC,MAAM,GAAG,EAAE;CAAG;CAC9F,SAAS,KAAW;EAC5B,MAAM,QAAQ;GAAC,CAAC,IAAI,gBAAgB,eAAe;GAAG,CAAC,IAAI,mBAAmB,UAAU;GAAG,CAAC,IAAI,sBAAsB,eAAe;EAAC,CAAC,CACpI,QAAQ,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