@juice-js/observability 1.4.0 → 1.5.0-alpha.45

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.
@@ -58,7 +58,11 @@ const NEW_RULE = {
58
58
  var RulesPage = class RulesPage {
59
59
  ctx = inject(ContextService);
60
60
  api = inject(ApiService);
61
- templates = Object.keys(TEMPLATES).filter((t) => t !== "SloBurn");
61
+ templates = computed(() => {
62
+ const off = new Set((this.data.value()?.packs ?? []).filter((p) => !p.enabled).flatMap((p) => p.ruleTemplates));
63
+ const current = this.editing()?.template;
64
+ return Object.keys(TEMPLATES).filter((t) => t !== "SloBurn" && (!off.has(t) || t === current));
65
+ }, ...ngDevMode ? [{ debugName: "templates" }] : /* istanbul ignore next */ []);
62
66
  form = signal(null, ...ngDevMode ? [{ debugName: "form" }] : /* istanbul ignore next */ []);
63
67
  editing = signal(null, ...ngDevMode ? [{ debugName: "editing" }] : /* istanbul ignore next */ []);
64
68
  saving = signal(false, ...ngDevMode ? [{ debugName: "saving" }] : /* istanbul ignore next */ []);
@@ -66,7 +70,8 @@ var RulesPage = class RulesPage {
66
70
  data = apiResource({ stream: () => forkJoin({
67
71
  rules: this.api.rules().pipe(map((p) => p.items)),
68
72
  firing: this.api.allAlerts({ state: "firing" }).pipe(map((p) => p.items)),
69
- pending: this.api.allAlerts({ state: "pending" }).pipe(map((p) => p.items))
73
+ pending: this.api.allAlerts({ state: "pending" }).pipe(map((p) => p.items)),
74
+ packs: this.api.signalPacks()
70
75
  }) });
71
76
  error = computed(() => problemText(this.data.error()), ...ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []);
72
77
  rows = computed(() => {
@@ -86,6 +91,9 @@ var RulesPage = class RulesPage {
86
91
  hint(template) {
87
92
  return TEMPLATES[template] ?? "";
88
93
  }
94
+ offPack(template) {
95
+ return this.data.value()?.packs.find((p) => !p.enabled && p.ruleTemplates.includes(template))?.name ?? null;
96
+ }
89
97
  startNew() {
90
98
  this.editing.set(null);
91
99
  this.saveError.set("");
@@ -180,7 +188,7 @@ var RulesPage = class RulesPage {
180
188
  @if (!editing()) { <mat-form-field subscriptSizing="dynamic"><mat-label>Key</mat-label><input matInput name="key" [(ngModel)]="f.key" required></mat-form-field> }
181
189
  <mat-form-field subscriptSizing="dynamic" class="jc-field-wide"><mat-label>Name</mat-label><input matInput name="name" [(ngModel)]="f.name" required></mat-form-field>
182
190
  <mat-form-field subscriptSizing="dynamic"><mat-label>Template</mat-label>
183
- <mat-select name="template" [(ngModel)]="f.template">@for (t of templates; track t) { <mat-option [value]="t">{{ t }}</mat-option> }</mat-select>
191
+ <mat-select name="template" [(ngModel)]="f.template">@for (t of templates(); track t) { <mat-option [value]="t">{{ t }}</mat-option> }</mat-select>
184
192
  </mat-form-field>
185
193
  <mat-form-field subscriptSizing="dynamic" class="jc-field-sm"><mat-label>Severity</mat-label>
186
194
  <mat-select name="severity" [(ngModel)]="f.severity"><mat-option value="Info">Info</mat-option><mat-option value="Warning">Warning</mat-option><mat-option value="Critical">Critical</mat-option></mat-select>
@@ -192,6 +200,7 @@ var RulesPage = class RulesPage {
192
200
  <mat-form-field subscriptSizing="dynamic"><mat-label>Environment (all if empty)</mat-label><input matInput name="environment" [(ngModel)]="f.environment"></mat-form-field>
193
201
  }
194
202
  <p class="jc-muted jc-small jc-form-actions">{{ hint(f.template) }}</p>
203
+ @if (offPack(f.template); as pack) { <p class="jc-muted jc-small jc-form-actions" data-testid="rule-pack-off">{{ f.template }} reads the {{ pack }} signal pack, which this deployment has switched off: the rule can only be saved disabled.</p> }
195
204
  <mat-form-field subscriptSizing="dynamic" class="jc-field-sm"><mat-label>Threshold</mat-label><input matInput type="number" step="any" name="threshold" [(ngModel)]="f.threshold" required></mat-form-field>
196
205
  <mat-form-field subscriptSizing="dynamic" class="jc-field-sm"><mat-label>Recovery threshold</mat-label><input matInput type="number" step="any" name="recoveryThreshold" [(ngModel)]="f.recoveryThreshold"></mat-form-field>
197
206
  <mat-form-field subscriptSizing="dynamic" class="jc-field-sm"><mat-label>Minimum samples</mat-label><input matInput type="number" name="minimumSamples" [(ngModel)]="f.minimumSamples"></mat-form-field>
@@ -215,7 +224,8 @@ var RulesPage = class RulesPage {
215
224
  <tbody>
216
225
  @for (r of rows(); track r.key) {
217
226
  <tr [class.jc-muted]="!r.enabled">
218
- <td><strong>{{ r.name }}</strong><div class="jc-muted jc-small">{{ r.key }}@if (!r.enabled) { · disabled }@if (r.managedBy === 'config') { · from the rules file }@if (r.managedBy === 'platform') { · the platform's, for SLOs }</div></td>
227
+ <td><strong>{{ r.name }}</strong><div class="jc-muted jc-small">{{ r.key }}@if (!r.enabled) { · disabled }@if (r.managedBy === 'config') { · from the rules file }@if (r.managedBy === 'platform') { · the platform's, for SLOs }</div>
228
+ @if (r.quiet) { <div class="jc-error jc-small" [attr.data-testid]="'rule-quiet-' + r.key">Never observes: {{ r.quiet }}.</div> }</td>
219
229
  <td>{{ r.template }}</td>
220
230
  <td>{{ r.severity }}</td>
221
231
  <td>{{ r.definition['threshold'] ?? '—' }}</td>
@@ -521,7 +531,7 @@ i0.ɵɵngDeclareClassMetadata({
521
531
  @if (!editing()) { <mat-form-field subscriptSizing="dynamic"><mat-label>Key</mat-label><input matInput name="key" [(ngModel)]="f.key" required></mat-form-field> }
522
532
  <mat-form-field subscriptSizing="dynamic" class="jc-field-wide"><mat-label>Name</mat-label><input matInput name="name" [(ngModel)]="f.name" required></mat-form-field>
523
533
  <mat-form-field subscriptSizing="dynamic"><mat-label>Template</mat-label>
524
- <mat-select name="template" [(ngModel)]="f.template">@for (t of templates; track t) { <mat-option [value]="t">{{ t }}</mat-option> }</mat-select>
534
+ <mat-select name="template" [(ngModel)]="f.template">@for (t of templates(); track t) { <mat-option [value]="t">{{ t }}</mat-option> }</mat-select>
525
535
  </mat-form-field>
526
536
  <mat-form-field subscriptSizing="dynamic" class="jc-field-sm"><mat-label>Severity</mat-label>
527
537
  <mat-select name="severity" [(ngModel)]="f.severity"><mat-option value="Info">Info</mat-option><mat-option value="Warning">Warning</mat-option><mat-option value="Critical">Critical</mat-option></mat-select>
@@ -533,6 +543,7 @@ i0.ɵɵngDeclareClassMetadata({
533
543
  <mat-form-field subscriptSizing="dynamic"><mat-label>Environment (all if empty)</mat-label><input matInput name="environment" [(ngModel)]="f.environment"></mat-form-field>
534
544
  }
535
545
  <p class="jc-muted jc-small jc-form-actions">{{ hint(f.template) }}</p>
546
+ @if (offPack(f.template); as pack) { <p class="jc-muted jc-small jc-form-actions" data-testid="rule-pack-off">{{ f.template }} reads the {{ pack }} signal pack, which this deployment has switched off: the rule can only be saved disabled.</p> }
536
547
  <mat-form-field subscriptSizing="dynamic" class="jc-field-sm"><mat-label>Threshold</mat-label><input matInput type="number" step="any" name="threshold" [(ngModel)]="f.threshold" required></mat-form-field>
537
548
  <mat-form-field subscriptSizing="dynamic" class="jc-field-sm"><mat-label>Recovery threshold</mat-label><input matInput type="number" step="any" name="recoveryThreshold" [(ngModel)]="f.recoveryThreshold"></mat-form-field>
538
549
  <mat-form-field subscriptSizing="dynamic" class="jc-field-sm"><mat-label>Minimum samples</mat-label><input matInput type="number" name="minimumSamples" [(ngModel)]="f.minimumSamples"></mat-form-field>
@@ -556,7 +567,8 @@ i0.ɵɵngDeclareClassMetadata({
556
567
  <tbody>
557
568
  @for (r of rows(); track r.key) {
558
569
  <tr [class.jc-muted]="!r.enabled">
559
- <td><strong>{{ r.name }}</strong><div class="jc-muted jc-small">{{ r.key }}@if (!r.enabled) { · disabled }@if (r.managedBy === 'config') { · from the rules file }@if (r.managedBy === 'platform') { · the platform's, for SLOs }</div></td>
570
+ <td><strong>{{ r.name }}</strong><div class="jc-muted jc-small">{{ r.key }}@if (!r.enabled) { · disabled }@if (r.managedBy === 'config') { · from the rules file }@if (r.managedBy === 'platform') { · the platform's, for SLOs }</div>
571
+ @if (r.quiet) { <div class="jc-error jc-small" [attr.data-testid]="'rule-quiet-' + r.key">Never observes: {{ r.quiet }}.</div> }</td>
560
572
  <td>{{ r.template }}</td>
561
573
  <td>{{ r.severity }}</td>
562
574
  <td>{{ r.definition['threshold'] ?? '—' }}</td>
@@ -578,4 +590,4 @@ i0.ɵɵngDeclareClassMetadata({
578
590
  });
579
591
  export { RulesPage };
580
592
 
581
- //# sourceMappingURL=juice-js-observability-rules.page-AbY-0A8n.mjs.map
593
+ //# sourceMappingURL=juice-js-observability-rules.page-DXORXLHp.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"juice-js-observability-rules.page-DXORXLHp.mjs","names":[],"sources":["../../../../projects/juice-js/observability/src/lib/pages/rules.page.ts"],"sourcesContent":["import { LinkPipe } from '../core/options';\nimport { ChangeDetectionStrategy, Component, computed, inject, signal } from '@angular/core';\nimport { FormsModule } from '@angular/forms';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatCheckboxModule } from '@angular/material/checkbox';\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 { apiResource } from '../shared/resource';\nimport { RouterLink } from '@angular/router';\nimport { Observable, forkJoin, map } from 'rxjs';\nimport { ApiService } from '../core/api.service';\nimport { ContextService } from '../core/context.service';\nimport { Rule } from '../core/models';\nimport { AgoPipe } from '../shared/format';\nimport { ContextBar } from '../shared/ui';\nimport { problemText } from '../shared/telemetry';\n\nconst TEMPLATES: Record<string, string> = {\n ErrorRate: 'Ratio of failed requests, 0 to 1. Fires above the threshold.',\n LatencyP95: 'Milliseconds at the 95th percentile. Fires above the threshold.',\n ThroughputAbsent: 'Requests in the window, for a service that had traffic. Fires at or below the threshold.',\n DeliveryFailureRate: 'Ratio of failed deliveries, 0 to 1. Fires above the threshold.',\n HostMemory: 'Ratio of host memory used, 0 to 1. Fires above the threshold.',\n MediatorErrors: 'Mediator errors in the window. Fires above the threshold.',\n ConsumerFailures: 'Failed consumer messages in the window. Fires above the threshold.',\n SloBurn: \"An SLO's burn rate over a long and a short window. Fires when both reach the rate; one alert per SLO.\",\n};\n\n/** A TimeSpan as the API writes it (`1.02:03:04`) in seconds. */\nfunction seconds(value: unknown): number {\n const match = /^(?:(\\d+)\\.)?(\\d+):(\\d+):(\\d+)/.exec(String(value ?? ''));\n return match ? (+(match[1] ?? 0)) * 86400 + +match[2] * 3600 + +match[3] * 60 + +match[4] : 0;\n}\n\nfunction span(total: number): string {\n const s = Math.max(0, Math.round(total || 0));\n const pad = (n: number) => String(n).padStart(2, '0');\n const days = Math.floor(s / 86400);\n return `${days ? `${days}.` : ''}${pad(Math.floor(s / 3600) % 24)}:${pad(Math.floor(s / 60) % 60)}:${pad(s % 60)}`;\n}\n\ninterface RuleForm {\n key: string; name: string; template: string; severity: string; service: string; environment: string; host: string; threshold: number | null; recoveryThreshold: number | null;\n minimumSamples: number; scheduleSeconds: number; windowSeconds: number; forSeconds: number; recoverySeconds: number; cooldownSeconds: number; enabled: boolean;\n}\n\nconst NEW_RULE: RuleForm = {\n key: '', name: '', template: 'ErrorRate', severity: 'Warning', service: '', environment: '', host: '', threshold: null, recoveryThreshold: null,\n minimumSamples: 10, scheduleSeconds: 60, windowSeconds: 300, forSeconds: 120, recoverySeconds: 120, cooldownSeconds: 600, enabled: true,\n};\n\n/**\n * Rules and their current state (Console requirements §14), and changing them for admins. They stay typed templates (D5): this page never takes a query.\n * A rule in the deployment's file is shown but changed there. Disabling one, or changing what it watches, closes its open alerts, which the form says first.\n */\n@Component({\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [LinkPipe, RouterLink, FormsModule, MatButtonModule, MatCheckboxModule, MatFormFieldModule, MatInputModule, MatProgressBarModule, MatSelectModule, ContextBar, AgoPipe],\n template: `\n <jc-context-bar>\n <h1>Rules</h1>\n <span class=\"jc-spacer\"></span>\n <button mat-flat-button type=\"button\" data-testid=\"rule-new\" (click)=\"startNew()\">New rule</button>\n </jc-context-bar>\n @if (data.isLoading()) { <mat-progress-bar mode=\"indeterminate\" /> }\n @if (data.error()) { <p class=\"jc-error\">{{ error() }}</p> }\n @if (form(); as f) {\n <section class=\"jc-card\" data-testid=\"rule-form\">\n <h2>{{ editing() ? 'Change ' + editing()!.key : 'New rule' }}</h2>\n <form class=\"jc-form\" (ngSubmit)=\"save(f)\">\n @if (!editing()) { <mat-form-field subscriptSizing=\"dynamic\"><mat-label>Key</mat-label><input matInput name=\"key\" [(ngModel)]=\"f.key\" required></mat-form-field> }\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-wide\"><mat-label>Name</mat-label><input matInput name=\"name\" [(ngModel)]=\"f.name\" required></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\"><mat-label>Template</mat-label>\n <mat-select name=\"template\" [(ngModel)]=\"f.template\">@for (t of templates(); track t) { <mat-option [value]=\"t\">{{ t }}</mat-option> }</mat-select>\n </mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-sm\"><mat-label>Severity</mat-label>\n <mat-select name=\"severity\" [(ngModel)]=\"f.severity\"><mat-option value=\"Info\">Info</mat-option><mat-option value=\"Warning\">Warning</mat-option><mat-option value=\"Critical\">Critical</mat-option></mat-select>\n </mat-form-field>\n @if (f.template === 'HostMemory') {\n <mat-form-field subscriptSizing=\"dynamic\"><mat-label>Host (all if empty)</mat-label><input matInput name=\"host\" [(ngModel)]=\"f.host\"></mat-form-field>\n } @else {\n <mat-form-field subscriptSizing=\"dynamic\"><mat-label>Service (all if empty)</mat-label><input matInput name=\"service\" [(ngModel)]=\"f.service\"></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\"><mat-label>Environment (all if empty)</mat-label><input matInput name=\"environment\" [(ngModel)]=\"f.environment\"></mat-form-field>\n }\n <p class=\"jc-muted jc-small jc-form-actions\">{{ hint(f.template) }}</p>\n @if (offPack(f.template); as pack) { <p class=\"jc-muted jc-small jc-form-actions\" data-testid=\"rule-pack-off\">{{ f.template }} reads the {{ pack }} signal pack, which this deployment has switched off: the rule can only be saved disabled.</p> }\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-sm\"><mat-label>Threshold</mat-label><input matInput type=\"number\" step=\"any\" name=\"threshold\" [(ngModel)]=\"f.threshold\" required></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-sm\"><mat-label>Recovery threshold</mat-label><input matInput type=\"number\" step=\"any\" name=\"recoveryThreshold\" [(ngModel)]=\"f.recoveryThreshold\"></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-sm\"><mat-label>Minimum samples</mat-label><input matInput type=\"number\" name=\"minimumSamples\" [(ngModel)]=\"f.minimumSamples\"></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-sm\"><mat-label>Every (s)</mat-label><input matInput type=\"number\" name=\"schedule\" [(ngModel)]=\"f.scheduleSeconds\"></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-sm\"><mat-label>Window (s)</mat-label><input matInput type=\"number\" name=\"window\" [(ngModel)]=\"f.windowSeconds\"></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-sm\"><mat-label>Fire after (s)</mat-label><input matInput type=\"number\" name=\"for\" [(ngModel)]=\"f.forSeconds\"></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-sm\"><mat-label>Recover after (s)</mat-label><input matInput type=\"number\" name=\"recovery\" [(ngModel)]=\"f.recoverySeconds\"></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-sm\"><mat-label>Cooldown (s)</mat-label><input matInput type=\"number\" name=\"cooldown\" [(ngModel)]=\"f.cooldownSeconds\"></mat-form-field>\n <mat-checkbox name=\"enabled\" [(ngModel)]=\"f.enabled\">Enabled</mat-checkbox>\n @if (editing()) { <p class=\"jc-muted jc-small jc-form-actions\">Disabling this rule, or changing its template or scope, resolves its open alerts: nothing would be watching them any more.</p> }\n <div class=\"jc-form-actions\">\n <button mat-flat-button type=\"submit\" data-testid=\"rule-save\" [disabled]=\"saving()\">Save</button>\n <button mat-button type=\"button\" (click)=\"form.set(null)\">Cancel</button>\n @if (saveError()) { <span class=\"jc-error\" data-testid=\"rule-error\">{{ saveError() }}</span> }\n </div>\n </form>\n </section>\n }\n <table class=\"jc-table\" data-testid=\"rules\">\n <thead><tr><th>Rule</th><th>Template</th><th>Severity</th><th>Threshold</th><th>Recovery</th><th>Wait</th><th>Open alerts</th><th>Last evaluation</th><th></th></tr></thead>\n <tbody>\n @for (r of rows(); track r.key) {\n <tr [class.jc-muted]=\"!r.enabled\">\n <td><strong>{{ r.name }}</strong><div class=\"jc-muted jc-small\">{{ r.key }}@if (!r.enabled) { · disabled }@if (r.managedBy === 'config') { · from the rules file }@if (r.managedBy === 'platform') { · the platform's, for SLOs }</div>\n @if (r.quiet) { <div class=\"jc-error jc-small\" [attr.data-testid]=\"'rule-quiet-' + r.key\">Never observes: {{ r.quiet }}.</div> }</td>\n <td>{{ r.template }}</td>\n <td>{{ r.severity }}</td>\n <td>{{ r.definition['threshold'] ?? '—' }}</td>\n <td>{{ r.definition['recoveryThreshold'] ?? '—' }}</td>\n <td>{{ r.definition['forDuration'] ?? '—' }}</td>\n <td>\n @for (a of r.open; track a.id) {\n <div><a [routerLink]=\"['alerts', a.id] | jcLink\" [queryParams]=\"ctx.keep()\">{{ a.state }}</a> {{ a.subjectKey }} = {{ a.lastValue ?? 'no data' }}</div>\n } @empty { <span class=\"jc-muted\">none</span> }\n </td>\n <td>{{ r.lastEvaluatedAt | ago }}</td>\n <td class=\"jc-row-actions\">@if (r.managedBy === 'api') { <button mat-button type=\"button\" [attr.data-testid]=\"'rule-edit-' + r.key\" (click)=\"edit(r)\">Change</button> }</td>\n </tr>\n }\n </tbody>\n </table>`,\n})\nexport class RulesPage {\n protected readonly ctx = inject(ContextService);\n private readonly api = inject(ApiService);\n /**\n * What a rule can be made from: SloBurn is described, but its rules are the platform's own, made for SLOs. A template of a signal pack that is\n * off is left out, except the one the rule being changed has, which it can still be saved with while disabled.\n */\n protected readonly templates = computed(() => {\n const off = new Set((this.data.value()?.packs ?? []).filter(p => !p.enabled).flatMap(p => p.ruleTemplates));\n const current = this.editing()?.template;\n return Object.keys(TEMPLATES).filter(t => t !== 'SloBurn' && (!off.has(t) || t === current));\n });\n protected readonly form = signal<RuleForm | null>(null);\n protected readonly editing = signal<Rule | null>(null);\n protected readonly saving = signal(false);\n protected readonly saveError = signal('');\n protected readonly data = apiResource({\n stream: () => forkJoin({\n rules: this.api.rules().pipe(map(p => p.items)),\n firing: this.api.allAlerts({ state: 'firing' }).pipe(map(p => p.items)),\n pending: this.api.allAlerts({ state: 'pending' }).pipe(map(p => p.items)),\n packs: this.api.signalPacks(),\n }),\n });\n protected readonly error = computed(() => problemText(this.data.error()));\n protected readonly rows = computed(() => {\n const d = this.data.value();\n if (!d) return [];\n const open = [...d.firing, ...d.pending];\n return d.rules.map(r => {\n const mine = open.filter(a => a.rule === r.key);\n const last = mine.map(a => a.lastEvaluatedAt).sort().at(-1) ?? null;\n return { ...r, open: mine, lastEvaluatedAt: last };\n });\n });\n\n protected hint(template: string): string { return TEMPLATES[template] ?? ''; }\n\n /** The name of the switched-off signal pack a template reads, if it does. */\n protected offPack(template: string): string | null {\n return this.data.value()?.packs.find(p => !p.enabled && p.ruleTemplates.includes(template))?.name ?? null;\n }\n\n protected startNew() { this.editing.set(null); this.saveError.set(''); this.form.set({ ...NEW_RULE }); }\n\n protected edit(rule: Rule) {\n const d = rule.definition;\n this.editing.set(rule);\n this.saveError.set('');\n this.form.set({\n key: rule.key, name: rule.name, template: rule.template, severity: rule.severity, service: String(d['service'] ?? ''), environment: String(d['environment'] ?? ''), host: String(d['host'] ?? ''),\n threshold: d['threshold'] as number, recoveryThreshold: (d['recoveryThreshold'] as number | null) ?? null, minimumSamples: d['minimumSamples'] as number, scheduleSeconds: seconds(d['schedule']), windowSeconds: seconds(d['window']),\n forSeconds: seconds(d['forDuration']), recoverySeconds: seconds(d['recoveryDuration']), cooldownSeconds: seconds(d['cooldown']), enabled: rule.enabled,\n });\n }\n\n protected save(f: RuleForm) {\n const host = f.template === 'HostMemory';\n const body = {\n key: f.key, name: f.name, template: f.template, severity: f.severity, service: host ? '' : f.service.trim(), environment: host ? '' : f.environment.trim().toLowerCase(), host: host ? f.host.trim() : '',\n threshold: f.threshold, recoveryThreshold: f.recoveryThreshold, minimumSamples: f.minimumSamples, schedule: span(f.scheduleSeconds), window: span(f.windowSeconds), forDuration: span(f.forSeconds),\n recoveryDuration: span(f.recoverySeconds), cooldown: span(f.cooldownSeconds), enabled: f.enabled,\n };\n const editing = this.editing();\n const request: Observable<Rule> = editing ? this.api.updateRule(editing.key, body, editing.etag) : this.api.createRule(body);\n this.saving.set(true);\n this.saveError.set('');\n request.subscribe({\n next: () => { this.saving.set(false); this.form.set(null); this.data.reload(); },\n error: e => { this.saving.set(false); this.saveError.set(problemText(e)); },\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAmBA,MAAM,YAAoC;CACxC,WAAW;CACX,YAAY;CACZ,kBAAkB;CAClB,qBAAqB;CACrB,YAAY;CACZ,gBAAgB;CAChB,kBAAkB;CAClB,SAAS;AACV;AAGD,SAAS,QAAQ,OAAc;CAC7B,MAAM,QAAQ,iCAAiC,KAAK,OAAO,SAAS,EAAE,CAAC;CACvE,OAAO,QAAS,EAAE,MAAM,MAAM,KAAM,QAAQ,CAAC,MAAM,KAAK,OAAO,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM,KAAK;AAC9F;AAEA,SAAS,KAAK,OAAa;CACzB,MAAM,IAAI,KAAK,IAAI,GAAG,KAAK,MAAM,SAAS,CAAC,CAAC;CAC5C,MAAM,OAAO,MAAc,OAAO,CAAC,CAAC,CAAC,SAAS,GAAG,GAAG;CACpD,MAAM,OAAO,KAAK,MAAM,IAAI,KAAK;CACjC,OAAO,GAAG,OAAO,GAAG,KAAI,KAAM,KAAK,IAAI,KAAK,MAAM,IAAI,IAAI,IAAI,EAAE,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AA,CAAA,gBAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAE;GAAe;GAAA;IAAA,MAAA;IAAA,MAAA,GAAA;IAAA,UAAA;IAAA,QAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;IAAA;IAAA,SAAA;KAAA;KAAA;KAAA;KAAA;KAAA;IAAA;IAAA,UAAA,CAAA,WAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAA,GAAA;IAAA,UAAA;IAAA,QAAA;KAAA;KAAA;KAAA;IAAA;IAAA,SAAA,CAAA,mBAAA;IAAA,UAAA,CAAA,WAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAE;IAAU,UAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAA5J;IAAQ,MAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAsJ;IAAO,MAAA;GAAA;EAAA;EAAA,iBAAA,GAAA,wBAAA;CAAA,CAAA;;AAuEpK,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAS,YAAA,CAAA;EAzErB,MAAA;EAAU,MAAA,CAAA;GACT,iBAAiB,wBAAwB;GACzC,SAAS;IAAC;IAAU;IAAY;IAAa;IAAiB;IAAmB;IAAoB;IAAgB;IAAsB;IAAiB;IAAY;GAAO;GAC/K,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqEX,CAAA"}
@@ -569,6 +569,9 @@ var ServicePage = class ServicePage {
569
569
  })
570
570
  });
571
571
  error = computed(() => problemText(this.service.error()), ...ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []);
572
+ confirmingForget = signal(false, ...ngDevMode ? [{ debugName: "confirmingForget" }] : /* istanbul ignore next */ []);
573
+ forgetting = signal(false, ...ngDevMode ? [{ debugName: "forgetting" }] : /* istanbul ignore next */ []);
574
+ forgetError = signal("", ...ngDevMode ? [{ debugName: "forgetError" }] : /* istanbul ignore next */ []);
572
575
  health = computed(() => (this.service.value()?.health ?? []).filter((h) => h.subjectType === "service"), ...ngDevMode ? [{ debugName: "health" }] : /* istanbul ignore next */ []);
573
576
  instances = computed(() => {
574
577
  const env = this.ctx.environment();
@@ -634,6 +637,25 @@ var ServicePage = class ServicePage {
634
637
  queryParamsHandling: "merge"
635
638
  });
636
639
  }
640
+ forget() {
641
+ if (!this.confirmingForget()) {
642
+ this.confirmingForget.set(true);
643
+ return;
644
+ }
645
+ this.forgetting.set(true);
646
+ this.forgetError.set("");
647
+ this.api.forgetService(this.id()).subscribe({
648
+ next: () => {
649
+ this.forgetting.set(false);
650
+ this.router.navigate(this.links.to("services"), { queryParams: this.ctx.keep() });
651
+ },
652
+ error: (e) => {
653
+ this.forgetting.set(false);
654
+ this.confirmingForget.set(false);
655
+ this.forgetError.set(e.status === 403 ? "Forgetting a service needs the admin role." : problemText(e));
656
+ }
657
+ });
658
+ }
637
659
  static ɵfac = i0.ɵɵngDeclareFactory({
638
660
  minVersion: "12.0.0",
639
661
  version: "22.2.4",
@@ -705,12 +727,28 @@ var ServicePage = class ServicePage {
705
727
  <a [routerLink]="['services'] | jcLink" [queryParams]="ctx.keep()" class="jc-crumb">Services</a>
706
728
  <span class="jc-crumb-sep">›</span>
707
729
  <h1>{{ service.value()?.key ?? '…' }}</h1>
730
+ @if (service.value()?.signalPacks?.includes('juice')) { <span class="jc-badge jc-health-none" data-testid="service-juice" title="Sends Juice signals: the Juice rule templates and outbox figures apply">Juice</span> }
708
731
  @for (l of service.value()?.links ?? []; track l.url) { <a mat-button [href]="l.url" target="_blank" rel="noopener">{{ l.title }} ↗</a> }
709
732
  </jc-context-bar>
710
733
  @if (service.isLoading()) { <mat-progress-bar mode="indeterminate" /> }
711
734
  @if (service.error()) { <p class="jc-error">{{ error() }}</p> }
712
735
 
713
736
  @if (service.value(); as s) {
737
+ @if (s.retiredAt) {
738
+ <div class="jc-notice" data-testid="service-retired-notice">
739
+ <p><strong>Retired {{ s.retiredAt | ago }}</strong>, with no telemetry since {{ s.lastSeen | ago }}. It isn't evaluated, and the
740
+ Services list and topology leave it out unless asked. Telemetry from it brings it back.</p>
741
+ <p class="jc-small">Forgetting it removes the service with its instances, dependencies and health history. Alerts, incidents and the
742
+ audit log keep their records; telemetry seen later makes it a new service.</p>
743
+ @if (confirmingForget()) {
744
+ <button mat-flat-button color="warn" type="button" data-testid="forget-confirm" [disabled]="forgetting()" (click)="forget()">Forget {{ s.key }}</button>
745
+ <button mat-button type="button" (click)="confirmingForget.set(false)">Cancel</button>
746
+ } @else {
747
+ <button mat-stroked-button type="button" data-testid="forget" (click)="forget()">Forget service</button>
748
+ }
749
+ @if (forgetError()) { <span class="jc-error" data-testid="forget-error">{{ forgetError() }}</span> }
750
+ </div>
751
+ }
714
752
  <div class="jc-health-strip">
715
753
  @for (h of health(); track h.environment) {
716
754
  <div class="jc-card jc-health-card" [class.jc-selected]="h.environment === ctx.environment()">
@@ -729,7 +767,7 @@ var ServicePage = class ServicePage {
729
767
  <button mat-button (click)="ctx.set({ env: h.environment })">Investigate {{ h.environment }}</button>
730
768
  }
731
769
  </div>
732
- } @empty { <p class="jc-muted">No health evaluated yet: no data.</p> }
770
+ } @empty { <p class="jc-muted">{{ s.retiredAt ? 'Not evaluated while retired.' : 'No health evaluated yet: no data.' }}</p> }
733
771
  </div>
734
772
 
735
773
  <p><a mat-stroked-button [routerLink]="['timeline'] | jcLink" [queryParams]="ctx.keep({ service: id() })" data-testid="service-timeline">Timeline</a></p>
@@ -1051,12 +1089,28 @@ i0.ɵɵngDeclareClassMetadata({
1051
1089
  <a [routerLink]="['services'] | jcLink" [queryParams]="ctx.keep()" class="jc-crumb">Services</a>
1052
1090
  <span class="jc-crumb-sep">›</span>
1053
1091
  <h1>{{ service.value()?.key ?? '…' }}</h1>
1092
+ @if (service.value()?.signalPacks?.includes('juice')) { <span class="jc-badge jc-health-none" data-testid="service-juice" title="Sends Juice signals: the Juice rule templates and outbox figures apply">Juice</span> }
1054
1093
  @for (l of service.value()?.links ?? []; track l.url) { <a mat-button [href]="l.url" target="_blank" rel="noopener">{{ l.title }} ↗</a> }
1055
1094
  </jc-context-bar>
1056
1095
  @if (service.isLoading()) { <mat-progress-bar mode="indeterminate" /> }
1057
1096
  @if (service.error()) { <p class="jc-error">{{ error() }}</p> }
1058
1097
 
1059
1098
  @if (service.value(); as s) {
1099
+ @if (s.retiredAt) {
1100
+ <div class="jc-notice" data-testid="service-retired-notice">
1101
+ <p><strong>Retired {{ s.retiredAt | ago }}</strong>, with no telemetry since {{ s.lastSeen | ago }}. It isn't evaluated, and the
1102
+ Services list and topology leave it out unless asked. Telemetry from it brings it back.</p>
1103
+ <p class="jc-small">Forgetting it removes the service with its instances, dependencies and health history. Alerts, incidents and the
1104
+ audit log keep their records; telemetry seen later makes it a new service.</p>
1105
+ @if (confirmingForget()) {
1106
+ <button mat-flat-button color="warn" type="button" data-testid="forget-confirm" [disabled]="forgetting()" (click)="forget()">Forget {{ s.key }}</button>
1107
+ <button mat-button type="button" (click)="confirmingForget.set(false)">Cancel</button>
1108
+ } @else {
1109
+ <button mat-stroked-button type="button" data-testid="forget" (click)="forget()">Forget service</button>
1110
+ }
1111
+ @if (forgetError()) { <span class="jc-error" data-testid="forget-error">{{ forgetError() }}</span> }
1112
+ </div>
1113
+ }
1060
1114
  <div class="jc-health-strip">
1061
1115
  @for (h of health(); track h.environment) {
1062
1116
  <div class="jc-card jc-health-card" [class.jc-selected]="h.environment === ctx.environment()">
@@ -1075,7 +1129,7 @@ i0.ɵɵngDeclareClassMetadata({
1075
1129
  <button mat-button (click)="ctx.set({ env: h.environment })">Investigate {{ h.environment }}</button>
1076
1130
  }
1077
1131
  </div>
1078
- } @empty { <p class="jc-muted">No health evaluated yet: no data.</p> }
1132
+ } @empty { <p class="jc-muted">{{ s.retiredAt ? 'Not evaluated while retired.' : 'No health evaluated yet: no data.' }}</p> }
1079
1133
  </div>
1080
1134
 
1081
1135
  <p><a mat-stroked-button [routerLink]="['timeline'] | jcLink" [queryParams]="ctx.keep({ service: id() })" data-testid="service-timeline">Timeline</a></p>
@@ -1254,4 +1308,4 @@ i0.ɵɵngDeclareClassMetadata({
1254
1308
  });
1255
1309
  export { ServicePage };
1256
1310
 
1257
- //# sourceMappingURL=juice-js-observability-service.page-BAUPza0x.mjs.map
1311
+ //# sourceMappingURL=juice-js-observability-service.page-DeOXv1WO.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"juice-js-observability-service.page-DeOXv1WO.mjs","names":["i1","i3","i2"],"sources":["../../../../projects/juice-js/observability/src/lib/shared/capacity.ts","../../../../projects/juice-js/observability/src/lib/pages/service.page.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, computed, inject, input, linkedSignal, signal } from '@angular/core';\nimport { FormsModule } from '@angular/forms';\nimport { MatFormFieldModule } from '@angular/material/form-field';\nimport { MatInputModule } from '@angular/material/input';\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 { LinkPipe } from '../core/options';\nimport { Capacity } from '../core/models';\nimport { apiResource } from './resource';\nimport { problemText } from './telemetry';\n\nexport interface CapacityInputs {\n users: number;\n /** Seconds between one user's actions. */\n thinkSeconds: number;\n /** Requests or messages one user action causes in this service. */\n perAction: number;\n /** The CPU use to stay under, from 0 to 1. */\n targetCpu: number;\n coresPerInstance: number;\n}\n\nexport interface CapacityPlan {\n perSecond: number;\n instances: number;\n cores: number;\n /** Per instance; null without memory data. */\n memoryBytes: number | null;\n /** The load each instance would carry. */\n perInstance: number;\n /** That load over the highest measured: above 1 is beyond what was measured. */\n beyondMeasured: number | null;\n /** What set the number of instances: CPU, or a consumer that was already busy all the time. */\n limitedBy: 'cpu' | 'messages';\n}\n\n/**\n * The calculator: `null` when the inputs or the measurements can't give an answer, such as a target that idle CPU alone\n * already exceeds. Each instance can carry (target × cores − idle) ÷ CPU per unit, unless a consumer was seen busy all the\n * time: more CPU doesn't help one that handles a message at a time, so an instance carries only the rate it reached.\n */\nexport function planCapacity(m: Capacity, i: CapacityInputs): CapacityPlan | null {\n if (!m.cpuSecondsPerUnit || m.cpuSecondsPerUnit <= 0) return null;\n if (!(i.users > 0 && i.perAction > 0 && i.targetCpu > 0 && i.targetCpu <= 1 && i.coresPerInstance > 0 && i.thinkSeconds >= 0)) return null;\n const response = (m.responseMs ?? 0) / 1000;\n if (i.thinkSeconds + response <= 0) return null;\n\n const byCpu = (i.targetCpu * i.coresPerInstance - (m.idleCores ?? 0)) / m.cpuSecondsPerUnit;\n if (byCpu <= 0) return null;\n const limitedBy = consumerBusy(m) && m.peakMessagesPerSecond < byCpu ? 'messages' : 'cpu';\n const carried = limitedBy === 'messages' ? m.peakMessagesPerSecond : byCpu;\n const perSecond = i.users * i.perAction / (i.thinkSeconds + response);\n const instances = Math.max(1, Math.ceil(perSecond / carried));\n const perInstance = perSecond / instances;\n const memoryBytes = m.memoryModel === 'fitted'\n ? m.idleMemoryBytes! + m.memoryBytesPerInFlight! * perInstance * response\n : m.peakMemoryBytes;\n // A consumer held back by message handling never used its cores: count what it used, at the target, not the machine's.\n const coresEach = limitedBy === 'messages' && m.peakCores !== null\n ? Math.min(i.coresPerInstance, Math.ceil(m.peakCores / i.targetCpu))\n : i.coresPerInstance;\n return {\n perSecond, instances, cores: instances * coresEach, memoryBytes, perInstance,\n beyondMeasured: m.peakPerSecond > 0 ? perInstance / m.peakPerSecond : null,\n limitedBy,\n };\n}\n\n/** A consumer counts as busy all the time from this much message processing per second of time. */\nconst BUSY_CONSUMER = 0.9;\nfunction consumerBusy(m: Capacity): boolean { return m.peakMessagesInFlight >= BUSY_CONSUMER && m.peakMessagesPerSecond > 0; }\n\n/** A thread pool queue of a few items comes and goes on a healthy host; from this many, work was really waiting. */\nconst NOTABLE_QUEUE = 10;\n\n/** Response time counts as rising with load from this ratio between the busiest and quietest samples. */\nconst RISING_RESPONSE = 1.5;\n\nfunction bytes(value: number | null): string {\n if (value === null) return '—';\n return value >= 1024 ** 3 ? `${(value / 1024 ** 3).toFixed(1)} GB` : `${Math.round(value / 1024 ** 2)} MB`;\n}\nfunction rate(value: number): string { return value >= 10 ? value.toFixed(0) : value.toFixed(2); }\n\n/**\n * A service's Capacity tab: what it was measured to need in the selected window, and a calculator from users to instances,\n * cores and memory. The estimate says where it comes from and where it stops holding: scaling isn't linear, and the\n * service's own databases and brokers are not in it.\n */\n@Component({\n selector: 'jc-service-capacity',\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [FormsModule, MatFormFieldModule, MatInputModule, MatProgressBarModule, RouterLink, LinkPipe],\n template: `\n @if (capacity.isLoading()) { <mat-progress-bar mode=\"indeterminate\" /> }\n @if (capacity.error()) { <p class=\"jc-error\">{{ error() }}</p> }\n @if (mixedEnvironments()) {\n <p class=\"jc-notice\">This service runs in more than one environment, and their hardware may differ. Choose an environment for an estimate that means something.</p>\n }\n @if (capacity.value(); as m) {\n @if (m.samples === 0) {\n <p class=\"jc-muted\">No telemetry from this service in this window.</p>\n } @else {\n <section class=\"jc-card\" aria-labelledby=\"jc-capacity-estimate\">\n <h3 id=\"jc-capacity-estimate\">Estimate</h3>\n <div class=\"jc-capacity-inputs\">\n <mat-form-field subscriptSizing=\"dynamic\"><mat-label>Concurrent users</mat-label>\n <input matInput type=\"number\" min=\"1\" name=\"users\" [ngModel]=\"users()\" (ngModelChange)=\"users.set($event)\" /></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\"><mat-label>Seconds between actions</mat-label>\n <input matInput type=\"number\" min=\"0\" name=\"thinkSeconds\" [ngModel]=\"thinkSeconds()\" (ngModelChange)=\"thinkSeconds.set($event)\" /></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\"><mat-label>Requests per action</mat-label>\n <input matInput type=\"number\" min=\"0\" name=\"perAction\" [ngModel]=\"perAction()\" (ngModelChange)=\"perAction.set($event)\" /></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\"><mat-label>Target CPU use (%)</mat-label>\n <input matInput type=\"number\" min=\"1\" max=\"100\" name=\"targetCpu\" [ngModel]=\"targetCpu()\" (ngModelChange)=\"targetCpu.set($event)\" /></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\"><mat-label>Cores per instance</mat-label>\n <input matInput type=\"number\" min=\"1\" name=\"coresPerInstance\" [ngModel]=\"coresPerInstance()\" (ngModelChange)=\"coresPerInstance.set($event)\" /></mat-form-field>\n </div>\n @if (plan(); as p) {\n <div class=\"jc-capacity-result\" data-testid=\"capacity-plan\">\n <div><strong>{{ p.instances }}</strong><span class=\"jc-muted\">instance{{ p.instances === 1 ? '' : 's' }}</span></div>\n <div><strong>{{ p.cores }}</strong><span class=\"jc-muted\">cores in total</span></div>\n <div><strong>{{ memory(p.memoryBytes) }}</strong><span class=\"jc-muted\">memory per instance{{ m.memoryModel === 'peak' ? ' (highest seen)' : '' }}</span></div>\n <div><strong>{{ perSecond(p.perSecond) }}</strong><span class=\"jc-muted\">requests and messages/s</span></div>\n </div>\n @if (p.beyondMeasured !== null && p.beyondMeasured > 1) {\n <p class=\"jc-notice\" data-testid=\"capacity-beyond\">Each instance would carry {{ perSecond(p.perInstance) }}/s, {{ p.beyondMeasured.toFixed(1) }}× the highest measured ({{ perSecond(m.peakPerSecond) }}/s). This is an extrapolation, and only a load test can confirm it.</p>\n }\n } @else if (m.cpuModel === 'none') {\n <p class=\"jc-notice\">No CPU data, so no estimate. CPU needs two readings at least a minute apart: choose a longer window, or wait. If it stays empty, add <code>AddMeter(\"System.Runtime\")</code> to the host's metrics (.NET 9+).</p>\n } @else {\n <p class=\"jc-notice\">No estimate for these values. Check them: idle CPU alone may already exceed the target.</p>\n }\n <ul class=\"jc-capacity-notes\">\n @if (responseRising(); as r) {\n <li class=\"jc-bad\">Response time already rises with load: {{ r.low }} ms when quiet, {{ r.high }} ms when busy. Something may be near its limit, so the real capacity may be lower.</li>\n }\n @if (busyConsumer()) {\n <li class=\"jc-bad\" data-testid=\"capacity-busy-consumer\">Message processing was busy nearly all the time, at about {{ perSecond(m.peakMessagesPerSecond) }} messages/s per instance. If it handles one message at a time, that is its limit whatever CPU says, and its queue may be growing. The estimate uses that rate, but a saturated consumer's rate can fall, so it may not hold. See which step takes the time in a trace.</li>\n }\n @if (m.outbox?.fallingBehind) {\n <li class=\"jc-bad\" data-testid=\"capacity-outbox-behind\">Outbox delivery is falling behind: {{ count(m.outbox!.undelivered) }} messages created in this window weren't delivered. CPU and requests can look healthy while this grows, and the estimate doesn't include it. If another service delivers this outbox, this doesn't apply.</li>\n }\n @if (m.peakQueue !== null && m.peakQueue >= notableQueue) {\n <li class=\"jc-bad\">The thread pool queue reached {{ m.peakQueue }}: work was waiting for a thread.</li>\n }\n @if (m.cpuModel === 'average') {\n <li data-testid=\"capacity-load-hint\">Load didn't vary enough here to separate idle CPU from the cost of each request, so this is rough. A <a [routerLink]=\"['load-runs'] | jcLink\" [queryParams]=\"ctx.keep()\">load test</a> gives a better estimate.</li>\n }\n <li>Assumes cost grows in a straight line with load. A database, lock or connection limit can be reached long before CPU runs out.</li>\n <li>Covers this service only, not its databases, brokers or the services it calls.</li>\n </ul>\n </section>\n\n <section class=\"jc-card\" aria-labelledby=\"jc-capacity-measured\">\n <h3 id=\"jc-capacity-measured\">Measured in this window</h3>\n <table class=\"jc-table jc-capacity-measured\">\n <tbody>\n <tr><th>CPU per request or message</th>\n <td>\n @if (m.cpuSecondsPerUnit !== null) { {{ (m.cpuSecondsPerUnit * 1000).toFixed(1) }} ms }\n @else { <span class=\"jc-muted\">No CPU data yet</span> }\n @if (m.cpuModel === 'average') {\n <div class=\"jc-muted jc-small\">Measured in the busiest samples and includes idle CPU, so it can read high. Load didn't vary enough, or CPU didn't follow it in a straight line, to separate the two.</div>\n }\n </td></tr>\n <tr><th>Idle CPU</th><td>@if (m.idleCores !== null) { {{ m.idleCores.toFixed(2) }} cores } @else { <span class=\"jc-muted\">Not separated</span> }</td></tr>\n <tr><th>Idle memory</th><td>@if (m.idleMemoryBytes !== null) { {{ memory(m.idleMemoryBytes) }} } @else { <span class=\"jc-muted\">Not separated</span> }</td></tr>\n <tr><th>Memory growth under load</th><td>@if (m.memoryBytesPerInFlight !== null) { {{ memory(m.memoryBytesPerInFlight) }} per request in flight } @else { <span class=\"jc-muted\">Not separated</span> }</td></tr>\n <tr><th>Highest load, one instance</th><td>{{ perSecond(m.peakPerSecond) }} requests and messages/s</td></tr>\n <tr><th>Highest use, one instance</th><td>\n {{ m.peakCores !== null ? m.peakCores.toFixed(2) + ' cores' : 'CPU unknown' }} · {{ m.peakMemoryBytes !== null ? memory(m.peakMemoryBytes) : 'memory unknown' }}</td></tr>\n <tr><th>Average response</th><td>{{ m.responseMs !== null ? m.responseMs.toFixed(0) + ' ms' : '—' }}</td></tr>\n <tr><th>Measured on</th><td>\n {{ m.instances }} instance{{ m.instances === 1 ? '' : 's' }}@if (m.coresPerInstance) {, {{ m.coresPerInstance }} cores each}@if (m.hosts.length) {, on {{ m.hosts.join(', ') }}}.\n <div class=\"jc-muted jc-small\">Figures from other hardware carry over only roughly.</div></td></tr>\n <tr><th>Based on</th><td>\n {{ m.samples }} samples of {{ m.stepSeconds }} s.\n <div class=\"jc-muted jc-small\">{{ sourceNote() }}</div>\n @if (m.truncated) { <div class=\"jc-bad jc-small\">Too many samples in this window, so only the newest were used. Choose a shorter one.</div> }</td></tr>\n </tbody>\n </table>\n </section>\n\n @if (m.outbox; as o) {\n <section class=\"jc-card\" aria-labelledby=\"jc-capacity-outbox\" data-testid=\"capacity-outbox\">\n <h3 id=\"jc-capacity-outbox\">Outbox delivery</h3>\n <table class=\"jc-table jc-capacity-measured\">\n <tbody>\n <tr><th>Messages created</th><td>{{ perSecond(o.createdPerSecond) }}/s</td></tr>\n <tr><th>Messages delivered</th><td>{{ perSecond(o.deliveredPerSecond) }}/s</td></tr>\n <tr><th>Created but not delivered</th><td [class.jc-bad]=\"o.fallingBehind\">{{ count(o.undelivered) }} in this window\n <div class=\"jc-muted jc-small\">Includes messages of rolled-back transactions, which are never delivered.</div></td></tr>\n <tr><th>Time to delivery, p95</th><td [class.jc-bad]=\"o.fallingBehind\">@if (o.recentDelaySeconds !== null) { {{ o.recentDelaySeconds.toFixed(1) }} s in the last 5 minutes } @else { <span class=\"jc-muted\">Nothing delivered in the last 5 minutes</span> }</td></tr>\n </tbody>\n </table>\n </section>\n }\n }\n }`,\n})\nexport class ServiceCapacity {\n protected readonly ctx = inject(ContextService);\n private readonly api = inject(ApiService);\n readonly serviceId = input.required<string>();\n /** The environments the service runs in: figures across several mix their hardware. */\n readonly environments = input<string[]>([]);\n\n protected readonly capacity = apiResource({\n params: () => ({ id: this.serviceId(), env: this.ctx.environment(), range: this.ctx.range(), abs: this.ctx.absolute() }),\n stream: ({ params }) => this.api.capacity({ serviceId: params.id, environment: params.env, ...this.ctx.window() }),\n });\n protected readonly users = signal(1000);\n protected readonly thinkSeconds = signal(10);\n protected readonly perAction = signal(1);\n protected readonly targetCpu = signal(60);\n protected readonly coresPerInstance = linkedSignal(() => this.capacity.value()?.coresPerInstance ?? 2);\n\n protected readonly error = computed(() => problemText(this.capacity.error()));\n protected readonly mixedEnvironments = computed(() => !this.ctx.environment() && new Set(this.environments()).size > 1);\n protected readonly plan = computed(() => {\n const m = this.capacity.value();\n return m ? planCapacity(m, {\n users: this.users(), thinkSeconds: this.thinkSeconds(), perAction: this.perAction(), targetCpu: this.targetCpu() / 100, coresPerInstance: this.coresPerInstance(),\n }) : null;\n });\n protected readonly busyConsumer = computed(() => { const m = this.capacity.value(); return !!m && consumerBusy(m); });\n protected readonly responseRising = computed(() => {\n const m = this.capacity.value();\n return m?.responseLowLoadMs && m.responseHighLoadMs && m.responseHighLoadMs >= RISING_RESPONSE * m.responseLowLoadMs\n ? { low: Math.round(m.responseLowLoadMs), high: Math.round(m.responseHighLoadMs) } : null;\n });\n protected readonly sourceNote = computed(() => this.capacity.value()?.requestSource === 'metrics'\n ? 'Requests are counted from the http.server.request.duration metric, messages from spans.'\n : 'Requests and messages are counted from spans, which undercount if traces are sampled. That makes the cost per request read high. Exporting http.server.request.duration fixes the request count.');\n\n protected readonly notableQueue = NOTABLE_QUEUE;\n protected readonly memory = bytes;\n protected readonly perSecond = rate;\n protected readonly count = (value: number) => Math.round(value).toLocaleString('en-US');\n}\n","import { LinkPipe, ObservabilityLinks } from '../core/options';\nimport { ChangeDetectionStrategy, Component, computed, inject, input, signal } from '@angular/core';\nimport { apiResource } from '../shared/resource';\nimport { MatProgressBarModule } from '@angular/material/progress-bar';\nimport { MatTabsModule } from '@angular/material/tabs';\nimport { MatButtonModule } from '@angular/material/button';\nimport { Router, RouterLink } from '@angular/router';\nimport { ApiService } from '../core/api.service';\nimport { ContextService } from '../core/context.service';\nimport { AgoPipe, DurationPipe, PercentPipe, ReasonPipe } from '../shared/format';\nimport { ConfidenceBadge, ContextBar, HealthBadge } from '../shared/ui';\nimport { LogTable, MetricExplorer, ServiceStatsCharts, TraceTable, problemText } from '../shared/telemetry';\nimport { ServiceCapacity } from '../shared/capacity';\n\nconst TABS = ['overview', 'operations', 'dependencies', 'traces', 'logs', 'metrics', 'capacity'] as const;\n\n/**\n * One service across its environments (Console requirements §8): health with reasons, instances, operations,\n * dependencies, traces, logs and metrics, without leaving the service. The tab and the selected operation are in the\n * URL, so the investigation can be shared and the back button returns to it.\n */\n@Component({\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [LinkPipe, RouterLink, MatTabsModule, MatProgressBarModule, MatButtonModule, ContextBar, HealthBadge, ConfidenceBadge,\n TraceTable, LogTable, MetricExplorer, ServiceStatsCharts, ServiceCapacity, AgoPipe, DurationPipe, PercentPipe, ReasonPipe],\n template: `\n <jc-context-bar>\n <a [routerLink]=\"['services'] | jcLink\" [queryParams]=\"ctx.keep()\" class=\"jc-crumb\">Services</a>\n <span class=\"jc-crumb-sep\">›</span>\n <h1>{{ service.value()?.key ?? '…' }}</h1>\n @if (service.value()?.signalPacks?.includes('juice')) { <span class=\"jc-badge jc-health-none\" data-testid=\"service-juice\" title=\"Sends Juice signals: the Juice rule templates and outbox figures apply\">Juice</span> }\n @for (l of service.value()?.links ?? []; track l.url) { <a mat-button [href]=\"l.url\" target=\"_blank\" rel=\"noopener\">{{ l.title }} ↗</a> }\n </jc-context-bar>\n @if (service.isLoading()) { <mat-progress-bar mode=\"indeterminate\" /> }\n @if (service.error()) { <p class=\"jc-error\">{{ error() }}</p> }\n\n @if (service.value(); as s) {\n @if (s.retiredAt) {\n <div class=\"jc-notice\" data-testid=\"service-retired-notice\">\n <p><strong>Retired {{ s.retiredAt | ago }}</strong>, with no telemetry since {{ s.lastSeen | ago }}. It isn't evaluated, and the\n Services list and topology leave it out unless asked. Telemetry from it brings it back.</p>\n <p class=\"jc-small\">Forgetting it removes the service with its instances, dependencies and health history. Alerts, incidents and the\n audit log keep their records; telemetry seen later makes it a new service.</p>\n @if (confirmingForget()) {\n <button mat-flat-button color=\"warn\" type=\"button\" data-testid=\"forget-confirm\" [disabled]=\"forgetting()\" (click)=\"forget()\">Forget {{ s.key }}</button>\n <button mat-button type=\"button\" (click)=\"confirmingForget.set(false)\">Cancel</button>\n } @else {\n <button mat-stroked-button type=\"button\" data-testid=\"forget\" (click)=\"forget()\">Forget service</button>\n }\n @if (forgetError()) { <span class=\"jc-error\" data-testid=\"forget-error\">{{ forgetError() }}</span> }\n </div>\n }\n <div class=\"jc-health-strip\">\n @for (h of health(); track h.environment) {\n <div class=\"jc-card jc-health-card\" [class.jc-selected]=\"h.environment === ctx.environment()\">\n <div class=\"jc-row\"><strong>{{ h.environment ?? 'no environment' }}</strong><jc-health [state]=\"h.state\" [stale]=\"h.stale\" /></div>\n <ul class=\"jc-reasons\">\n @for (r of h.reasons; track r) {\n <li>\n @if (dependencyOf(r); as dep) {\n {{ r | reason }} — <a [routerLink]=\"['services', dep.id] | jcLink\" [queryParams]=\"ctx.keep()\">open</a>\n } @else { {{ r | reason }} }\n </li>\n }\n </ul>\n <div class=\"jc-muted jc-small\">since {{ h.since | ago }} · evaluated {{ h.evaluatedAt | ago }}</div>\n @if (h.environment && h.environment !== ctx.environment()) {\n <button mat-button (click)=\"ctx.set({ env: h.environment })\">Investigate {{ h.environment }}</button>\n }\n </div>\n } @empty { <p class=\"jc-muted\">{{ s.retiredAt ? 'Not evaluated while retired.' : 'No health evaluated yet: no data.' }}</p> }\n </div>\n\n <p><a mat-stroked-button [routerLink]=\"['timeline'] | jcLink\" [queryParams]=\"ctx.keep({ service: id() })\" data-testid=\"service-timeline\">Timeline</a></p>\n <mat-tab-group [selectedIndex]=\"tabIndex()\" (selectedIndexChange)=\"openTab($event)\" animationDuration=\"0ms\" mat-stretch-tabs=\"false\">\n <mat-tab label=\"Overview\">\n @if (tabIndex() === 0) {\n <jc-service-stats [query]=\"{ serviceId: id() }\" />\n <h3>Instances</h3>\n <table class=\"jc-table\">\n <thead><tr><th>Instance</th><th>Environment</th><th>Health</th><th>Version</th><th>State</th><th>Last seen</th><th></th></tr></thead>\n <tbody>\n @for (i of instances(); track i.id) {\n <tr>\n <td>{{ i.instanceKey }}@if (i.keySource !== 'Observed') { <span class=\"jc-muted jc-small\" title=\"No service.instance.id: derived from host and process\"> (derived)</span> }</td>\n <td>{{ i.environment }}</td>\n <td><jc-health [state]=\"i.health\" /></td>\n <td>{{ i.serviceVersion ?? '—' }}</td>\n <td>{{ i.state }}</td>\n <td>{{ i.lastSeen | ago }}</td>\n <td class=\"jc-nowrap\">\n <a [routerLink]=\"[]\" [queryParams]=\"ctx.keep({ tab: 'traces', instance: i.id })\">traces</a> ·\n <a [routerLink]=\"[]\" [queryParams]=\"ctx.keep({ tab: 'logs', instance: i.id })\">logs</a>\n @if (i.hostResourceId) { · <a [routerLink]=\"['resources', i.hostResourceId] | jcLink\" [queryParams]=\"ctx.keep()\">host</a> }\n </td>\n </tr>\n } @empty { <tr><td colspan=\"7\" class=\"jc-muted\">No instances.</td></tr> }\n </tbody>\n </table>\n }\n </mat-tab>\n\n <mat-tab label=\"Operations\">\n @if (tabIndex() === 1) {\n @if (operations.isLoading()) { <mat-progress-bar mode=\"indeterminate\" /> }\n <table class=\"jc-table\">\n <thead><tr><th>Operation</th><th>Kind</th><th>Requests</th><th title=\"Average over the selected time range. The chart shows each moment, so a burst reads higher there.\">Avg/s</th><th>Errors</th><th>p50</th><th>p95</th><th>p99</th><th>Last seen</th><th></th></tr></thead>\n <tbody>\n @for (o of operations.value()?.items ?? []; track o.name + o.kind) {\n <tr [class.jc-selected]=\"o.name === operation()\">\n <td><a [routerLink]=\"[]\" [queryParams]=\"ctx.keep({ tab: 'operations', op: o.name })\">{{ o.name }}</a></td>\n <td>{{ o.kind }}</td>\n <td>{{ o.count }}</td>\n <td>{{ o.requestsPerSecond.toFixed(2) }}</td>\n <td [class.jc-bad]=\"o.errorRate >= 0.05\">{{ o.errorRate | percent2 }}</td>\n <td>{{ o.p50Ms | duration }}</td><td>{{ o.p95Ms | duration }}</td><td>{{ o.p99Ms | duration }}</td>\n <td>{{ o.lastSeen | ago }}</td>\n <td class=\"jc-nowrap\">\n <a [routerLink]=\"[]\" [queryParams]=\"ctx.keep({ tab: 'traces', op: o.name, status: 'error' })\">error traces</a> ·\n <a [routerLink]=\"[]\" [queryParams]=\"ctx.keep({ tab: 'traces', op: o.name, slow: o.p95Ms })\">slow traces</a>\n </td>\n </tr>\n } @empty { <tr><td colspan=\"10\" class=\"jc-muted\">No operations in this window.</td></tr> }\n </tbody>\n </table>\n @if (operation(); as op) {\n <h3>{{ op }}</h3>\n <jc-service-stats [query]=\"{ serviceId: id(), operation: op }\" />\n }\n }\n </mat-tab>\n\n <mat-tab label=\"Dependencies\">\n @if (tabIndex() === 2) {\n <h3>Calls and uses</h3>\n <table class=\"jc-table\">\n <thead><tr><th>Target</th><th>Relation</th><th>Evidence</th><th>Spans seen</th><th>Last seen</th><th></th></tr></thead>\n <tbody>\n @for (d of downstream(); track d.edge.id) {\n <tr>\n <td><a [routerLink]=\"d.link\" [queryParams]=\"ctx.keep()\">{{ d.name }}</a>&nbsp;<span class=\"jc-muted jc-small\">{{ d.type }}</span></td>\n <td>{{ d.edge.relation }}</td>\n <td><jc-confidence [confidence]=\"d.edge.confidence\" /></td>\n <td>{{ d.edge.spanCount }}</td>\n <td>{{ d.edge.lastSeen | ago }}</td>\n <td><a [routerLink]=\"['topology'] | jcLink\" [queryParams]=\"ctx.keep({ edge: d.edge.id })\">evidence</a> ·\n <a [routerLink]=\"[]\" [queryParams]=\"ctx.keep({ tab: 'traces', dependency: d.edge.id })\">traces</a></td>\n </tr>\n } @empty { <tr><td colspan=\"6\" class=\"jc-muted\">No downstream dependencies seen.</td></tr> }\n </tbody>\n </table>\n <h3>Called by</h3>\n <table class=\"jc-table\">\n <tbody>\n @for (d of upstream(); track d.edge.id) {\n <tr><td><a [routerLink]=\"d.link\" [queryParams]=\"ctx.keep()\">{{ d.name }}</a></td><td>{{ d.edge.relation }}</td>\n <td><jc-confidence [confidence]=\"d.edge.confidence\" /></td><td>{{ d.edge.lastSeen | ago }}</td>\n <td><a [routerLink]=\"['topology'] | jcLink\" [queryParams]=\"ctx.keep({ edge: d.edge.id })\">evidence</a></td></tr>\n } @empty { <tr><td class=\"jc-muted\">No callers seen.</td></tr> }\n </tbody>\n </table>\n }\n </mat-tab>\n\n <mat-tab label=\"Traces\">\n @if (tabIndex() === 3) {\n <div class=\"jc-filters\">\n @for (f of traceFilters(); track f.label) { <span class=\"jc-chip\">{{ f.label }} <a [routerLink]=\"[]\" [queryParams]=\"f.clear\" queryParamsHandling=\"merge\" [attr.aria-label]=\"'Remove ' + f.label\">×</a></span> }\n </div>\n <jc-trace-table [query]=\"traceQuery()\" />\n }\n </mat-tab>\n\n <mat-tab label=\"Logs\">\n @if (tabIndex() === 4) { <jc-log-table [query]=\"{ serviceId: id(), instanceId: instanceFilter() }\" /> }\n </mat-tab>\n\n <mat-tab label=\"Metrics\">\n @if (tabIndex() === 5) { <jc-metric-explorer [scope]=\"{ serviceId: id(), instanceId: instanceFilter() }\" /> }\n </mat-tab>\n\n <mat-tab label=\"Capacity\">\n @if (tabIndex() === 6) { <jc-service-capacity [serviceId]=\"id()\" [environments]=\"environments()\" /> }\n </mat-tab>\n </mat-tab-group>\n }`,\n})\nexport class ServicePage {\n protected readonly ctx = inject(ContextService);\n private readonly api = inject(ApiService);\n private readonly router = inject(Router);\n private readonly links = inject(ObservabilityLinks);\n\n readonly id = input.required<string>();\n readonly tab = input<string>();\n readonly op = input<string>();\n readonly status = input<string>();\n readonly slow = input<string>();\n readonly instance = input<string>();\n readonly dependency = input<string>();\n\n protected readonly tabIndex = computed(() => Math.max(0, TABS.indexOf((this.tab() ?? 'overview') as typeof TABS[number])));\n protected readonly operation = computed(() => this.op() ?? null);\n protected readonly instanceFilter = computed(() => this.instance() ?? null);\n\n protected readonly service = apiResource({ params: () => this.id(), stream: ({ params }) => this.api.resource(params) });\n protected readonly topology = apiResource({ params: () => this.ctx.environment(), stream: ({ params }) => this.api.topology(params || null) });\n protected readonly operations = apiResource({\n params: () => ({ id: this.id(), env: this.ctx.environment(), range: this.ctx.range(), abs: this.ctx.absolute(), on: this.tabIndex() === 1 }),\n stream: ({ params }) => this.api.operations({ serviceId: params.id, environment: params.env, ...this.ctx.window(), limit: 200 }),\n });\n\n protected readonly error = computed(() => problemText(this.service.error()));\n protected readonly confirmingForget = signal(false);\n protected readonly forgetting = signal(false);\n protected readonly forgetError = signal('');\n protected readonly health = computed(() => (this.service.value()?.health ?? []).filter(h => h.subjectType === 'service'));\n protected readonly instances = computed(() => {\n const env = this.ctx.environment();\n return (this.service.value()?.instances ?? []).filter(i => !env || i.environment === env);\n });\n\n protected readonly environments = computed(() => (this.service.value()?.instances ?? []).map(i => i.environment));\n\n private readonly nodes = computed(() => new Map((this.topology.value()?.nodes ?? []).map(n => [n.id, n])));\n private edgesWhere(match: 'source' | 'target') {\n const other = match === 'source' ? 'target' : 'source';\n return (this.topology.value()?.edges ?? []).filter(e => e[match] === this.id()).map(edge => {\n const node = this.nodes().get(edge[other]);\n return {\n edge, name: node?.displayName ?? edge[other], type: node?.type ?? '',\n link: this.links.to(node?.type === 'service' ? 'services' : 'resources', edge[other]),\n };\n });\n }\n protected readonly downstream = computed(() => this.edgesWhere('source'));\n protected readonly upstream = computed(() => this.edgesWhere('target'));\n\n /** `dependency_failed:shop/payments` links to that service when it is in the topology. */\n dependencyOf(reason: string) {\n const name = reason.match(/^(?:critical_)?dependency_(?:failed|unknown):(.+)$/)?.[1];\n if (!name) return null;\n const node = [...this.nodes().values()].find(n => n.type === 'service' && (n.displayName === name || name.endsWith(`/${n.displayName}`)));\n return node ? { id: node.id } : null;\n }\n\n protected readonly traceQuery = computed(() => ({\n serviceId: this.id(), operation: this.op(), status: this.status(), minDurationMs: this.slow(),\n instanceId: this.instance(), dependencyId: this.dependency(),\n }));\n /** The trace filters in effect, each removable on its own. */\n protected readonly traceFilters = computed(() => {\n const filters: { label: string; clear: Record<string, null> }[] = [];\n if (this.op()) filters.push({ label: `operation: ${this.op()}`, clear: { op: null } });\n if (this.status()) filters.push({ label: `status: ${this.status()}`, clear: { status: null } });\n if (this.slow()) filters.push({ label: `slower than ${Math.round(Number(this.slow()))} ms`, clear: { slow: null } });\n if (this.instance()) filters.push({ label: 'one instance', clear: { instance: null } });\n if (this.dependency()) filters.push({ label: 'through one dependency', clear: { dependency: null } });\n return filters;\n });\n\n openTab(index: number) {\n void this.router.navigate([], { queryParams: { tab: TABS[index] }, queryParamsHandling: 'merge' });\n }\n\n /** Forgets a retired service (admin), after a second click to confirm, then back to the list. */\n protected forget() {\n if (!this.confirmingForget()) { this.confirmingForget.set(true); return; }\n this.forgetting.set(true);\n this.forgetError.set('');\n this.api.forgetService(this.id()).subscribe({\n next: () => { this.forgetting.set(false); void this.router.navigate(this.links.to('services'), { queryParams: this.ctx.keep() }); },\n error: e => {\n this.forgetting.set(false);\n this.confirmingForget.set(false);\n this.forgetError.set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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiKX,CAAA"}
@@ -20,17 +20,22 @@ var ServicesPage = class ServicesPage {
20
20
  ctx = inject(ContextService);
21
21
  api = inject(ApiService);
22
22
  state = input(...ngDevMode ? [void 0, { debugName: "state" }] : /* istanbul ignore next */ []);
23
+ retired = input(...ngDevMode ? [void 0, { debugName: "retired" }] : /* istanbul ignore next */ []);
24
+ showRetired = computed(() => this.retired() === "true", ...ngDevMode ? [{ debugName: "showRetired" }] : /* istanbul ignore next */ []);
23
25
  filter = signal("", ...ngDevMode ? [{ debugName: "filter" }] : /* istanbul ignore next */ []);
24
26
  reasonPipe = new ReasonPipe();
25
27
  reason = (r) => this.reasonPipe.transform(r);
26
- data = apiResource({ stream: () => forkJoin({
27
- services: this.api.resources("service"),
28
- health: this.api.health({ subjectType: "service" })
29
- }).pipe(map(({ services, health }) => ({
30
- services: services.items,
31
- health: health.items,
32
- capped: services.nextCursor !== null || health.nextCursor !== null
33
- }))) });
28
+ data = apiResource({
29
+ params: () => ({ retired: this.showRetired() }),
30
+ stream: ({ params }) => forkJoin({
31
+ services: this.api.resources("service", params.retired),
32
+ health: this.api.health({ subjectType: "service" })
33
+ }).pipe(map(({ services, health }) => ({
34
+ services: services.items,
35
+ health: health.items,
36
+ capped: services.nextCursor !== null || health.nextCursor !== null
37
+ })))
38
+ });
34
39
  capped = computed(() => this.data.value()?.capped ?? false, ...ngDevMode ? [{ debugName: "capped" }] : /* istanbul ignore next */ []);
35
40
  error = computed(() => problemText(this.data.error()), ...ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []);
36
41
  rows = computed(() => {
@@ -48,7 +53,7 @@ var ServicesPage = class ServicesPage {
48
53
  health,
49
54
  worst
50
55
  };
51
- }).filter((s) => !env || s.health.length > 0).filter((s) => !q || s.key.toLowerCase().includes(q)).filter((s) => !this.state() || s.health.some((h) => h.state === this.state())).sort((a, b) => SEVERITY.indexOf(a.worst?.state ?? "Unknown") - SEVERITY.indexOf(b.worst?.state ?? "Unknown") || a.key.localeCompare(b.key));
56
+ }).filter((s) => !env || s.health.length > 0).filter((s) => !q || s.key.toLowerCase().includes(q)).filter((s) => !this.state() || s.health.some((h) => h.state === this.state())).sort((a, b) => Number(!!a.retiredAt) - Number(!!b.retiredAt) || SEVERITY.indexOf(a.worst?.state ?? "Unknown") - SEVERITY.indexOf(b.worst?.state ?? "Unknown") || a.key.localeCompare(b.key));
52
57
  }, ...ngDevMode ? [{ debugName: "rows" }] : /* istanbul ignore next */ []);
53
58
  pages = screenPages(this.rows);
54
59
  onSearch(query) {
@@ -68,17 +73,29 @@ var ServicesPage = class ServicesPage {
68
73
  type: ServicesPage,
69
74
  isStandalone: true,
70
75
  selector: "ng-component",
71
- inputs: { state: {
72
- classPropertyName: "state",
73
- publicName: "state",
74
- isSignal: true,
75
- isRequired: false,
76
- transformFunction: null
77
- } },
76
+ inputs: {
77
+ state: {
78
+ classPropertyName: "state",
79
+ publicName: "state",
80
+ isSignal: true,
81
+ isRequired: false,
82
+ transformFunction: null
83
+ },
84
+ retired: {
85
+ classPropertyName: "retired",
86
+ publicName: "retired",
87
+ isSignal: true,
88
+ isRequired: false,
89
+ transformFunction: null
90
+ }
91
+ },
78
92
  ngImport: i0,
79
93
  template: `
80
94
  <jc-context-bar><h1>Services</h1>
81
- @if (state()) { <span class="jc-chip">{{ state() }} <a [routerLink]="['services'] | jcLink" [queryParams]="ctx.keep()">×</a></span> }
95
+ @if (state()) { <span class="jc-chip">{{ state() }} <a [routerLink]="['services'] | jcLink" [queryParams]="ctx.keep({ retired: showRetired() || null })">×</a></span> }
96
+ <a class="jc-small" data-testid="services-retired" [routerLink]="['services'] | jcLink"
97
+ [queryParams]="ctx.keep({ state: state() || null, retired: showRetired() ? null : 'true' })"
98
+ title="Discovery retires a service after Discovery:ServiceRetireAfter without telemetry (14 days by default)">{{ showRetired() ? 'Hide retired' : 'Show retired' }}</a>
82
99
  </jc-context-bar>
83
100
  @if (data.isLoading()) { <mat-progress-bar mode="indeterminate" /> }
84
101
  @if (data.error()) { <p class="jc-error">{{ error() }}</p> }
@@ -90,9 +107,11 @@ var ServicesPage = class ServicesPage {
90
107
  <tr>
91
108
  <td><a [routerLink]="['services', s.id] | jcLink" [queryParams]="ctx.keep()">{{ s.key }}</a></td>
92
109
  <td class="jc-envs">
110
+ @if (s.retiredAt) { <span class="jc-badge jc-health-none" data-testid="service-retired" [title]="'Retired ' + (s.retiredAt | ago)">Retired</span> }
111
+ @if (s.signalPacks?.includes('juice')) { <span class="jc-badge jc-health-none" data-testid="service-juice" title="Sends Juice signals: the Juice rule templates and outbox figures apply">Juice</span> }
93
112
  @for (h of s.health; track h.environment) {
94
113
  <span><span class="jc-muted jc-small">{{ h.environment ?? '—' }}</span> <jc-health [state]="h.state" [stale]="h.stale" /></span>
95
- } @empty { <jc-health [state]="null" /> }
114
+ } @empty { @if (!s.retiredAt) { <jc-health [state]="null" /> } }
96
115
  </td>
97
116
  <td class="jc-small">{{ s.worst?.reasons?.slice(0, 2)?.map(reason)?.join(' · ') }}</td>
98
117
  <td>{{ s.lastSeen | ago }}</td>
@@ -209,7 +228,10 @@ i0.ɵɵngDeclareClassMetadata({
209
228
  ],
210
229
  template: `
211
230
  <jc-context-bar><h1>Services</h1>
212
- @if (state()) { <span class="jc-chip">{{ state() }} <a [routerLink]="['services'] | jcLink" [queryParams]="ctx.keep()">×</a></span> }
231
+ @if (state()) { <span class="jc-chip">{{ state() }} <a [routerLink]="['services'] | jcLink" [queryParams]="ctx.keep({ retired: showRetired() || null })">×</a></span> }
232
+ <a class="jc-small" data-testid="services-retired" [routerLink]="['services'] | jcLink"
233
+ [queryParams]="ctx.keep({ state: state() || null, retired: showRetired() ? null : 'true' })"
234
+ title="Discovery retires a service after Discovery:ServiceRetireAfter without telemetry (14 days by default)">{{ showRetired() ? 'Hide retired' : 'Show retired' }}</a>
213
235
  </jc-context-bar>
214
236
  @if (data.isLoading()) { <mat-progress-bar mode="indeterminate" /> }
215
237
  @if (data.error()) { <p class="jc-error">{{ error() }}</p> }
@@ -221,9 +243,11 @@ i0.ɵɵngDeclareClassMetadata({
221
243
  <tr>
222
244
  <td><a [routerLink]="['services', s.id] | jcLink" [queryParams]="ctx.keep()">{{ s.key }}</a></td>
223
245
  <td class="jc-envs">
246
+ @if (s.retiredAt) { <span class="jc-badge jc-health-none" data-testid="service-retired" [title]="'Retired ' + (s.retiredAt | ago)">Retired</span> }
247
+ @if (s.signalPacks?.includes('juice')) { <span class="jc-badge jc-health-none" data-testid="service-juice" title="Sends Juice signals: the Juice rule templates and outbox figures apply">Juice</span> }
224
248
  @for (h of s.health; track h.environment) {
225
249
  <span><span class="jc-muted jc-small">{{ h.environment ?? '—' }}</span> <jc-health [state]="h.state" [stale]="h.stale" /></span>
226
- } @empty { <jc-health [state]="null" /> }
250
+ } @empty { @if (!s.retiredAt) { <jc-health [state]="null" /> } }
227
251
  </td>
228
252
  <td class="jc-small">{{ s.worst?.reasons?.slice(0, 2)?.map(reason)?.join(' · ') }}</td>
229
253
  <td>{{ s.lastSeen | ago }}</td>
@@ -237,15 +261,25 @@ i0.ɵɵngDeclareClassMetadata({
237
261
  }`
238
262
  }]
239
263
  }],
240
- propDecorators: { state: [{
241
- type: i0.Input,
242
- args: [{
243
- isSignal: true,
244
- alias: "state",
245
- required: false
264
+ propDecorators: {
265
+ state: [{
266
+ type: i0.Input,
267
+ args: [{
268
+ isSignal: true,
269
+ alias: "state",
270
+ required: false
271
+ }]
272
+ }],
273
+ retired: [{
274
+ type: i0.Input,
275
+ args: [{
276
+ isSignal: true,
277
+ alias: "retired",
278
+ required: false
279
+ }]
246
280
  }]
247
- }] }
281
+ }
248
282
  });
249
283
  export { ServicesPage };
250
284
 
251
- //# sourceMappingURL=juice-js-observability-services.page-CBtxLm0R.mjs.map
285
+ //# sourceMappingURL=juice-js-observability-services.page-BfLmDTLd.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"juice-js-observability-services.page-BfLmDTLd.mjs","names":[],"sources":["../../../../projects/juice-js/observability/src/lib/pages/services.page.ts"],"sourcesContent":["import { LinkPipe } from '../core/options';\nimport { ChangeDetectionStrategy, Component, computed, inject, input, signal } from '@angular/core';\nimport { apiResource } from '../shared/resource';\nimport { MatPaginatorModule } from '@angular/material/paginator';\nimport { MatProgressBarModule } from '@angular/material/progress-bar';\nimport { RouterLink } from '@angular/router';\nimport { SearchablePage } from '@juice-js/layout';\nimport { forkJoin, map } from 'rxjs';\nimport { ApiService } from '../core/api.service';\nimport { ContextService } from '../core/context.service';\nimport { Health, HealthState } from '../core/models';\nimport { AgoPipe, ReasonPipe } from '../shared/format';\nimport { ContextBar, HealthBadge } from '../shared/ui';\nimport { problemText } from '../shared/telemetry';\nimport { screenPages } from '../shared/paging';\n\nconst SEVERITY: HealthState[] = ['Critical', 'Unhealthy', 'Degraded', 'Offline', 'Unknown', 'Healthy'];\n\n/**\n * The service catalog (Console requirements §8): one row per service, environment-independent, with its health in\n * each environment. The toolbar search box filters it.\n */\n@Component({\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [LinkPipe, RouterLink, MatPaginatorModule, MatProgressBarModule, ContextBar, HealthBadge, AgoPipe],\n template: `\n <jc-context-bar><h1>Services</h1>\n @if (state()) { <span class=\"jc-chip\">{{ state() }} <a [routerLink]=\"['services'] | jcLink\" [queryParams]=\"ctx.keep({ retired: showRetired() || null })\">×</a></span> }\n <a class=\"jc-small\" data-testid=\"services-retired\" [routerLink]=\"['services'] | jcLink\"\n [queryParams]=\"ctx.keep({ state: state() || null, retired: showRetired() ? null : 'true' })\"\n title=\"Discovery retires a service after Discovery:ServiceRetireAfter without telemetry (14 days by default)\">{{ showRetired() ? 'Hide retired' : 'Show retired' }}</a>\n </jc-context-bar>\n @if (data.isLoading()) { <mat-progress-bar mode=\"indeterminate\" /> }\n @if (data.error()) { <p class=\"jc-error\">{{ error() }}</p> }\n @if (capped()) { <p class=\"jc-notice\">Showing the first 5,000 only. Narrow the list with the search box or a filter.</p> }\n <table class=\"jc-table\">\n <thead><tr><th>Service</th><th>Health by environment</th><th>Why</th><th>Last seen</th></tr></thead>\n <tbody>\n @for (s of pages.visible(); track s.id) {\n <tr>\n <td><a [routerLink]=\"['services', s.id] | jcLink\" [queryParams]=\"ctx.keep()\">{{ s.key }}</a></td>\n <td class=\"jc-envs\">\n @if (s.retiredAt) { <span class=\"jc-badge jc-health-none\" data-testid=\"service-retired\" [title]=\"'Retired ' + (s.retiredAt | ago)\">Retired</span> }\n @if (s.signalPacks?.includes('juice')) { <span class=\"jc-badge jc-health-none\" data-testid=\"service-juice\" title=\"Sends Juice signals: the Juice rule templates and outbox figures apply\">Juice</span> }\n @for (h of s.health; track h.environment) {\n <span><span class=\"jc-muted jc-small\">{{ h.environment ?? '—' }}</span> <jc-health [state]=\"h.state\" [stale]=\"h.stale\" /></span>\n } @empty { @if (!s.retiredAt) { <jc-health [state]=\"null\" /> } }\n </td>\n <td class=\"jc-small\">{{ s.worst?.reasons?.slice(0, 2)?.map(reason)?.join(' · ') }}</td>\n <td>{{ s.lastSeen | ago }}</td>\n </tr>\n } @empty { <tr><td colspan=\"4\" class=\"jc-muted\">No services{{ filter() ? ' match \"' + filter() + '\"' : '' }}.</td></tr> }\n </tbody>\n </table>\n @if (pages.needed()) {\n <mat-paginator [length]=\"rows().length\" [pageSize]=\"pages.size()\" [pageIndex]=\"pages.index()\" [pageSizeOptions]=\"pages.sizes\"\n (page)=\"pages.change($event)\" aria-label=\"Pages\" />\n }`,\n})\nexport class ServicesPage implements SearchablePage {\n protected readonly ctx = inject(ContextService);\n private readonly api = inject(ApiService);\n readonly state = input<string>();\n /** `?retired=true`: retired services too, listed after the others. */\n readonly retired = input<string>();\n protected readonly showRetired = computed(() => this.retired() === 'true');\n protected readonly filter = signal('');\n private readonly reasonPipe = new ReasonPipe();\n protected readonly reason = (r: string) => this.reasonPipe.transform(r);\n\n protected readonly data = apiResource({\n params: () => ({ retired: this.showRetired() }),\n stream: ({ params }) => forkJoin({\n services: this.api.resources('service', params.retired),\n health: this.api.health({ subjectType: 'service' }),\n }).pipe(map(({ services, health }) => ({\n services: services.items, health: health.items, capped: services.nextCursor !== null || health.nextCursor !== null,\n }))),\n });\n protected readonly capped = computed(() => this.data.value()?.capped ?? false);\n protected readonly error = computed(() => problemText(this.data.error()));\n\n protected readonly rows = computed(() => {\n const data = this.data.value();\n if (!data) return [];\n const env = this.ctx.environment();\n const byService = new Map<string, Health[]>();\n for (const h of data.health) byService.set(h.subjectId, [...(byService.get(h.subjectId) ?? []), h]);\n const q = this.filter().toLowerCase();\n return data.services\n .map(s => {\n const health = (byService.get(s.id) ?? []).filter(h => !env || h.environment === env);\n const worst = [...health].sort((a, b) => SEVERITY.indexOf(a.state) - SEVERITY.indexOf(b.state))[0];\n return { ...s, health, worst };\n })\n // With an environment chosen, only the services seen in it.\n .filter(s => !env || s.health.length > 0)\n .filter(s => !q || s.key.toLowerCase().includes(q))\n .filter(s => !this.state() || s.health.some(h => h.state === this.state()))\n // Retired services last (they have no health), then the worst state first, then by key.\n .sort((a, b) => Number(!!a.retiredAt) - Number(!!b.retiredAt)\n || SEVERITY.indexOf(a.worst?.state ?? 'Unknown') - SEVERITY.indexOf(b.worst?.state ?? 'Unknown') || a.key.localeCompare(b.key));\n });\n\n protected readonly pages = screenPages(this.rows);\n\n onSearch(query: string) { this.filter.set(query); }\n}\n"],"mappings":";;;;;;;;;;AAgBA,MAAM,WAA0B;CAAC;CAAY;CAAa;CAAY;CAAW;CAAW;AAAS;AA2CrG,IAAa,eAAb,MAAa,aAAY;CACJ,MAAM,OAAO,cAAc;CAC7B,MAAM,OAAO,UAAU;CAC/B,QAAQ,MAAe,GAAA,YAAA,CAAA,QAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAEvB,UAAU,MAAe,GAAA,YAAA,CAAA,QAAA,EAAA,WAAA,UAAA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Y;IAAa;GAAO;GAC1G,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiCX,CAAA"}
@@ -61,8 +61,14 @@ var ApiService = class ApiService {
61
61
  applications() {
62
62
  return this.get("/applications", { limit: 200 });
63
63
  }
64
- resources(type) {
65
- return this.all("/resources", { type });
64
+ resources(type, retired = false) {
65
+ return this.all("/resources", {
66
+ type,
67
+ retired: retired ? "true" : null
68
+ });
69
+ }
70
+ forgetService(id) {
71
+ return this.send("DELETE", `/resources/${id}`);
66
72
  }
67
73
  resource(id) {
68
74
  return this.get(`/resources/${id}`);
@@ -76,6 +82,9 @@ var ApiService = class ApiService {
76
82
  rules() {
77
83
  return this.get("/rules", { limit: 200 });
78
84
  }
85
+ signalPacks() {
86
+ return this.http.get(`${this.base}/signal-packs`);
87
+ }
79
88
  createRule(definition) {
80
89
  return this.send("POST", "/rules", definition);
81
90
  }
@@ -638,8 +647,8 @@ function page(path, title, load) {
638
647
  }
639
648
  const OBSERVABILITY_ROUTES = [
640
649
  page("", "Overview", () => import("./juice-js-observability-overview.page-CdSUNH6a.mjs").then((m) => m.OverviewPage)),
641
- page("services", "Services", () => import("./juice-js-observability-services.page-CBtxLm0R.mjs").then((m) => m.ServicesPage)),
642
- page("services/:id", "Service", () => import("./juice-js-observability-service.page-BAUPza0x.mjs").then((m) => m.ServicePage)),
650
+ page("services", "Services", () => import("./juice-js-observability-services.page-BfLmDTLd.mjs").then((m) => m.ServicesPage)),
651
+ page("services/:id", "Service", () => import("./juice-js-observability-service.page-DeOXv1WO.mjs").then((m) => m.ServicePage)),
643
652
  page("traces", "Traces", () => import("./juice-js-observability-traces.page-BkGlHFEK.mjs").then((m) => m.TracesPage)),
644
653
  page("traces/:traceId", "Trace", () => import("./juice-js-observability-trace.page-CtJQZkNW.mjs").then((m) => m.TracePage)),
645
654
  page("topology", "Dependencies", () => import("./juice-js-observability-topology.page-BN5NL2st.mjs").then((m) => m.TopologyPage)),
@@ -649,7 +658,7 @@ const OBSERVABILITY_ROUTES = [
649
658
  page("resources/:id", "Resource", () => import("./juice-js-observability-resource.page-CIY0hWSX.mjs").then((m) => m.ResourcePage)),
650
659
  page("alerts", "Alerts", () => import("./juice-js-observability-alerts.page-up57Y8fX.mjs").then((m) => m.AlertsPage)),
651
660
  page("alerts/:id", "Alert", () => import("./juice-js-observability-alert.page-KyakwaUL.mjs").then((m) => m.AlertPage)),
652
- page("rules", "Rules", () => import("./juice-js-observability-rules.page-AbY-0A8n.mjs").then((m) => m.RulesPage)),
661
+ page("rules", "Rules", () => import("./juice-js-observability-rules.page-DXORXLHp.mjs").then((m) => m.RulesPage)),
653
662
  page("notifications", "Notifications", () => import("./juice-js-observability-notifications.page-DIXE52Rt.mjs").then((m) => m.NotificationsPage)),
654
663
  page("silences", "Silences", () => import("./juice-js-observability-silences.page-WxGogpDD.mjs").then((m) => m.SilencesPage)),
655
664
  page("incidents", "Incidents", () => import("./juice-js-observability-incidents.page-B4DbQAWr.mjs").then((m) => m.IncidentsPage)),
@@ -1 +1 @@
1
- {"version":3,"file":"juice-js-observability.mjs","names":[],"sources":["../../../../projects/juice-js/observability/src/lib/core/api.service.ts","../../../../projects/juice-js/observability/src/lib/core/approval-count.ts","../../../../projects/juice-js/observability/src/lib/core/options.ts","../../../../projects/juice-js/observability/src/lib/core/context.service.ts","../../../../projects/juice-js/observability/src/lib/observability.routes.ts"],"sourcesContent":["import { HttpClient, HttpParams } from '@angular/common/http';\nimport { Injectable, inject, signal } from '@angular/core';\nimport { EMPTY, Observable, expand, map, reduce, shareReplay, switchMap, tap } from 'rxjs';\nimport { OBSERVABILITY_OPTIONS } from './options';\nimport {\n ActionRequest, ActionRequestsWaiting, ActionTarget, Agent, SloDetail, SloSummary, AgentActions, AgentCommand, AgentPackage, EnrollmentToken, AlertDetail, AlertNotifications, Alert, AllowlistEntry, Application, Channel, ChannelTestResult, Delivery, EscalationPolicy, IncidentDetail, IncidentEvent, IncidentSummary, Silence, DependencyEvidence, DependencyStatsPage, DeploymentEnvironment, LoadRun, LoadRunResults, Related, Timeline, Health, LogRecord, MetricInfo, Operation,\n Page, PlatformOverview, ResourceDetail, ResourceSummary, Rule, SearchHit, Series, Capacity, ServiceStats, Tenant, TelemetryPage, Topology, Trace,\n TraceSummary, Suggestions, CorrelationDecision,\n} from './models';\n\n/**\n * A random UUID v4 for `Idempotency-Key`. Not `crypto.randomUUID()`: browsers offer it only in a secure context (HTTPS or localhost), so it\n * throws on a Console opened over plain HTTP at the machine's address, as the local stack is. `getRandomValues` works everywhere.\n */\nexport function idempotencyKey(): string {\n const b = crypto.getRandomValues(new Uint8Array(16));\n b[6] = (b[6] & 0x0f) | 0x40;\n b[8] = (b[8] & 0x3f) | 0x80;\n const hex = Array.from(b, x => x.toString(16).padStart(2, '0')).join('');\n return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;\n}\n\nexport type Query =Record<string, string | number | boolean | string[] | null | undefined>;\n\n/**\n * The Console's only backend: the Juice API (Console requirements §3). One deployment serves one tenant, the one the\n * signed-in user's token names.\n */\n@Injectable({ providedIn: 'root' })\nexport class ApiService {\n private readonly http = inject(HttpClient);\n private readonly base = `${inject(OBSERVABILITY_OPTIONS).apiBase}/api/v1`;\n\n /** Set once a page has fetched the caller's tenant: the user is signed in, so background calls such as {@link ApprovalCount}'s may start. */\n readonly tenantKnown = signal(false);\n\n /** The caller's tenant, fetched once. */\n readonly tenant$: Observable<Tenant> = this.http.get<Page<Tenant>>(`${this.base}/tenants`).pipe(\n map(page => {\n if (page.items.length === 0) throw new Error('No tenant is authorized for this user.');\n return page.items[0];\n }),\n tap(() => this.tenantKnown.set(true)),\n shareReplay(1),\n );\n\n private get<T>(path: string, query: Query = {}): Observable<T> {\n let params = new HttpParams();\n for (const [key, value] of Object.entries(query)) {\n if (value === null || value === undefined || value === '') continue;\n for (const item of Array.isArray(value) ? value : [value]) params = params.append(key, String(item));\n }\n return this.tenant$.pipe(switchMap(t => this.http.get<T>(`${this.base}/tenants/${t.id}${path}`, { params })));\n }\n\n /** A change. `Idempotency-Key` on what can be retried, so a repeated click or a lost response doesn't do it twice. */\n private send<T>(method: 'POST' | 'PUT' | 'DELETE', path: string, body?: unknown, headers: Record<string, string> = {}): Observable<T> {\n return this.tenant$.pipe(switchMap(t => this.http.request<T>(method, `${this.base}/tenants/${t.id}${path}`, { body, headers })));\n }\n private once<T>(path: string, body: unknown): Observable<T> { return this.send<T>('POST', path, body, { 'Idempotency-Key': idempotencyKey() }); }\n\n /** Every page of a cursor-paged list (bounded: at most `maxPages` requests). */\n private all<T>(path: string, query: Query = {}, maxPages = 25): Observable<Page<T>> {\n let pages = 0;\n return this.get<Page<T>>(path, { ...query, limit: 200 }).pipe(\n expand(page => page.nextCursor && ++pages < maxPages ? this.get<Page<T>>(path, { ...query, limit: 200, cursor: page.nextCursor }) : EMPTY),\n reduce((all, page) => ({ items: [...all.items, ...page.items], nextCursor: page.nextCursor }), { items: [] as T[], nextCursor: null as string | null }),\n );\n }\n\n environments() { return this.get<Page<DeploymentEnvironment>>('/environments'); }\n applications() { return this.get<Page<Application>>('/applications', { limit: 200 }); }\n resources(type?: string) { return this.all<ResourceSummary>('/resources', { type }); }\n resource(id: string) { return this.get<ResourceDetail>(`/resources/${id}`); }\n health(query: Query) { return this.all<Health>('/health', query); }\n topology(environment?: string | null) { return this.get<Topology>('/topology', { environment }); }\n\n rules() { return this.get<Page<Rule>>('/rules', { limit: 200 }); }\n createRule(definition: unknown) { return this.send<Rule>('POST', '/rules', definition); }\n /** With the rule's etag, so a change made since it was read isn't overwritten. */\n updateRule(key: string, definition: unknown, etag: string) { return this.send<Rule>('PUT', `/rules/${key}`, definition, { 'If-Match': `\"${etag}\"` }); }\n\n channels() { return this.get<Page<Channel>>('/webhooks'); }\n createChannel(body: unknown) { return this.send<Channel>('POST', '/webhooks', body); }\n updateChannel(id: string, body: unknown) { return this.send<Channel>('PUT', `/webhooks/${id}`, body); }\n deliveries(id: string, query: Query = {}) { return this.get<Page<Delivery>>(`/webhooks/${id}/deliveries`, { limit: 50, ...query }); }\n testChannel(id: string) { return this.send<ChannelTestResult>('POST', `/webhooks/${id}/test`); }\n retryDelivery(channelId: string, deliveryId: string) { return this.send<Delivery>('POST', `/webhooks/${channelId}/deliveries/${deliveryId}/retry`); }\n allowlist() { return this.get<Page<AllowlistEntry>>('/webhooks/allowlist'); }\n putAllowlist(destination: string, ports: number[]) { return this.send<AllowlistEntry>('PUT', '/webhooks/allowlist', { destination, ports }); }\n removeAllowlist(destination: string) { return this.send<void>('DELETE', `/webhooks/allowlist?destination=${encodeURIComponent(destination)}`); }\n\n escalationPolicies() { return this.get<Page<EscalationPolicy>>('/escalation-policies'); }\n createEscalationPolicy(body: unknown) { return this.send<EscalationPolicy>('POST', '/escalation-policies', body); }\n updateEscalationPolicy(key: string, body: unknown) { return this.send<EscalationPolicy>('PUT', `/escalation-policies/${key}`, body); }\n\n silences(query: Query = {}) { return this.get<Page<Silence>>('/silences', { limit: 200, ...query }); }\n createSilence(body: unknown) { return this.once<Silence>('/silences', body); }\n cancelSilence(id: string) { return this.send<void>('DELETE', `/silences/${id}`); }\n\n incidents(query: Query = {}) { return this.get<Page<IncidentSummary>>('/incidents', { limit: 100, ...query }); }\n incident(id: string) { return this.get<IncidentDetail>(`/incidents/${id}`); }\n createIncident(body: unknown) { return this.once<IncidentSummary>('/incidents', body); }\n moveIncident(id: string, to: string, comment: string) { return this.once<IncidentSummary>(`/incidents/${id}/transitions`, { to, comment }); }\n addIncidentNote(id: string, text: string) { return this.once<IncidentEvent>(`/incidents/${id}/notes`, { text }); }\n removeIncidentAlert(id: string, alertId: string) { return this.send<void>('DELETE', `/incidents/${id}/alerts/${alertId}`); }\n /** Active agents, or with `all` the revoked ones too (at most 500). */\n agents(all = false) { return this.get<Page<Agent>>('/agents', { all: all || null }); }\n agent(id: string) { return this.get<Agent>(`/agents/${id}`); }\n createEnrollmentToken(purpose: string, expiresInMinutes: number) { return this.send<EnrollmentToken>('POST', '/agents/enrollment-tokens', { purpose, expiresInMinutes }); }\n revokeAgent(id: string, reason: string) { return this.send<Agent>('POST', `/agents/${id}/revocation`, { reason }); }\n /** What the agent reported it can run, custom actions included, with what its host permits; the built-ins if it never reported. */\n agentActions(id: string) { return this.get<AgentActions>(`/agents/${id}/actions`); }\n agentPackages() { return this.get<Page<AgentPackage>>('/agents/packages'); }\n /** Idempotent: a repeated click or a lost response signs one command, not two. */\n issueCommand(id: string, action: string, parameters: Record<string, unknown>) { return this.once<AgentCommand>(`/agents/${id}/commands`, { action, parameters }); }\n /** Asks for an action under its approval policy: issued at once when nobody else needs to approve, otherwise waiting. */\n requestAction(agentId: string, action: string, parameters: Record<string, unknown>, reason: string, target: ActionTarget | null = null) {\n return this.once<ActionRequest>(`/agents/${agentId}/action-requests`, { action, parameters, reason, target });\n }\n actionRequests(query: Query = {}) { return this.get<Page<ActionRequest>>('/action-requests', { limit: 100, ...query }); }\n /** The platform panel and capacity view (operators and admins of this deployment; a viewer gets 403). Not under a tenant: the platform's own. */\n platformOverview(): Observable<PlatformOverview> { return this.tenant$.pipe(switchMap(() => this.http.get<PlatformOverview>(`${this.base}/platform/overview`))); }\n\n /** A diagnostic bundle's zip (operators and admins; audited). */\n downloadBundle(agentId: string, bundleId: string) {\n return this.tenant$.pipe(switchMap(t => this.http.get(`${this.base}/tenants/${t.id}/agents/${agentId}/bundles/${bundleId}`, { responseType: 'blob', observe: 'response' })));\n }\n /** SLOs, technical or business apart (category), with their budgets and burn rates. */\n slos(category?: string) { return this.get<Page<SloSummary>>('/slos', { category }); }\n slo(key: string) { return this.get<SloDetail>(`/slos/${encodeURIComponent(key)}`); }\n /** How many requests wait, and how many of them the signed-in user can decide. */\n waitingRequests() { return this.get<ActionRequestsWaiting>('/action-requests/waiting'); }\n approveRequest(id: string, comment: string) { return this.send<ActionRequest>('POST', `/action-requests/${id}/approval`, { comment }); }\n rejectRequest(id: string, comment: string) { return this.send<ActionRequest>('POST', `/action-requests/${id}/rejection`, { comment }); }\n cancelRequest(id: string) { return this.send<ActionRequest>('POST', `/action-requests/${id}/cancellation`, {}); }\n agentCommands(id: string, cursor?: string | null) { return this.get<Page<AgentCommand>>(`/agents/${id}/commands`, { limit: 25, cursor }); }\n\n alertNotifications(id: string) { return this.get<AlertNotifications>(`/alerts/${id}/notifications`); }\n\n /** One page of alerts, newest first; pass the previous page's `nextCursor` as `cursor` for the next. */\n alerts(query: Query) { return this.get<Page<Alert>>('/alerts', { limit: 100, ...query }); }\n /** Every alert matching the query (bounded, like the other complete lists). */\n allAlerts(query: Query) { return this.all<Alert>('/alerts', query); }\n alert(id: string) { return this.get<AlertDetail>(`/alerts/${id}`); }\n acknowledge(id: string, comment: string): Observable<Alert> {\n return this.tenant$.pipe(switchMap(t => this.http.post<Alert>(`${this.base}/tenants/${t.id}/alerts/${id}/acknowledgement`,\n { comment }, { headers: { 'Idempotency-Key': idempotencyKey() } })));\n }\n\n traces(query: Query) { return this.get<TelemetryPage<TraceSummary>>('/telemetry/traces', query); }\n trace(traceId: string) { return this.get<Trace>(`/telemetry/traces/${traceId}`); }\n logs(query: Query) { return this.get<TelemetryPage<LogRecord>>('/telemetry/logs', query); }\n operations(query: Query) { return this.get<TelemetryPage<Operation>>('/telemetry/operations', query); }\n metrics(query: Query) { return this.get<TelemetryPage<MetricInfo>>('/telemetry/metrics', query); }\n series(query: Query) { return this.get<Series>('/telemetry/metrics/series', query); }\n serviceStats(query: Query) { return this.get<ServiceStats>('/telemetry/service-stats', query); }\n capacity(query: Query) { return this.get<Capacity>('/telemetry/capacity', query); }\n timeline(query: Query) { return this.get<Timeline>('/timeline', query); }\n relatedToAlert(id: string) { return this.get<Related>(`/alerts/${id}/related`); }\n alertSuggestions(id: string) { return this.get<Suggestions>(`/alerts/${id}/suggestions`); }\n incidentSuggestions(id: string) { return this.get<Suggestions>(`/incidents/${id}/suggestions`); }\n acceptSuggestion(alertId: string, otherId: string) { return this.once<CorrelationDecision>(`/alerts/${alertId}/suggestions/${otherId}/accept`, {}); }\n dismissSuggestion(alertId: string, otherId: string, reason: string) { return this.once<CorrelationDecision>(`/alerts/${alertId}/suggestions/${otherId}/dismiss`, { reason }); }\n loadRuns(query: Query) { return this.get<Page<LoadRun>>('/load-runs', query); }\n loadRunResults(id: string) { return this.get<LoadRunResults>(`/load-runs/${id}/results`); }\n dependencyStats(query: Query) { return this.get<DependencyStatsPage>('/telemetry/dependencies', query); }\n dependency(id: string, query: Query) { return this.get<DependencyEvidence>(`/telemetry/dependencies/${id}`, query); }\n search(q: string) { return this.get<TelemetryPage<SearchHit>>('/search', { q }); }\n}\n","import { DOCUMENT } from '@angular/common';\nimport { DestroyRef, Injectable, effect, inject, signal, untracked } from '@angular/core';\nimport { NavigationEnd, Router } from '@angular/router';\nimport { Subscription, filter, fromEvent, timer, switchMap } from 'rxjs';\nimport { MenuBadgeService } from '@juice-js/layout';\nimport { ApiService } from './api.service';\n\n/**\n * How many action requests wait for the signed-in user to decide, refreshed every 30 seconds from whatever page is open, and at once\n * when a page made or decided one ({@link refresh}). It starts only once a page has fetched the tenant: before that the user may still be\n * signing in, and an early call would fail, along with the page's own call sharing it. It stops on an error (signed out, or no rights)\n * until the next navigation, so a signed-out tab doesn't keep asking. A tab out of sight doesn't ask either; it asks at once on coming back.\n */\n@Injectable({ providedIn: 'root' })\nexport class ApprovalCount {\n static readonly Every = 30_000;\n\n private readonly api = inject(ApiService);\n private readonly document = inject(DOCUMENT);\n private polling: Subscription | null = null;\n /** Requests the signed-in user can approve or reject now. */\n readonly forYou = signal(0);\n\n constructor() {\n effect(() => { if (this.api.tenantKnown() && !untracked(() => this.polling)) untracked(() => this.start()); });\n const navigations = inject(Router).events.pipe(filter(e => e instanceof NavigationEnd))\n .subscribe(() => { if (!this.polling && this.api.tenantKnown()) this.start(); });\n // Back in sight: what waits may have changed meanwhile.\n const shown = fromEvent(this.document, 'visibilitychange').pipe(filter(() => !this.document.hidden))\n .subscribe(() => { if (this.polling) this.start(); });\n inject(DestroyRef).onDestroy(() => { navigations.unsubscribe(); shown.unsubscribe(); this.polling?.unsubscribe(); });\n }\n\n /** Asks again now, for a page that just changed what waits. */\n refresh() { if (this.api.tenantKnown()) this.start(); }\n\n private start() {\n this.polling?.unsubscribe();\n this.polling = timer(0, ApprovalCount.Every).pipe(filter(() => !this.document.hidden), switchMap(() => this.api.waitingRequests())).subscribe({\n next: w => this.forYou.set(w.forYou),\n error: () => { this.forYou.set(0); this.polling = null; },\n });\n }\n}\n\n/** The menu id of the Approvals entry in {@link observabilityMenus}, where {@link ApprovalMenuBadge} shows the count. */\nexport const APPROVALS_MENU_ID = 'approvals';\n\n/**\n * Shows {@link ApprovalCount} on the Approvals entry of juice-layout's side menu (by its menu id, {@link APPROVALS_MENU_ID}). The menu\n * draws it: beside the label, on the icon while folded, and on the header of the closed group it sits in.\n */\n@Injectable({ providedIn: 'root' })\nexport class ApprovalMenuBadge {\n constructor() {\n const count = inject(ApprovalCount), badges = inject(MenuBadgeService);\n effect(() => {\n const n = count.forYou();\n badges.set(APPROVALS_MENU_ID, { count: n, hint: `${n} request${n === 1 ? '' : 's'} waiting for your approval` });\n });\n inject(DestroyRef).onDestroy(() => badges.clear(APPROVALS_MENU_ID));\n }\n}\n","import { EnvironmentProviders, Injectable, InjectionToken, Pipe, PipeTransform, inject, makeEnvironmentProviders, provideEnvironmentInitializer } from '@angular/core';\nimport { ApprovalMenuBadge } from './approval-count';\n\n/** How the host app mounts Juice Observability. */\nexport interface ObservabilityOptions {\n /** The Juice API origin; empty when the API serves the app (same origin). */\n apiBase: string;\n /** Where the host mounts {@link OBSERVABILITY_ROUTES}: `/` for the whole app, or a path such as `/observability`. */\n basePath: string;\n /**\n * A link to the audit records of a trace, shown on the trace page: for the Juice Audit pages mounted at `/audit`,\n * `id => ['/audit/traces', id]`. A string is an external URL. Without it, no link.\n */\n auditLink?: ((traceId: string) => unknown[] | string | null) | null;\n /** Show on the Approvals menu entry how many action requests wait for the signed-in user. On unless false. */\n approvalCount?: boolean;\n}\n\nexport const OBSERVABILITY_OPTIONS = new InjectionToken<ObservabilityOptions>('OBSERVABILITY_OPTIONS', {\n providedIn: 'root',\n factory: () => ({ apiBase: '', basePath: '/', auditLink: null }),\n});\n\n/**\n * Configures the pages: where the API is, where the host mounted the routes, and where a trace's audit records open. Also shows the count\n * of requests waiting for approval on the Approvals menu entry, unless `approvalCount: false`.\n */\nexport function provideJuiceObservability(options: Partial<ObservabilityOptions> = {}): EnvironmentProviders {\n return makeEnvironmentProviders([\n {\n provide: OBSERVABILITY_OPTIONS,\n useValue: {\n apiBase: options.apiBase ?? '',\n basePath: options.basePath ?? '/',\n auditLink: options.auditLink ?? null,\n } satisfies ObservabilityOptions,\n },\n ...(options.approvalCount === false ? [] : [provideEnvironmentInitializer(() => { inject(ApprovalMenuBadge); })]),\n ]);\n}\n\n/** `/observability/` → `/observability`; `` and `/` → `/`. */\nexport function normalizeBasePath(basePath: string): string {\n const trimmed = basePath.trim().replace(/^\\/+|\\/+$/g, '');\n return trimmed ? `/${trimmed}` : '/';\n}\n\n/** Router links to the pages, under the host's mount path. */\n@Injectable({ providedIn: 'root' })\nexport class ObservabilityLinks {\n private readonly options = inject(OBSERVABILITY_OPTIONS);\n readonly base = normalizeBasePath(this.options.basePath);\n\n /** `to('services', id)` → `['/observability', 'services', id]`. */\n to(...segments: unknown[]): unknown[] { return [this.base, ...segments]; }\n\n /** The host's link to the audit records of a trace, if it gave one. */\n audit(traceId: string | null | undefined): { route: unknown[] } | { href: string } | null {\n if (!traceId || !this.options.auditLink) return null;\n const link = this.options.auditLink(traceId);\n if (!link) return null;\n return typeof link === 'string' ? { href: link } : { route: link };\n }\n}\n\n/** `['services', id] | jcLink`: the same as {@link ObservabilityLinks.to} in a template. */\n@Pipe({ name: 'jcLink' })\nexport class LinkPipe implements PipeTransform {\n private readonly links = inject(ObservabilityLinks);\n transform(segments: unknown[]): unknown[] { return this.links.to(...segments); }\n}\n","import { Injectable, computed, inject } from '@angular/core';\nimport { toSignal } from '@angular/core/rxjs-interop';\nimport { ActivatedRoute, NavigationEnd, Params, Router } from '@angular/router';\nimport { filter, map, startWith } from 'rxjs';\n\nexport const RANGES: Record<string, number> = {\n '15m': 15 * 60_000, '1h': 3_600_000, '6h': 6 * 3_600_000, '24h': 24 * 3_600_000, '7d': 7 * 24 * 3_600_000,\n};\n\n/** Search ranges are at most 24 hours (the API's bound); series and operations take up to 7 days. */\nexport const MAX_SEARCH_MS = RANGES['24h'];\n\n/**\n * The investigation context that follows the user between pages (Console requirements §17): environment and time\n * range. It lives in the URL (`env`, and `range` or `from`/`to`), so every page is a deep link and the browser's back\n * button restores it.\n */\n@Injectable({ providedIn: 'root' })\nexport class ContextService {\n private readonly router = inject(Router);\n\n // Created on first use, after the first navigation may already have ended: start from the current URL.\n private readonly params = toSignal(this.router.events.pipe(\n filter(e => e instanceof NavigationEnd),\n startWith(null),\n map(() => this.leaf().snapshot.queryParams),\n ), { initialValue: {} as Params });\n\n readonly environment = computed(() => (this.params()['env'] as string | undefined) ?? '');\n readonly range = computed(() => {\n const p = this.params();\n return p['from'] && p['to'] ? 'custom' : ((p['range'] as string | undefined) ?? '1h');\n });\n readonly absolute = computed(() => {\n const p = this.params();\n return p['from'] && p['to'] ? { from: p['from'] as string, to: p['to'] as string } : null;\n });\n\n /** The window as ISO strings, evaluated now for a relative range. */\n window(maxMs?: number): { from: string; to: string } {\n const absolute = this.absolute();\n if (absolute) return absolute;\n const to = Date.now();\n const span = Math.min(RANGES[this.range()] ?? RANGES['1h'], maxMs ?? Number.MAX_SAFE_INTEGER);\n return { from: new Date(to - span).toISOString(), to: new Date(to).toISOString() };\n }\n\n /** Query parameters for a link: the context plus the target page's own. */\n keep(extra: Params = {}): Params {\n const p = this.params();\n const context: Params = {};\n for (const key of ['env', 'range', 'from', 'to']) if (p[key]) context[key] = p[key];\n return { ...context, ...extra };\n }\n\n /** Changes the context on the current page, keeping its other parameters. */\n set(change: { env?: string | null; range?: string | null; from?: string | null; to?: string | null }) {\n const queryParams: Params = { ...change };\n if (change.range) Object.assign(queryParams, { from: null, to: null });\n void this.router.navigate([], { relativeTo: this.leaf(), queryParams, queryParamsHandling: 'merge' });\n }\n\n /** A time window centred on a moment, for \"around this span\" links. */\n around(at: string, durationMs: number, paddingMs = 5 * 60_000): Params {\n const start = new Date(at).getTime();\n return this.keep({\n from: new Date(start - paddingMs).toISOString(),\n to: new Date(start + durationMs + paddingMs).toISOString(),\n range: null,\n });\n }\n\n private leaf(): ActivatedRoute {\n let route = this.router.routerState.root;\n while (route.firstChild) route = route.firstChild;\n return route;\n }\n}\n","import { Routes } from '@angular/router';\nimport { Menus } from '@juice-js/core';\nimport { APPROVALS_MENU_ID } from './core/approval-count';\nimport { normalizeBasePath } from './core/options';\n\nfunction page(path: string, title: string, load: Routes[number]['loadComponent']): Routes[number] {\n return { path, title: `${title} · Juice Observability`, loadComponent: load };\n}\n\n/**\n * The pages, investigation first (Console requirements §4): services, traces, topology, logs and metrics; alerts and\n * rules after. Detail pages are deep links (§17) and carry the environment and time range in their query parameters.\n * The host mounts them at its `basePath` (see {@link provideJuiceObservability}) and adds its own guards.\n */\nexport const OBSERVABILITY_ROUTES: Routes = [\n page('', 'Overview', () => import('./pages/overview.page').then(m => m.OverviewPage)),\n page('services', 'Services', () => import('./pages/services.page').then(m => m.ServicesPage)),\n page('services/:id', 'Service', () => import('./pages/service.page').then(m => m.ServicePage)),\n page('traces', 'Traces', () => import('./pages/traces.page').then(m => m.TracesPage)),\n page('traces/:traceId', 'Trace', () => import('./pages/trace.page').then(m => m.TracePage)),\n page('topology', 'Dependencies', () => import('./pages/topology.page').then(m => m.TopologyPage)),\n page('logs', 'Logs', () => import('./pages/logs.page').then(m => m.LogsPage)),\n page('metrics', 'Metrics', () => import('./pages/metrics.page').then(m => m.MetricsPage)),\n page('resources', 'Resources', () => import('./pages/resources.page').then(m => m.ResourcesPage)),\n page('resources/:id', 'Resource', () => import('./pages/resource.page').then(m => m.ResourcePage)),\n page('alerts', 'Alerts', () => import('./pages/alerts.page').then(m => m.AlertsPage)),\n page('alerts/:id', 'Alert', () => import('./pages/alert.page').then(m => m.AlertPage)),\n page('rules', 'Rules', () => import('./pages/rules.page').then(m => m.RulesPage)),\n page('notifications', 'Notifications', () => import('./pages/notifications.page').then(m => m.NotificationsPage)),\n page('silences', 'Silences', () => import('./pages/silences.page').then(m => m.SilencesPage)),\n page('incidents', 'Incidents', () => import('./pages/incidents.page').then(m => m.IncidentsPage)),\n page('incidents/:id', 'Incident', () => import('./pages/incident.page').then(m => m.IncidentPage)),\n page('agents', 'Agents', () => import('./pages/agents.page').then(m => m.AgentsPage)),\n page('agents/:id', 'Agent', () => import('./pages/agent.page').then(m => m.AgentPage)),\n page('approvals', 'Approvals', () => import('./pages/approvals.page').then(m => m.ApprovalsPage)),\n page('slos', 'SLOs', () => import('./pages/slos.page').then(m => m.SlosPage)),\n page('slos/:key', 'SLO', () => import('./pages/slo.page').then(m => m.SloPage)),\n page('timeline', 'Timeline', () => import('./pages/timeline.page').then(m => m.TimelinePage)),\n page('load-runs', 'Load runs', () => import('./pages/load-runs.page').then(m => m.LoadRunsPage)),\n];\n\n/**\n * The side menu entries (juice-layout), linking under `basePath`. The pages an investigation starts from sit at the top\n * with a `shortcut` for the shell's go-to keys; the rest are grouped (Explore, Automation, Configure).\n *\n * A group links to its first page and keeps its pages' own links (`replaceChildRouterLink: false`): juice-layout only\n * opens and closes the group on a click (it has no page of its own).\n * Group ids carry an `observability-` prefix, as the host's menu sits beside them.\n */\nexport function observabilityMenus(basePath = '/', order = 1): Menus {\n const base = normalizeBasePath(basePath);\n const link = (path: string) => (base === '/' ? `/${path}` : path ? `${base}/${path}` : base);\n const group = (id: string, label: string, icon: string, children: Menus): Menus[number] =>\n ({ id, label, icon, routerLink: children[0].routerLink, replaceChildRouterLink: false, children });\n const menus: Menus = [\n { id: 'overview', label: 'Overview', icon: 'dashboard', routerLink: link(''), shortcut: 'g o' },\n { id: 'services', label: 'Services', icon: 'hub', routerLink: link('services'), shortcut: 'g s' },\n { id: 'traces', label: 'Traces', icon: 'timeline', routerLink: link('traces'), shortcut: 'g t' },\n { id: 'logs', label: 'Logs', icon: 'notes', routerLink: link('logs'), shortcut: 'g l' },\n { id: 'metrics', label: 'Metrics', icon: 'show_chart', routerLink: link('metrics'), shortcut: 'g m' },\n { id: 'alerts', label: 'Alerts', icon: 'notifications', routerLink: link('alerts'), shortcut: 'g a' },\n { id: 'incidents', label: 'Incidents', icon: 'emergency', routerLink: link('incidents'), shortcut: 'g i' },\n group('observability-explore', 'Explore', 'explore', [\n { id: 'topology', label: 'Dependencies', icon: 'account_tree', routerLink: link('topology') },\n { id: 'resources', label: 'Resources', icon: 'dns', routerLink: link('resources') },\n { id: 'slos', label: 'SLOs', icon: 'track_changes', routerLink: link('slos') },\n { id: 'timeline', label: 'Timeline', icon: 'history', routerLink: link('timeline') },\n { id: 'load-runs', label: 'Load runs', icon: 'speed', routerLink: link('load-runs') },\n ]),\n group('observability-automation', 'Automation', 'precision_manufacturing', [\n { id: 'agents', label: 'Agents', icon: 'smart_toy', routerLink: link('agents') },\n { id: APPROVALS_MENU_ID, label: 'Approvals', icon: 'approval', routerLink: link('approvals') },\n ]),\n group('observability-configure', 'Configure', 'tune', [\n { id: 'rules', label: 'Rules', icon: 'rule', routerLink: link('rules') },\n { id: 'silences', label: 'Silences', icon: 'notifications_paused', routerLink: link('silences') },\n { id: 'notifications', label: 'Notifications', icon: 'campaign', routerLink: link('notifications') },\n ]),\n ];\n return menus.map((menu, index) => ({ ...menu, order: order + index }));\n}\n"],"mappings":";;;;;;;;AAcA,SAAgB,iBAAc;CAC5B,MAAM,IAAI,OAAO,gCAAgB,IAAI,WAAW,EAAE,CAAC;CACnD,EAAE,KAAM,EAAE,KAAK,KAAQ;CACvB,EAAE,KAAM,EAAE,KAAK,KAAQ;CACvB,MAAM,MAAM,MAAM,KAAK,IAAG,MAAK,EAAE,SAAS,EAAE,CAAC,CAAC,SAAS,GAAG,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C;GAC/F;IAAE,IAAI;IAAiB,OAAO;IAAiB,MAAM;IAAY,YAAY,KAAK,eAAe;GAAC;EACnG,CAAA;CAEI,CAAA,CAAM,KAAK,MAAM,WAAW;EAAE,GAAG;EAAM,OAAO,QAAQ;CAAK,EAAG;AACvE"}
1
+ {"version":3,"file":"juice-js-observability.mjs","names":[],"sources":["../../../../projects/juice-js/observability/src/lib/core/api.service.ts","../../../../projects/juice-js/observability/src/lib/core/approval-count.ts","../../../../projects/juice-js/observability/src/lib/core/options.ts","../../../../projects/juice-js/observability/src/lib/core/context.service.ts","../../../../projects/juice-js/observability/src/lib/observability.routes.ts"],"sourcesContent":["import { HttpClient, HttpParams } from '@angular/common/http';\nimport { Injectable, inject, signal } from '@angular/core';\nimport { EMPTY, Observable, expand, map, reduce, shareReplay, switchMap, tap } from 'rxjs';\nimport { OBSERVABILITY_OPTIONS } from './options';\nimport {\n ActionRequest, ActionRequestsWaiting, ActionTarget, Agent, SloDetail, SloSummary, AgentActions, AgentCommand, AgentPackage, EnrollmentToken, AlertDetail, AlertNotifications, Alert, AllowlistEntry, Application, Channel, ChannelTestResult, Delivery, EscalationPolicy, IncidentDetail, IncidentEvent, IncidentSummary, Silence, DependencyEvidence, DependencyStatsPage, DeploymentEnvironment, LoadRun, LoadRunResults, Related, Timeline, Health, LogRecord, MetricInfo, Operation,\n Page, PlatformOverview, ResourceDetail, ResourceSummary, Rule, SearchHit, Series, Capacity, ServiceStats, Tenant, TelemetryPage, Topology, Trace,\n TraceSummary, Suggestions, CorrelationDecision, SignalPack\n} from './models';\n\n/**\n * A random UUID v4 for `Idempotency-Key`. Not `crypto.randomUUID()`: browsers offer it only in a secure context (HTTPS or localhost), so it\n * throws on a Console opened over plain HTTP at the machine's address, as the local stack is. `getRandomValues` works everywhere.\n */\nexport function idempotencyKey(): string {\n const b = crypto.getRandomValues(new Uint8Array(16));\n b[6] = (b[6] & 0x0f) | 0x40;\n b[8] = (b[8] & 0x3f) | 0x80;\n const hex = Array.from(b, x => x.toString(16).padStart(2, '0')).join('');\n return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;\n}\n\nexport type Query =Record<string, string | number | boolean | string[] | null | undefined>;\n\n/**\n * The Console's only backend: the Juice API (Console requirements §3). One deployment serves one tenant, the one the\n * signed-in user's token names.\n */\n@Injectable({ providedIn: 'root' })\nexport class ApiService {\n private readonly http = inject(HttpClient);\n private readonly base = `${inject(OBSERVABILITY_OPTIONS).apiBase}/api/v1`;\n\n /** Set once a page has fetched the caller's tenant: the user is signed in, so background calls such as {@link ApprovalCount}'s may start. */\n readonly tenantKnown = signal(false);\n\n /** The caller's tenant, fetched once. */\n readonly tenant$: Observable<Tenant> = this.http.get<Page<Tenant>>(`${this.base}/tenants`).pipe(\n map(page => {\n if (page.items.length === 0) throw new Error('No tenant is authorized for this user.');\n return page.items[0];\n }),\n tap(() => this.tenantKnown.set(true)),\n shareReplay(1),\n );\n\n private get<T>(path: string, query: Query = {}): Observable<T> {\n let params = new HttpParams();\n for (const [key, value] of Object.entries(query)) {\n if (value === null || value === undefined || value === '') continue;\n for (const item of Array.isArray(value) ? value : [value]) params = params.append(key, String(item));\n }\n return this.tenant$.pipe(switchMap(t => this.http.get<T>(`${this.base}/tenants/${t.id}${path}`, { params })));\n }\n\n /** A change. `Idempotency-Key` on what can be retried, so a repeated click or a lost response doesn't do it twice. */\n private send<T>(method: 'POST' | 'PUT' | 'DELETE', path: string, body?: unknown, headers: Record<string, string> = {}): Observable<T> {\n return this.tenant$.pipe(switchMap(t => this.http.request<T>(method, `${this.base}/tenants/${t.id}${path}`, { body, headers })));\n }\n private once<T>(path: string, body: unknown): Observable<T> { return this.send<T>('POST', path, body, { 'Idempotency-Key': idempotencyKey() }); }\n\n /** Every page of a cursor-paged list (bounded: at most `maxPages` requests). */\n private all<T>(path: string, query: Query = {}, maxPages = 25): Observable<Page<T>> {\n let pages = 0;\n return this.get<Page<T>>(path, { ...query, limit: 200 }).pipe(\n expand(page => page.nextCursor && ++pages < maxPages ? this.get<Page<T>>(path, { ...query, limit: 200, cursor: page.nextCursor }) : EMPTY),\n reduce((all, page) => ({ items: [...all.items, ...page.items], nextCursor: page.nextCursor }), { items: [] as T[], nextCursor: null as string | null }),\n );\n }\n\n environments() { return this.get<Page<DeploymentEnvironment>>('/environments'); }\n applications() { return this.get<Page<Application>>('/applications', { limit: 200 }); }\n /** With `retired`, retired services too (the API leaves them out by default). */\n resources(type?: string, retired = false) { return this.all<ResourceSummary>('/resources', { type, retired: retired ? 'true' : null }); }\n /** Forgets a retired service and what discovery and health keep about it (admin). */\n forgetService(id: string) { return this.send<void>('DELETE', `/resources/${id}`); }\n resource(id: string) { return this.get<ResourceDetail>(`/resources/${id}`); }\n health(query: Query) { return this.all<Health>('/health', query); }\n topology(environment?: string | null) { return this.get<Topology>('/topology', { environment }); }\n\n rules() { return this.get<Page<Rule>>('/rules', { limit: 200 }); }\n /** The deployment's signal packs: not a tenant's, so not under it. */\n signalPacks() { return this.http.get<SignalPack[]>(`${this.base}/signal-packs`); }\n createRule(definition: unknown) { return this.send<Rule>('POST', '/rules', definition); }\n /** With the rule's etag, so a change made since it was read isn't overwritten. */\n updateRule(key: string, definition: unknown, etag: string) { return this.send<Rule>('PUT', `/rules/${key}`, definition, { 'If-Match': `\"${etag}\"` }); }\n\n channels() { return this.get<Page<Channel>>('/webhooks'); }\n createChannel(body: unknown) { return this.send<Channel>('POST', '/webhooks', body); }\n updateChannel(id: string, body: unknown) { return this.send<Channel>('PUT', `/webhooks/${id}`, body); }\n deliveries(id: string, query: Query = {}) { return this.get<Page<Delivery>>(`/webhooks/${id}/deliveries`, { limit: 50, ...query }); }\n testChannel(id: string) { return this.send<ChannelTestResult>('POST', `/webhooks/${id}/test`); }\n retryDelivery(channelId: string, deliveryId: string) { return this.send<Delivery>('POST', `/webhooks/${channelId}/deliveries/${deliveryId}/retry`); }\n allowlist() { return this.get<Page<AllowlistEntry>>('/webhooks/allowlist'); }\n putAllowlist(destination: string, ports: number[]) { return this.send<AllowlistEntry>('PUT', '/webhooks/allowlist', { destination, ports }); }\n removeAllowlist(destination: string) { return this.send<void>('DELETE', `/webhooks/allowlist?destination=${encodeURIComponent(destination)}`); }\n\n escalationPolicies() { return this.get<Page<EscalationPolicy>>('/escalation-policies'); }\n createEscalationPolicy(body: unknown) { return this.send<EscalationPolicy>('POST', '/escalation-policies', body); }\n updateEscalationPolicy(key: string, body: unknown) { return this.send<EscalationPolicy>('PUT', `/escalation-policies/${key}`, body); }\n\n silences(query: Query = {}) { return this.get<Page<Silence>>('/silences', { limit: 200, ...query }); }\n createSilence(body: unknown) { return this.once<Silence>('/silences', body); }\n cancelSilence(id: string) { return this.send<void>('DELETE', `/silences/${id}`); }\n\n incidents(query: Query = {}) { return this.get<Page<IncidentSummary>>('/incidents', { limit: 100, ...query }); }\n incident(id: string) { return this.get<IncidentDetail>(`/incidents/${id}`); }\n createIncident(body: unknown) { return this.once<IncidentSummary>('/incidents', body); }\n moveIncident(id: string, to: string, comment: string) { return this.once<IncidentSummary>(`/incidents/${id}/transitions`, { to, comment }); }\n addIncidentNote(id: string, text: string) { return this.once<IncidentEvent>(`/incidents/${id}/notes`, { text }); }\n removeIncidentAlert(id: string, alertId: string) { return this.send<void>('DELETE', `/incidents/${id}/alerts/${alertId}`); }\n /** Active agents, or with `all` the revoked ones too (at most 500). */\n agents(all = false) { return this.get<Page<Agent>>('/agents', { all: all || null }); }\n agent(id: string) { return this.get<Agent>(`/agents/${id}`); }\n createEnrollmentToken(purpose: string, expiresInMinutes: number) { return this.send<EnrollmentToken>('POST', '/agents/enrollment-tokens', { purpose, expiresInMinutes }); }\n revokeAgent(id: string, reason: string) { return this.send<Agent>('POST', `/agents/${id}/revocation`, { reason }); }\n /** What the agent reported it can run, custom actions included, with what its host permits; the built-ins if it never reported. */\n agentActions(id: string) { return this.get<AgentActions>(`/agents/${id}/actions`); }\n agentPackages() { return this.get<Page<AgentPackage>>('/agents/packages'); }\n /** Idempotent: a repeated click or a lost response signs one command, not two. */\n issueCommand(id: string, action: string, parameters: Record<string, unknown>) { return this.once<AgentCommand>(`/agents/${id}/commands`, { action, parameters }); }\n /** Asks for an action under its approval policy: issued at once when nobody else needs to approve, otherwise waiting. */\n requestAction(agentId: string, action: string, parameters: Record<string, unknown>, reason: string, target: ActionTarget | null = null) {\n return this.once<ActionRequest>(`/agents/${agentId}/action-requests`, { action, parameters, reason, target });\n }\n actionRequests(query: Query = {}) { return this.get<Page<ActionRequest>>('/action-requests', { limit: 100, ...query }); }\n /** The platform panel and capacity view (operators and admins of this deployment; a viewer gets 403). Not under a tenant: the platform's own. */\n platformOverview(): Observable<PlatformOverview> { return this.tenant$.pipe(switchMap(() => this.http.get<PlatformOverview>(`${this.base}/platform/overview`))); }\n\n /** A diagnostic bundle's zip (operators and admins; audited). */\n downloadBundle(agentId: string, bundleId: string) {\n return this.tenant$.pipe(switchMap(t => this.http.get(`${this.base}/tenants/${t.id}/agents/${agentId}/bundles/${bundleId}`, { responseType: 'blob', observe: 'response' })));\n }\n /** SLOs, technical or business apart (category), with their budgets and burn rates. */\n slos(category?: string) { return this.get<Page<SloSummary>>('/slos', { category }); }\n slo(key: string) { return this.get<SloDetail>(`/slos/${encodeURIComponent(key)}`); }\n /** How many requests wait, and how many of them the signed-in user can decide. */\n waitingRequests() { return this.get<ActionRequestsWaiting>('/action-requests/waiting'); }\n approveRequest(id: string, comment: string) { return this.send<ActionRequest>('POST', `/action-requests/${id}/approval`, { comment }); }\n rejectRequest(id: string, comment: string) { return this.send<ActionRequest>('POST', `/action-requests/${id}/rejection`, { comment }); }\n cancelRequest(id: string) { return this.send<ActionRequest>('POST', `/action-requests/${id}/cancellation`, {}); }\n agentCommands(id: string, cursor?: string | null) { return this.get<Page<AgentCommand>>(`/agents/${id}/commands`, { limit: 25, cursor }); }\n\n alertNotifications(id: string) { return this.get<AlertNotifications>(`/alerts/${id}/notifications`); }\n\n /** One page of alerts, newest first; pass the previous page's `nextCursor` as `cursor` for the next. */\n alerts(query: Query) { return this.get<Page<Alert>>('/alerts', { limit: 100, ...query }); }\n /** Every alert matching the query (bounded, like the other complete lists). */\n allAlerts(query: Query) { return this.all<Alert>('/alerts', query); }\n alert(id: string) { return this.get<AlertDetail>(`/alerts/${id}`); }\n acknowledge(id: string, comment: string): Observable<Alert> {\n return this.tenant$.pipe(switchMap(t => this.http.post<Alert>(`${this.base}/tenants/${t.id}/alerts/${id}/acknowledgement`,\n { comment }, { headers: { 'Idempotency-Key': idempotencyKey() } })));\n }\n\n traces(query: Query) { return this.get<TelemetryPage<TraceSummary>>('/telemetry/traces', query); }\n trace(traceId: string) { return this.get<Trace>(`/telemetry/traces/${traceId}`); }\n logs(query: Query) { return this.get<TelemetryPage<LogRecord>>('/telemetry/logs', query); }\n operations(query: Query) { return this.get<TelemetryPage<Operation>>('/telemetry/operations', query); }\n metrics(query: Query) { return this.get<TelemetryPage<MetricInfo>>('/telemetry/metrics', query); }\n series(query: Query) { return this.get<Series>('/telemetry/metrics/series', query); }\n serviceStats(query: Query) { return this.get<ServiceStats>('/telemetry/service-stats', query); }\n capacity(query: Query) { return this.get<Capacity>('/telemetry/capacity', query); }\n timeline(query: Query) { return this.get<Timeline>('/timeline', query); }\n relatedToAlert(id: string) { return this.get<Related>(`/alerts/${id}/related`); }\n alertSuggestions(id: string) { return this.get<Suggestions>(`/alerts/${id}/suggestions`); }\n incidentSuggestions(id: string) { return this.get<Suggestions>(`/incidents/${id}/suggestions`); }\n acceptSuggestion(alertId: string, otherId: string) { return this.once<CorrelationDecision>(`/alerts/${alertId}/suggestions/${otherId}/accept`, {}); }\n dismissSuggestion(alertId: string, otherId: string, reason: string) { return this.once<CorrelationDecision>(`/alerts/${alertId}/suggestions/${otherId}/dismiss`, { reason }); }\n loadRuns(query: Query) { return this.get<Page<LoadRun>>('/load-runs', query); }\n loadRunResults(id: string) { return this.get<LoadRunResults>(`/load-runs/${id}/results`); }\n dependencyStats(query: Query) { return this.get<DependencyStatsPage>('/telemetry/dependencies', query); }\n dependency(id: string, query: Query) { return this.get<DependencyEvidence>(`/telemetry/dependencies/${id}`, query); }\n search(q: string) { return this.get<TelemetryPage<SearchHit>>('/search', { q }); }\n}\n","import { DOCUMENT } from '@angular/common';\nimport { DestroyRef, Injectable, effect, inject, signal, untracked } from '@angular/core';\nimport { NavigationEnd, Router } from '@angular/router';\nimport { Subscription, filter, fromEvent, timer, switchMap } from 'rxjs';\nimport { MenuBadgeService } from '@juice-js/layout';\nimport { ApiService } from './api.service';\n\n/**\n * How many action requests wait for the signed-in user to decide, refreshed every 30 seconds from whatever page is open, and at once\n * when a page made or decided one ({@link refresh}). It starts only once a page has fetched the tenant: before that the user may still be\n * signing in, and an early call would fail, along with the page's own call sharing it. It stops on an error (signed out, or no rights)\n * until the next navigation, so a signed-out tab doesn't keep asking. A tab out of sight doesn't ask either; it asks at once on coming back.\n */\n@Injectable({ providedIn: 'root' })\nexport class ApprovalCount {\n static readonly Every = 30_000;\n\n private readonly api = inject(ApiService);\n private readonly document = inject(DOCUMENT);\n private polling: Subscription | null = null;\n /** Requests the signed-in user can approve or reject now. */\n readonly forYou = signal(0);\n\n constructor() {\n effect(() => { if (this.api.tenantKnown() && !untracked(() => this.polling)) untracked(() => this.start()); });\n const navigations = inject(Router).events.pipe(filter(e => e instanceof NavigationEnd))\n .subscribe(() => { if (!this.polling && this.api.tenantKnown()) this.start(); });\n // Back in sight: what waits may have changed meanwhile.\n const shown = fromEvent(this.document, 'visibilitychange').pipe(filter(() => !this.document.hidden))\n .subscribe(() => { if (this.polling) this.start(); });\n inject(DestroyRef).onDestroy(() => { navigations.unsubscribe(); shown.unsubscribe(); this.polling?.unsubscribe(); });\n }\n\n /** Asks again now, for a page that just changed what waits. */\n refresh() { if (this.api.tenantKnown()) this.start(); }\n\n private start() {\n this.polling?.unsubscribe();\n this.polling = timer(0, ApprovalCount.Every).pipe(filter(() => !this.document.hidden), switchMap(() => this.api.waitingRequests())).subscribe({\n next: w => this.forYou.set(w.forYou),\n error: () => { this.forYou.set(0); this.polling = null; },\n });\n }\n}\n\n/** The menu id of the Approvals entry in {@link observabilityMenus}, where {@link ApprovalMenuBadge} shows the count. */\nexport const APPROVALS_MENU_ID = 'approvals';\n\n/**\n * Shows {@link ApprovalCount} on the Approvals entry of juice-layout's side menu (by its menu id, {@link APPROVALS_MENU_ID}). The menu\n * draws it: beside the label, on the icon while folded, and on the header of the closed group it sits in.\n */\n@Injectable({ providedIn: 'root' })\nexport class ApprovalMenuBadge {\n constructor() {\n const count = inject(ApprovalCount), badges = inject(MenuBadgeService);\n effect(() => {\n const n = count.forYou();\n badges.set(APPROVALS_MENU_ID, { count: n, hint: `${n} request${n === 1 ? '' : 's'} waiting for your approval` });\n });\n inject(DestroyRef).onDestroy(() => badges.clear(APPROVALS_MENU_ID));\n }\n}\n","import { EnvironmentProviders, Injectable, InjectionToken, Pipe, PipeTransform, inject, makeEnvironmentProviders, provideEnvironmentInitializer } from '@angular/core';\nimport { ApprovalMenuBadge } from './approval-count';\n\n/** How the host app mounts Juice Observability. */\nexport interface ObservabilityOptions {\n /** The Juice API origin; empty when the API serves the app (same origin). */\n apiBase: string;\n /** Where the host mounts {@link OBSERVABILITY_ROUTES}: `/` for the whole app, or a path such as `/observability`. */\n basePath: string;\n /**\n * A link to the audit records of a trace, shown on the trace page: for the Juice Audit pages mounted at `/audit`,\n * `id => ['/audit/traces', id]`. A string is an external URL. Without it, no link.\n */\n auditLink?: ((traceId: string) => unknown[] | string | null) | null;\n /** Show on the Approvals menu entry how many action requests wait for the signed-in user. On unless false. */\n approvalCount?: boolean;\n}\n\nexport const OBSERVABILITY_OPTIONS = new InjectionToken<ObservabilityOptions>('OBSERVABILITY_OPTIONS', {\n providedIn: 'root',\n factory: () => ({ apiBase: '', basePath: '/', auditLink: null }),\n});\n\n/**\n * Configures the pages: where the API is, where the host mounted the routes, and where a trace's audit records open. Also shows the count\n * of requests waiting for approval on the Approvals menu entry, unless `approvalCount: false`.\n */\nexport function provideJuiceObservability(options: Partial<ObservabilityOptions> = {}): EnvironmentProviders {\n return makeEnvironmentProviders([\n {\n provide: OBSERVABILITY_OPTIONS,\n useValue: {\n apiBase: options.apiBase ?? '',\n basePath: options.basePath ?? '/',\n auditLink: options.auditLink ?? null,\n } satisfies ObservabilityOptions,\n },\n ...(options.approvalCount === false ? [] : [provideEnvironmentInitializer(() => { inject(ApprovalMenuBadge); })]),\n ]);\n}\n\n/** `/observability/` → `/observability`; `` and `/` → `/`. */\nexport function normalizeBasePath(basePath: string): string {\n const trimmed = basePath.trim().replace(/^\\/+|\\/+$/g, '');\n return trimmed ? `/${trimmed}` : '/';\n}\n\n/** Router links to the pages, under the host's mount path. */\n@Injectable({ providedIn: 'root' })\nexport class ObservabilityLinks {\n private readonly options = inject(OBSERVABILITY_OPTIONS);\n readonly base = normalizeBasePath(this.options.basePath);\n\n /** `to('services', id)` → `['/observability', 'services', id]`. */\n to(...segments: unknown[]): unknown[] { return [this.base, ...segments]; }\n\n /** The host's link to the audit records of a trace, if it gave one. */\n audit(traceId: string | null | undefined): { route: unknown[] } | { href: string } | null {\n if (!traceId || !this.options.auditLink) return null;\n const link = this.options.auditLink(traceId);\n if (!link) return null;\n return typeof link === 'string' ? { href: link } : { route: link };\n }\n}\n\n/** `['services', id] | jcLink`: the same as {@link ObservabilityLinks.to} in a template. */\n@Pipe({ name: 'jcLink' })\nexport class LinkPipe implements PipeTransform {\n private readonly links = inject(ObservabilityLinks);\n transform(segments: unknown[]): unknown[] { return this.links.to(...segments); }\n}\n","import { Injectable, computed, inject } from '@angular/core';\nimport { toSignal } from '@angular/core/rxjs-interop';\nimport { ActivatedRoute, NavigationEnd, Params, Router } from '@angular/router';\nimport { filter, map, startWith } from 'rxjs';\n\nexport const RANGES: Record<string, number> = {\n '15m': 15 * 60_000, '1h': 3_600_000, '6h': 6 * 3_600_000, '24h': 24 * 3_600_000, '7d': 7 * 24 * 3_600_000,\n};\n\n/** Search ranges are at most 24 hours (the API's bound); series and operations take up to 7 days. */\nexport const MAX_SEARCH_MS = RANGES['24h'];\n\n/**\n * The investigation context that follows the user between pages (Console requirements §17): environment and time\n * range. It lives in the URL (`env`, and `range` or `from`/`to`), so every page is a deep link and the browser's back\n * button restores it.\n */\n@Injectable({ providedIn: 'root' })\nexport class ContextService {\n private readonly router = inject(Router);\n\n // Created on first use, after the first navigation may already have ended: start from the current URL.\n private readonly params = toSignal(this.router.events.pipe(\n filter(e => e instanceof NavigationEnd),\n startWith(null),\n map(() => this.leaf().snapshot.queryParams),\n ), { initialValue: {} as Params });\n\n readonly environment = computed(() => (this.params()['env'] as string | undefined) ?? '');\n readonly range = computed(() => {\n const p = this.params();\n return p['from'] && p['to'] ? 'custom' : ((p['range'] as string | undefined) ?? '1h');\n });\n readonly absolute = computed(() => {\n const p = this.params();\n return p['from'] && p['to'] ? { from: p['from'] as string, to: p['to'] as string } : null;\n });\n\n /** The window as ISO strings, evaluated now for a relative range. */\n window(maxMs?: number): { from: string; to: string } {\n const absolute = this.absolute();\n if (absolute) return absolute;\n const to = Date.now();\n const span = Math.min(RANGES[this.range()] ?? RANGES['1h'], maxMs ?? Number.MAX_SAFE_INTEGER);\n return { from: new Date(to - span).toISOString(), to: new Date(to).toISOString() };\n }\n\n /** Query parameters for a link: the context plus the target page's own. */\n keep(extra: Params = {}): Params {\n const p = this.params();\n const context: Params = {};\n for (const key of ['env', 'range', 'from', 'to']) if (p[key]) context[key] = p[key];\n return { ...context, ...extra };\n }\n\n /** Changes the context on the current page, keeping its other parameters. */\n set(change: { env?: string | null; range?: string | null; from?: string | null; to?: string | null }) {\n const queryParams: Params = { ...change };\n if (change.range) Object.assign(queryParams, { from: null, to: null });\n void this.router.navigate([], { relativeTo: this.leaf(), queryParams, queryParamsHandling: 'merge' });\n }\n\n /** A time window centred on a moment, for \"around this span\" links. */\n around(at: string, durationMs: number, paddingMs = 5 * 60_000): Params {\n const start = new Date(at).getTime();\n return this.keep({\n from: new Date(start - paddingMs).toISOString(),\n to: new Date(start + durationMs + paddingMs).toISOString(),\n range: null,\n });\n }\n\n private leaf(): ActivatedRoute {\n let route = this.router.routerState.root;\n while (route.firstChild) route = route.firstChild;\n return route;\n }\n}\n","import { Routes } from '@angular/router';\nimport { Menus } from '@juice-js/core';\nimport { APPROVALS_MENU_ID } from './core/approval-count';\nimport { normalizeBasePath } from './core/options';\n\nfunction page(path: string, title: string, load: Routes[number]['loadComponent']): Routes[number] {\n return { path, title: `${title} · Juice Observability`, loadComponent: load };\n}\n\n/**\n * The pages, investigation first (Console requirements §4): services, traces, topology, logs and metrics; alerts and\n * rules after. Detail pages are deep links (§17) and carry the environment and time range in their query parameters.\n * The host mounts them at its `basePath` (see {@link provideJuiceObservability}) and adds its own guards.\n */\nexport const OBSERVABILITY_ROUTES: Routes = [\n page('', 'Overview', () => import('./pages/overview.page').then(m => m.OverviewPage)),\n page('services', 'Services', () => import('./pages/services.page').then(m => m.ServicesPage)),\n page('services/:id', 'Service', () => import('./pages/service.page').then(m => m.ServicePage)),\n page('traces', 'Traces', () => import('./pages/traces.page').then(m => m.TracesPage)),\n page('traces/:traceId', 'Trace', () => import('./pages/trace.page').then(m => m.TracePage)),\n page('topology', 'Dependencies', () => import('./pages/topology.page').then(m => m.TopologyPage)),\n page('logs', 'Logs', () => import('./pages/logs.page').then(m => m.LogsPage)),\n page('metrics', 'Metrics', () => import('./pages/metrics.page').then(m => m.MetricsPage)),\n page('resources', 'Resources', () => import('./pages/resources.page').then(m => m.ResourcesPage)),\n page('resources/:id', 'Resource', () => import('./pages/resource.page').then(m => m.ResourcePage)),\n page('alerts', 'Alerts', () => import('./pages/alerts.page').then(m => m.AlertsPage)),\n page('alerts/:id', 'Alert', () => import('./pages/alert.page').then(m => m.AlertPage)),\n page('rules', 'Rules', () => import('./pages/rules.page').then(m => m.RulesPage)),\n page('notifications', 'Notifications', () => import('./pages/notifications.page').then(m => m.NotificationsPage)),\n page('silences', 'Silences', () => import('./pages/silences.page').then(m => m.SilencesPage)),\n page('incidents', 'Incidents', () => import('./pages/incidents.page').then(m => m.IncidentsPage)),\n page('incidents/:id', 'Incident', () => import('./pages/incident.page').then(m => m.IncidentPage)),\n page('agents', 'Agents', () => import('./pages/agents.page').then(m => m.AgentsPage)),\n page('agents/:id', 'Agent', () => import('./pages/agent.page').then(m => m.AgentPage)),\n page('approvals', 'Approvals', () => import('./pages/approvals.page').then(m => m.ApprovalsPage)),\n page('slos', 'SLOs', () => import('./pages/slos.page').then(m => m.SlosPage)),\n page('slos/:key', 'SLO', () => import('./pages/slo.page').then(m => m.SloPage)),\n page('timeline', 'Timeline', () => import('./pages/timeline.page').then(m => m.TimelinePage)),\n page('load-runs', 'Load runs', () => import('./pages/load-runs.page').then(m => m.LoadRunsPage)),\n];\n\n/**\n * The side menu entries (juice-layout), linking under `basePath`. The pages an investigation starts from sit at the top\n * with a `shortcut` for the shell's go-to keys; the rest are grouped (Explore, Automation, Configure).\n *\n * A group links to its first page and keeps its pages' own links (`replaceChildRouterLink: false`): juice-layout only\n * opens and closes the group on a click (it has no page of its own).\n * Group ids carry an `observability-` prefix, as the host's menu sits beside them.\n */\nexport function observabilityMenus(basePath = '/', order = 1): Menus {\n const base = normalizeBasePath(basePath);\n const link = (path: string) => (base === '/' ? `/${path}` : path ? `${base}/${path}` : base);\n const group = (id: string, label: string, icon: string, children: Menus): Menus[number] =>\n ({ id, label, icon, routerLink: children[0].routerLink, replaceChildRouterLink: false, children });\n const menus: Menus = [\n { id: 'overview', label: 'Overview', icon: 'dashboard', routerLink: link(''), shortcut: 'g o' },\n { id: 'services', label: 'Services', icon: 'hub', routerLink: link('services'), shortcut: 'g s' },\n { id: 'traces', label: 'Traces', icon: 'timeline', routerLink: link('traces'), shortcut: 'g t' },\n { id: 'logs', label: 'Logs', icon: 'notes', routerLink: link('logs'), shortcut: 'g l' },\n { id: 'metrics', label: 'Metrics', icon: 'show_chart', routerLink: link('metrics'), shortcut: 'g m' },\n { id: 'alerts', label: 'Alerts', icon: 'notifications', routerLink: link('alerts'), shortcut: 'g a' },\n { id: 'incidents', label: 'Incidents', icon: 'emergency', routerLink: link('incidents'), shortcut: 'g i' },\n group('observability-explore', 'Explore', 'explore', [\n { id: 'topology', label: 'Dependencies', icon: 'account_tree', routerLink: link('topology') },\n { id: 'resources', label: 'Resources', icon: 'dns', routerLink: link('resources') },\n { id: 'slos', label: 'SLOs', icon: 'track_changes', routerLink: link('slos') },\n { id: 'timeline', label: 'Timeline', icon: 'history', routerLink: link('timeline') },\n { id: 'load-runs', label: 'Load runs', icon: 'speed', routerLink: link('load-runs') },\n ]),\n group('observability-automation', 'Automation', 'precision_manufacturing', [\n { id: 'agents', label: 'Agents', icon: 'smart_toy', routerLink: link('agents') },\n { id: APPROVALS_MENU_ID, label: 'Approvals', icon: 'approval', routerLink: link('approvals') },\n ]),\n group('observability-configure', 'Configure', 'tune', [\n { id: 'rules', label: 'Rules', icon: 'rule', routerLink: link('rules') },\n { id: 'silences', label: 'Silences', icon: 'notifications_paused', routerLink: link('silences') },\n { id: 'notifications', label: 'Notifications', icon: 'campaign', routerLink: link('notifications') },\n ]),\n ];\n return menus.map((menu, index) => ({ ...menu, order: order + index }));\n}\n"],"mappings":";;;;;;;;AAcA,SAAgB,iBAAc;CAC5B,MAAM,IAAI,OAAO,gCAAgB,IAAI,WAAW,EAAE,CAAC;CACnD,EAAE,KAAM,EAAE,KAAK,KAAQ;CACvB,EAAE,KAAM,EAAE,KAAK,KAAQ;CACvB,MAAM,MAAM,MAAM,KAAK,IAAG,MAAK,EAAE,SAAS,EAAE,CAAC,CAAC,SAAS,GAAG,GAAG,CAAC,CAAC,CAAC,KAAK,EAAE;CACvE,OAAO,GAAG,IAAI,MAAM,GAAG,CAAC,EAAC,GAAI,IAAI,MAAM,GAAG,EAAE,EAAC,GAAI,IAAI,MAAM,IAAI,EAAE,EAAC,GAAI,IAAI,MAAM,IAAI,EAAE,EAAC,GAAI,IAAI,MAAM,EAAE;AACzG;AASA,IAAa,aAAb,MA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K,eAAe;GAAC;EACnG,CAAA;CAEI,CAAA,CAAM,KAAK,MAAM,WAAW;EAAE,GAAG;EAAM,OAAO,QAAQ;CAAK,EAAG;AACvE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juice-js/observability",
3
- "version": "1.4.0",
3
+ "version": "1.5.0-alpha.45",
4
4
  "description": "Juice Observability pages (services, traces, topology, logs, metrics, resources, alerts, rules) for an Angular app on juice-layout",
5
5
  "author": "jack@creatorflow.io",
6
6
  "license": "MIT",
@@ -70,14 +70,17 @@ export interface DeploymentEnvironment {
70
70
  firstSeen: string;
71
71
  lastSeen: string;
72
72
  }
73
+ /** `services`: in use; `retiredServices`: retired after Discovery:ServiceRetireAfter without telemetry. */
73
74
  export interface Application {
74
75
  id: string;
75
76
  key: string;
76
77
  displayName: string;
77
78
  services: number;
79
+ retiredServices: number;
78
80
  firstSeen: string;
79
81
  lastSeen: string;
80
82
  }
83
+ /** `retiredAt`: when discovery retired the service (null in use, and for infrastructure). `signalPacks`: the signal packs a service has been seen sending. */
81
84
  export interface ResourceSummary {
82
85
  id: string;
83
86
  type: string;
@@ -85,6 +88,8 @@ export interface ResourceSummary {
85
88
  displayName: string;
86
89
  firstSeen: string;
87
90
  lastSeen: string;
91
+ retiredAt: string | null;
92
+ signalPacks: string[] | null;
88
93
  }
89
94
  export type HealthState = 'Healthy' | 'Degraded' | 'Unhealthy' | 'Critical' | 'Offline' | 'Unknown';
90
95
  export interface Health {
@@ -134,6 +139,8 @@ export interface ResourceDetail {
134
139
  instancesTruncated: boolean;
135
140
  health: Health[];
136
141
  links: IntegrationLink[];
142
+ retiredAt: string | null;
143
+ signalPacks: string[] | null;
137
144
  }
138
145
  export interface TopologyNode {
139
146
  id: string;
@@ -191,6 +198,17 @@ export interface AlertDetail {
191
198
  subjectHealth: Health[];
192
199
  links: IntegrationLink[];
193
200
  }
201
+ /** A signal pack the deployment reads (`GET /api/v1/signal-packs`): telemetry only services built on one framework send. */
202
+ export interface SignalPack {
203
+ name: string;
204
+ version: number;
205
+ enabled: boolean;
206
+ ruleTemplates: string[];
207
+ features: string[];
208
+ metrics: string[];
209
+ attributes: string[];
210
+ scopes: string[];
211
+ }
194
212
  export interface Rule {
195
213
  key: string;
196
214
  name: string;
@@ -201,6 +219,8 @@ export interface Rule {
201
219
  loadedAt: string;
202
220
  managedBy: string;
203
221
  etag: string;
222
+ /** Why the rule can never observe the service it names: it reads a signal pack the service has never sent. */
223
+ quiet?: string | null;
204
224
  }
205
225
  export interface Channel {
206
226
  id: string;
@@ -975,11 +995,16 @@ export declare class ApiService {
975
995
  private all;
976
996
  environments(): Observable<Page<DeploymentEnvironment>>;
977
997
  applications(): Observable<Page<Application>>;
978
- resources(type?: string): Observable<Page<ResourceSummary>>;
998
+ /** With `retired`, retired services too (the API leaves them out by default). */
999
+ resources(type?: string, retired?: boolean): Observable<Page<ResourceSummary>>;
1000
+ /** Forgets a retired service and what discovery and health keep about it (admin). */
1001
+ forgetService(id: string): Observable<void>;
979
1002
  resource(id: string): Observable<ResourceDetail>;
980
1003
  health(query: Query): Observable<Page<Health>>;
981
1004
  topology(environment?: string | null): Observable<Topology>;
982
1005
  rules(): Observable<Page<Rule>>;
1006
+ /** The deployment's signal packs: not a tenant's, so not under it. */
1007
+ signalPacks(): Observable<SignalPack[]>;
983
1008
  createRule(definition: unknown): Observable<Rule>;
984
1009
  /** With the rule's etag, so a change made since it was read isn't overwritten. */
985
1010
  updateRule(key: string, definition: unknown, etag: string): Observable<Rule>;
@@ -1 +0,0 @@
1
- {"version":3,"file":"juice-js-observability-rules.page-AbY-0A8n.mjs","names":[],"sources":["../../../../projects/juice-js/observability/src/lib/pages/rules.page.ts"],"sourcesContent":["import { LinkPipe } from '../core/options';\nimport { ChangeDetectionStrategy, Component, computed, inject, signal } from '@angular/core';\nimport { FormsModule } from '@angular/forms';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatCheckboxModule } from '@angular/material/checkbox';\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 { apiResource } from '../shared/resource';\nimport { RouterLink } from '@angular/router';\nimport { Observable, forkJoin, map } from 'rxjs';\nimport { ApiService } from '../core/api.service';\nimport { ContextService } from '../core/context.service';\nimport { Rule } from '../core/models';\nimport { AgoPipe } from '../shared/format';\nimport { ContextBar } from '../shared/ui';\nimport { problemText } from '../shared/telemetry';\n\nconst TEMPLATES: Record<string, string> = {\n ErrorRate: 'Ratio of failed requests, 0 to 1. Fires above the threshold.',\n LatencyP95: 'Milliseconds at the 95th percentile. Fires above the threshold.',\n ThroughputAbsent: 'Requests in the window, for a service that had traffic. Fires at or below the threshold.',\n DeliveryFailureRate: 'Ratio of failed deliveries, 0 to 1. Fires above the threshold.',\n HostMemory: 'Ratio of host memory used, 0 to 1. Fires above the threshold.',\n MediatorErrors: 'Mediator errors in the window. Fires above the threshold.',\n ConsumerFailures: 'Failed consumer messages in the window. Fires above the threshold.',\n SloBurn: \"An SLO's burn rate over a long and a short window. Fires when both reach the rate; one alert per SLO.\",\n};\n\n/** A TimeSpan as the API writes it (`1.02:03:04`) in seconds. */\nfunction seconds(value: unknown): number {\n const match = /^(?:(\\d+)\\.)?(\\d+):(\\d+):(\\d+)/.exec(String(value ?? ''));\n return match ? (+(match[1] ?? 0)) * 86400 + +match[2] * 3600 + +match[3] * 60 + +match[4] : 0;\n}\n\nfunction span(total: number): string {\n const s = Math.max(0, Math.round(total || 0));\n const pad = (n: number) => String(n).padStart(2, '0');\n const days = Math.floor(s / 86400);\n return `${days ? `${days}.` : ''}${pad(Math.floor(s / 3600) % 24)}:${pad(Math.floor(s / 60) % 60)}:${pad(s % 60)}`;\n}\n\ninterface RuleForm {\n key: string; name: string; template: string; severity: string; service: string; environment: string; host: string; threshold: number | null; recoveryThreshold: number | null;\n minimumSamples: number; scheduleSeconds: number; windowSeconds: number; forSeconds: number; recoverySeconds: number; cooldownSeconds: number; enabled: boolean;\n}\n\nconst NEW_RULE: RuleForm = {\n key: '', name: '', template: 'ErrorRate', severity: 'Warning', service: '', environment: '', host: '', threshold: null, recoveryThreshold: null,\n minimumSamples: 10, scheduleSeconds: 60, windowSeconds: 300, forSeconds: 120, recoverySeconds: 120, cooldownSeconds: 600, enabled: true,\n};\n\n/**\n * Rules and their current state (Console requirements §14), and changing them for admins. They stay typed templates (D5): this page never takes a query.\n * A rule in the deployment's file is shown but changed there. Disabling one, or changing what it watches, closes its open alerts, which the form says first.\n */\n@Component({\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [LinkPipe, RouterLink, FormsModule, MatButtonModule, MatCheckboxModule, MatFormFieldModule, MatInputModule, MatProgressBarModule, MatSelectModule, ContextBar, AgoPipe],\n template: `\n <jc-context-bar>\n <h1>Rules</h1>\n <span class=\"jc-spacer\"></span>\n <button mat-flat-button type=\"button\" data-testid=\"rule-new\" (click)=\"startNew()\">New rule</button>\n </jc-context-bar>\n @if (data.isLoading()) { <mat-progress-bar mode=\"indeterminate\" /> }\n @if (data.error()) { <p class=\"jc-error\">{{ error() }}</p> }\n @if (form(); as f) {\n <section class=\"jc-card\" data-testid=\"rule-form\">\n <h2>{{ editing() ? 'Change ' + editing()!.key : 'New rule' }}</h2>\n <form class=\"jc-form\" (ngSubmit)=\"save(f)\">\n @if (!editing()) { <mat-form-field subscriptSizing=\"dynamic\"><mat-label>Key</mat-label><input matInput name=\"key\" [(ngModel)]=\"f.key\" required></mat-form-field> }\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-wide\"><mat-label>Name</mat-label><input matInput name=\"name\" [(ngModel)]=\"f.name\" required></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\"><mat-label>Template</mat-label>\n <mat-select name=\"template\" [(ngModel)]=\"f.template\">@for (t of templates; track t) { <mat-option [value]=\"t\">{{ t }}</mat-option> }</mat-select>\n </mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-sm\"><mat-label>Severity</mat-label>\n <mat-select name=\"severity\" [(ngModel)]=\"f.severity\"><mat-option value=\"Info\">Info</mat-option><mat-option value=\"Warning\">Warning</mat-option><mat-option value=\"Critical\">Critical</mat-option></mat-select>\n </mat-form-field>\n @if (f.template === 'HostMemory') {\n <mat-form-field subscriptSizing=\"dynamic\"><mat-label>Host (all if empty)</mat-label><input matInput name=\"host\" [(ngModel)]=\"f.host\"></mat-form-field>\n } @else {\n <mat-form-field subscriptSizing=\"dynamic\"><mat-label>Service (all if empty)</mat-label><input matInput name=\"service\" [(ngModel)]=\"f.service\"></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\"><mat-label>Environment (all if empty)</mat-label><input matInput name=\"environment\" [(ngModel)]=\"f.environment\"></mat-form-field>\n }\n <p class=\"jc-muted jc-small jc-form-actions\">{{ hint(f.template) }}</p>\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-sm\"><mat-label>Threshold</mat-label><input matInput type=\"number\" step=\"any\" name=\"threshold\" [(ngModel)]=\"f.threshold\" required></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-sm\"><mat-label>Recovery threshold</mat-label><input matInput type=\"number\" step=\"any\" name=\"recoveryThreshold\" [(ngModel)]=\"f.recoveryThreshold\"></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-sm\"><mat-label>Minimum samples</mat-label><input matInput type=\"number\" name=\"minimumSamples\" [(ngModel)]=\"f.minimumSamples\"></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-sm\"><mat-label>Every (s)</mat-label><input matInput type=\"number\" name=\"schedule\" [(ngModel)]=\"f.scheduleSeconds\"></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-sm\"><mat-label>Window (s)</mat-label><input matInput type=\"number\" name=\"window\" [(ngModel)]=\"f.windowSeconds\"></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-sm\"><mat-label>Fire after (s)</mat-label><input matInput type=\"number\" name=\"for\" [(ngModel)]=\"f.forSeconds\"></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-sm\"><mat-label>Recover after (s)</mat-label><input matInput type=\"number\" name=\"recovery\" [(ngModel)]=\"f.recoverySeconds\"></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-sm\"><mat-label>Cooldown (s)</mat-label><input matInput type=\"number\" name=\"cooldown\" [(ngModel)]=\"f.cooldownSeconds\"></mat-form-field>\n <mat-checkbox name=\"enabled\" [(ngModel)]=\"f.enabled\">Enabled</mat-checkbox>\n @if (editing()) { <p class=\"jc-muted jc-small jc-form-actions\">Disabling this rule, or changing its template or scope, resolves its open alerts: nothing would be watching them any more.</p> }\n <div class=\"jc-form-actions\">\n <button mat-flat-button type=\"submit\" data-testid=\"rule-save\" [disabled]=\"saving()\">Save</button>\n <button mat-button type=\"button\" (click)=\"form.set(null)\">Cancel</button>\n @if (saveError()) { <span class=\"jc-error\" data-testid=\"rule-error\">{{ saveError() }}</span> }\n </div>\n </form>\n </section>\n }\n <table class=\"jc-table\" data-testid=\"rules\">\n <thead><tr><th>Rule</th><th>Template</th><th>Severity</th><th>Threshold</th><th>Recovery</th><th>Wait</th><th>Open alerts</th><th>Last evaluation</th><th></th></tr></thead>\n <tbody>\n @for (r of rows(); track r.key) {\n <tr [class.jc-muted]=\"!r.enabled\">\n <td><strong>{{ r.name }}</strong><div class=\"jc-muted jc-small\">{{ r.key }}@if (!r.enabled) { · disabled }@if (r.managedBy === 'config') { · from the rules file }@if (r.managedBy === 'platform') { · the platform's, for SLOs }</div></td>\n <td>{{ r.template }}</td>\n <td>{{ r.severity }}</td>\n <td>{{ r.definition['threshold'] ?? '—' }}</td>\n <td>{{ r.definition['recoveryThreshold'] ?? '—' }}</td>\n <td>{{ r.definition['forDuration'] ?? '—' }}</td>\n <td>\n @for (a of r.open; track a.id) {\n <div><a [routerLink]=\"['alerts', a.id] | jcLink\" [queryParams]=\"ctx.keep()\">{{ a.state }}</a> {{ a.subjectKey }} = {{ a.lastValue ?? 'no data' }}</div>\n } @empty { <span class=\"jc-muted\">none</span> }\n </td>\n <td>{{ r.lastEvaluatedAt | ago }}</td>\n <td class=\"jc-row-actions\">@if (r.managedBy === 'api') { <button mat-button type=\"button\" [attr.data-testid]=\"'rule-edit-' + r.key\" (click)=\"edit(r)\">Change</button> }</td>\n </tr>\n }\n </tbody>\n </table>`,\n})\nexport class RulesPage {\n protected readonly ctx = inject(ContextService);\n private readonly api = inject(ApiService);\n /** What a rule can be made from: SloBurn is described, but its rules are the platform's own, made for SLOs. */\n protected readonly templates = Object.keys(TEMPLATES).filter(t => t !== 'SloBurn');\n protected readonly form = signal<RuleForm | null>(null);\n protected readonly editing = signal<Rule | null>(null);\n protected readonly saving = signal(false);\n protected readonly saveError = signal('');\n protected readonly data = apiResource({\n stream: () => forkJoin({\n rules: this.api.rules().pipe(map(p => p.items)),\n firing: this.api.allAlerts({ state: 'firing' }).pipe(map(p => p.items)),\n pending: this.api.allAlerts({ state: 'pending' }).pipe(map(p => p.items)),\n }),\n });\n protected readonly error = computed(() => problemText(this.data.error()));\n protected readonly rows = computed(() => {\n const d = this.data.value();\n if (!d) return [];\n const open = [...d.firing, ...d.pending];\n return d.rules.map(r => {\n const mine = open.filter(a => a.rule === r.key);\n const last = mine.map(a => a.lastEvaluatedAt).sort().at(-1) ?? null;\n return { ...r, open: mine, lastEvaluatedAt: last };\n });\n });\n\n protected hint(template: string): string { return TEMPLATES[template] ?? ''; }\n\n protected startNew() { this.editing.set(null); this.saveError.set(''); this.form.set({ ...NEW_RULE }); }\n\n protected edit(rule: Rule) {\n const d = rule.definition;\n this.editing.set(rule);\n this.saveError.set('');\n this.form.set({\n key: rule.key, name: rule.name, template: rule.template, severity: rule.severity, service: String(d['service'] ?? ''), environment: String(d['environment'] ?? ''), host: String(d['host'] ?? ''),\n threshold: d['threshold'] as number, recoveryThreshold: (d['recoveryThreshold'] as number | null) ?? null, minimumSamples: d['minimumSamples'] as number, scheduleSeconds: seconds(d['schedule']), windowSeconds: seconds(d['window']),\n forSeconds: seconds(d['forDuration']), recoverySeconds: seconds(d['recoveryDuration']), cooldownSeconds: seconds(d['cooldown']), enabled: rule.enabled,\n });\n }\n\n protected save(f: RuleForm) {\n const host = f.template === 'HostMemory';\n const body = {\n key: f.key, name: f.name, template: f.template, severity: f.severity, service: host ? '' : f.service.trim(), environment: host ? '' : f.environment.trim().toLowerCase(), host: host ? f.host.trim() : '',\n threshold: f.threshold, recoveryThreshold: f.recoveryThreshold, minimumSamples: f.minimumSamples, schedule: span(f.scheduleSeconds), window: span(f.windowSeconds), forDuration: span(f.forSeconds),\n recoveryDuration: span(f.recoverySeconds), cooldown: span(f.cooldownSeconds), enabled: f.enabled,\n };\n const editing = this.editing();\n const request: Observable<Rule> = editing ? this.api.updateRule(editing.key, body, editing.etag) : this.api.createRule(body);\n this.saving.set(true);\n this.saveError.set('');\n request.subscribe({\n next: () => { this.saving.set(false); this.form.set(null); this.data.reload(); },\n error: e => { this.saving.set(false); this.saveError.set(problemText(e)); },\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAmBA,MAAM,YAAoC;CACxC,WAAW;CACX,YAAY;CACZ,kBAAkB;CAClB,qBAAqB;CACrB,YAAY;CACZ,gBAAgB;CAChB,kBAAkB;CAClB,SAAS;AACV;AAGD,SAAS,QAAQ,OAAc;CAC7B,MAAM,QAAQ,iCAAiC,KAAK,OAAO,SAAS,EAAE,CAAC;CACvE,OAAO,QAAS,EAAE,MAAM,MAAM,KAAM,QAAQ,CAAC,MAAM,KAAK,OAAO,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM,KAAK;AAC9F;AAEA,SAAS,KAAK,OAAa;CACzB,MAAM,IAAI,KAAK,IAAI,GAAG,KAAK,MAAM,SAAS,CAAC,CAAC;CAC5C,MAAM,OAAO,MAAc,OAAO,CAAC,CAA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AA;IAAA,QAAA;KAAA;KAAA;KAAA;IAAA;IAAA,SAAA,CAAA,mBAAA;IAAA,UAAA,CAAA,WAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAE;IAAU,UAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAA5J;IAAQ,MAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAsJ;IAAO,MAAA;GAAA;EAAA;EAAA,iBAAA,GAAA,wBAAA;CAAA,CAAA;;AAqEpK,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAS,YAAA,CAAA;EAvErB,MAAA;EAAU,MAAA,CAAA;GACT,iBAAiB,wBAAwB;GACzC,SAAS;IAAC;IAAU;IAAY;IAAa;IAAiB;IAAmB;IAAoB;IAAgB;IAAsB;IAAiB;IAAY;GAAO;GAC/K,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmEX,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"juice-js-observability-service.page-BAUPza0x.mjs","names":["i1","i3","i2"],"sources":["../../../../projects/juice-js/observability/src/lib/shared/capacity.ts","../../../../projects/juice-js/observability/src/lib/pages/service.page.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, computed, inject, input, linkedSignal, signal } from '@angular/core';\nimport { FormsModule } from '@angular/forms';\nimport { MatFormFieldModule } from '@angular/material/form-field';\nimport { MatInputModule } from '@angular/material/input';\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 { LinkPipe } from '../core/options';\nimport { Capacity } from '../core/models';\nimport { apiResource } from './resource';\nimport { problemText } from './telemetry';\n\nexport interface CapacityInputs {\n users: number;\n /** Seconds between one user's actions. */\n thinkSeconds: number;\n /** Requests or messages one user action causes in this service. */\n perAction: number;\n /** The CPU use to stay under, from 0 to 1. */\n targetCpu: number;\n coresPerInstance: number;\n}\n\nexport interface CapacityPlan {\n perSecond: number;\n instances: number;\n cores: number;\n /** Per instance; null without memory data. */\n memoryBytes: number | null;\n /** The load each instance would carry. */\n perInstance: number;\n /** That load over the highest measured: above 1 is beyond what was measured. */\n beyondMeasured: number | null;\n /** What set the number of instances: CPU, or a consumer that was already busy all the time. */\n limitedBy: 'cpu' | 'messages';\n}\n\n/**\n * The calculator: `null` when the inputs or the measurements can't give an answer, such as a target that idle CPU alone\n * already exceeds. Each instance can carry (target × cores − idle) ÷ CPU per unit, unless a consumer was seen busy all the\n * time: more CPU doesn't help one that handles a message at a time, so an instance carries only the rate it reached.\n */\nexport function planCapacity(m: Capacity, i: CapacityInputs): CapacityPlan | null {\n if (!m.cpuSecondsPerUnit || m.cpuSecondsPerUnit <= 0) return null;\n if (!(i.users > 0 && i.perAction > 0 && i.targetCpu > 0 && i.targetCpu <= 1 && i.coresPerInstance > 0 && i.thinkSeconds >= 0)) return null;\n const response = (m.responseMs ?? 0) / 1000;\n if (i.thinkSeconds + response <= 0) return null;\n\n const byCpu = (i.targetCpu * i.coresPerInstance - (m.idleCores ?? 0)) / m.cpuSecondsPerUnit;\n if (byCpu <= 0) return null;\n const limitedBy = consumerBusy(m) && m.peakMessagesPerSecond < byCpu ? 'messages' : 'cpu';\n const carried = limitedBy === 'messages' ? m.peakMessagesPerSecond : byCpu;\n const perSecond = i.users * i.perAction / (i.thinkSeconds + response);\n const instances = Math.max(1, Math.ceil(perSecond / carried));\n const perInstance = perSecond / instances;\n const memoryBytes = m.memoryModel === 'fitted'\n ? m.idleMemoryBytes! + m.memoryBytesPerInFlight! * perInstance * response\n : m.peakMemoryBytes;\n // A consumer held back by message handling never used its cores: count what it used, at the target, not the machine's.\n const coresEach = limitedBy === 'messages' && m.peakCores !== null\n ? Math.min(i.coresPerInstance, Math.ceil(m.peakCores / i.targetCpu))\n : i.coresPerInstance;\n return {\n perSecond, instances, cores: instances * coresEach, memoryBytes, perInstance,\n beyondMeasured: m.peakPerSecond > 0 ? perInstance / m.peakPerSecond : null,\n limitedBy,\n };\n}\n\n/** A consumer counts as busy all the time from this much message processing per second of time. */\nconst BUSY_CONSUMER = 0.9;\nfunction consumerBusy(m: Capacity): boolean { return m.peakMessagesInFlight >= BUSY_CONSUMER && m.peakMessagesPerSecond > 0; }\n\n/** A thread pool queue of a few items comes and goes on a healthy host; from this many, work was really waiting. */\nconst NOTABLE_QUEUE = 10;\n\n/** Response time counts as rising with load from this ratio between the busiest and quietest samples. */\nconst RISING_RESPONSE = 1.5;\n\nfunction bytes(value: number | null): string {\n if (value === null) return '—';\n return value >= 1024 ** 3 ? `${(value / 1024 ** 3).toFixed(1)} GB` : `${Math.round(value / 1024 ** 2)} MB`;\n}\nfunction rate(value: number): string { return value >= 10 ? value.toFixed(0) : value.toFixed(2); }\n\n/**\n * A service's Capacity tab: what it was measured to need in the selected window, and a calculator from users to instances,\n * cores and memory. The estimate says where it comes from and where it stops holding: scaling isn't linear, and the\n * service's own databases and brokers are not in it.\n */\n@Component({\n selector: 'jc-service-capacity',\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [FormsModule, MatFormFieldModule, MatInputModule, MatProgressBarModule, RouterLink, LinkPipe],\n template: `\n @if (capacity.isLoading()) { <mat-progress-bar mode=\"indeterminate\" /> }\n @if (capacity.error()) { <p class=\"jc-error\">{{ error() }}</p> }\n @if (mixedEnvironments()) {\n <p class=\"jc-notice\">This service runs in more than one environment, and their hardware may differ. Choose an environment for an estimate that means something.</p>\n }\n @if (capacity.value(); as m) {\n @if (m.samples === 0) {\n <p class=\"jc-muted\">No telemetry from this service in this window.</p>\n } @else {\n <section class=\"jc-card\" aria-labelledby=\"jc-capacity-estimate\">\n <h3 id=\"jc-capacity-estimate\">Estimate</h3>\n <div class=\"jc-capacity-inputs\">\n <mat-form-field subscriptSizing=\"dynamic\"><mat-label>Concurrent users</mat-label>\n <input matInput type=\"number\" min=\"1\" name=\"users\" [ngModel]=\"users()\" (ngModelChange)=\"users.set($event)\" /></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\"><mat-label>Seconds between actions</mat-label>\n <input matInput type=\"number\" min=\"0\" name=\"thinkSeconds\" [ngModel]=\"thinkSeconds()\" (ngModelChange)=\"thinkSeconds.set($event)\" /></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\"><mat-label>Requests per action</mat-label>\n <input matInput type=\"number\" min=\"0\" name=\"perAction\" [ngModel]=\"perAction()\" (ngModelChange)=\"perAction.set($event)\" /></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\"><mat-label>Target CPU use (%)</mat-label>\n <input matInput type=\"number\" min=\"1\" max=\"100\" name=\"targetCpu\" [ngModel]=\"targetCpu()\" (ngModelChange)=\"targetCpu.set($event)\" /></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\"><mat-label>Cores per instance</mat-label>\n <input matInput type=\"number\" min=\"1\" name=\"coresPerInstance\" [ngModel]=\"coresPerInstance()\" (ngModelChange)=\"coresPerInstance.set($event)\" /></mat-form-field>\n </div>\n @if (plan(); as p) {\n <div class=\"jc-capacity-result\" data-testid=\"capacity-plan\">\n <div><strong>{{ p.instances }}</strong><span class=\"jc-muted\">instance{{ p.instances === 1 ? '' : 's' }}</span></div>\n <div><strong>{{ p.cores }}</strong><span class=\"jc-muted\">cores in total</span></div>\n <div><strong>{{ memory(p.memoryBytes) }}</strong><span class=\"jc-muted\">memory per instance{{ m.memoryModel === 'peak' ? ' (highest seen)' : '' }}</span></div>\n <div><strong>{{ perSecond(p.perSecond) }}</strong><span class=\"jc-muted\">requests and messages/s</span></div>\n </div>\n @if (p.beyondMeasured !== null && p.beyondMeasured > 1) {\n <p class=\"jc-notice\" data-testid=\"capacity-beyond\">Each instance would carry {{ perSecond(p.perInstance) }}/s, {{ p.beyondMeasured.toFixed(1) }}× the highest measured ({{ perSecond(m.peakPerSecond) }}/s). This is an extrapolation, and only a load test can confirm it.</p>\n }\n } @else if (m.cpuModel === 'none') {\n <p class=\"jc-notice\">No CPU data, so no estimate. CPU needs two readings at least a minute apart: choose a longer window, or wait. If it stays empty, add <code>AddMeter(\"System.Runtime\")</code> to the host's metrics (.NET 9+).</p>\n } @else {\n <p class=\"jc-notice\">No estimate for these values. Check them: idle CPU alone may already exceed the target.</p>\n }\n <ul class=\"jc-capacity-notes\">\n @if (responseRising(); as r) {\n <li class=\"jc-bad\">Response time already rises with load: {{ r.low }} ms when quiet, {{ r.high }} ms when busy. Something may be near its limit, so the real capacity may be lower.</li>\n }\n @if (busyConsumer()) {\n <li class=\"jc-bad\" data-testid=\"capacity-busy-consumer\">Message processing was busy nearly all the time, at about {{ perSecond(m.peakMessagesPerSecond) }} messages/s per instance. If it handles one message at a time, that is its limit whatever CPU says, and its queue may be growing. The estimate uses that rate, but a saturated consumer's rate can fall, so it may not hold. See which step takes the time in a trace.</li>\n }\n @if (m.outbox?.fallingBehind) {\n <li class=\"jc-bad\" data-testid=\"capacity-outbox-behind\">Outbox delivery is falling behind: {{ count(m.outbox!.undelivered) }} messages created in this window weren't delivered. CPU and requests can look healthy while this grows, and the estimate doesn't include it. If another service delivers this outbox, this doesn't apply.</li>\n }\n @if (m.peakQueue !== null && m.peakQueue >= notableQueue) {\n <li class=\"jc-bad\">The thread pool queue reached {{ m.peakQueue }}: work was waiting for a thread.</li>\n }\n @if (m.cpuModel === 'average') {\n <li data-testid=\"capacity-load-hint\">Load didn't vary enough here to separate idle CPU from the cost of each request, so this is rough. A <a [routerLink]=\"['load-runs'] | jcLink\" [queryParams]=\"ctx.keep()\">load test</a> gives a better estimate.</li>\n }\n <li>Assumes cost grows in a straight line with load. A database, lock or connection limit can be reached long before CPU runs out.</li>\n <li>Covers this service only, not its databases, brokers or the services it calls.</li>\n </ul>\n </section>\n\n <section class=\"jc-card\" aria-labelledby=\"jc-capacity-measured\">\n <h3 id=\"jc-capacity-measured\">Measured in this window</h3>\n <table class=\"jc-table jc-capacity-measured\">\n <tbody>\n <tr><th>CPU per request or message</th>\n <td>\n @if (m.cpuSecondsPerUnit !== null) { {{ (m.cpuSecondsPerUnit * 1000).toFixed(1) }} ms }\n @else { <span class=\"jc-muted\">No CPU data yet</span> }\n @if (m.cpuModel === 'average') {\n <div class=\"jc-muted jc-small\">Measured in the busiest samples and includes idle CPU, so it can read high. Load didn't vary enough, or CPU didn't follow it in a straight line, to separate the two.</div>\n }\n </td></tr>\n <tr><th>Idle CPU</th><td>@if (m.idleCores !== null) { {{ m.idleCores.toFixed(2) }} cores } @else { <span class=\"jc-muted\">Not separated</span> }</td></tr>\n <tr><th>Idle memory</th><td>@if (m.idleMemoryBytes !== null) { {{ memory(m.idleMemoryBytes) }} } @else { <span class=\"jc-muted\">Not separated</span> }</td></tr>\n <tr><th>Memory growth under load</th><td>@if (m.memoryBytesPerInFlight !== null) { {{ memory(m.memoryBytesPerInFlight) }} per request in flight } @else { <span class=\"jc-muted\">Not separated</span> }</td></tr>\n <tr><th>Highest load, one instance</th><td>{{ perSecond(m.peakPerSecond) }} requests and messages/s</td></tr>\n <tr><th>Highest use, one instance</th><td>\n {{ m.peakCores !== null ? m.peakCores.toFixed(2) + ' cores' : 'CPU unknown' }} · {{ m.peakMemoryBytes !== null ? memory(m.peakMemoryBytes) : 'memory unknown' }}</td></tr>\n <tr><th>Average response</th><td>{{ m.responseMs !== null ? m.responseMs.toFixed(0) + ' ms' : '—' }}</td></tr>\n <tr><th>Measured on</th><td>\n {{ m.instances }} instance{{ m.instances === 1 ? '' : 's' }}@if (m.coresPerInstance) {, {{ m.coresPerInstance }} cores each}@if (m.hosts.length) {, on {{ m.hosts.join(', ') }}}.\n <div class=\"jc-muted jc-small\">Figures from other hardware carry over only roughly.</div></td></tr>\n <tr><th>Based on</th><td>\n {{ m.samples }} samples of {{ m.stepSeconds }} s.\n <div class=\"jc-muted jc-small\">{{ sourceNote() }}</div>\n @if (m.truncated) { <div class=\"jc-bad jc-small\">Too many samples in this window, so only the newest were used. Choose a shorter one.</div> }</td></tr>\n </tbody>\n </table>\n </section>\n\n @if (m.outbox; as o) {\n <section class=\"jc-card\" aria-labelledby=\"jc-capacity-outbox\" data-testid=\"capacity-outbox\">\n <h3 id=\"jc-capacity-outbox\">Outbox delivery</h3>\n <table class=\"jc-table jc-capacity-measured\">\n <tbody>\n <tr><th>Messages created</th><td>{{ perSecond(o.createdPerSecond) }}/s</td></tr>\n <tr><th>Messages delivered</th><td>{{ perSecond(o.deliveredPerSecond) }}/s</td></tr>\n <tr><th>Created but not delivered</th><td [class.jc-bad]=\"o.fallingBehind\">{{ count(o.undelivered) }} in this window\n <div class=\"jc-muted jc-small\">Includes messages of rolled-back transactions, which are never delivered.</div></td></tr>\n <tr><th>Time to delivery, p95</th><td [class.jc-bad]=\"o.fallingBehind\">@if (o.recentDelaySeconds !== null) { {{ o.recentDelaySeconds.toFixed(1) }} s in the last 5 minutes } @else { <span class=\"jc-muted\">Nothing delivered in the last 5 minutes</span> }</td></tr>\n </tbody>\n </table>\n </section>\n }\n }\n }`,\n})\nexport class ServiceCapacity {\n protected readonly ctx = inject(ContextService);\n private readonly api = inject(ApiService);\n readonly serviceId = input.required<string>();\n /** The environments the service runs in: figures across several mix their hardware. */\n readonly environments = input<string[]>([]);\n\n protected readonly capacity = apiResource({\n params: () => ({ id: this.serviceId(), env: this.ctx.environment(), range: this.ctx.range(), abs: this.ctx.absolute() }),\n stream: ({ params }) => this.api.capacity({ serviceId: params.id, environment: params.env, ...this.ctx.window() }),\n });\n protected readonly users = signal(1000);\n protected readonly thinkSeconds = signal(10);\n protected readonly perAction = signal(1);\n protected readonly targetCpu = signal(60);\n protected readonly coresPerInstance = linkedSignal(() => this.capacity.value()?.coresPerInstance ?? 2);\n\n protected readonly error = computed(() => problemText(this.capacity.error()));\n protected readonly mixedEnvironments = computed(() => !this.ctx.environment() && new Set(this.environments()).size > 1);\n protected readonly plan = computed(() => {\n const m = this.capacity.value();\n return m ? planCapacity(m, {\n users: this.users(), thinkSeconds: this.thinkSeconds(), perAction: this.perAction(), targetCpu: this.targetCpu() / 100, coresPerInstance: this.coresPerInstance(),\n }) : null;\n });\n protected readonly busyConsumer = computed(() => { const m = this.capacity.value(); return !!m && consumerBusy(m); });\n protected readonly responseRising = computed(() => {\n const m = this.capacity.value();\n return m?.responseLowLoadMs && m.responseHighLoadMs && m.responseHighLoadMs >= RISING_RESPONSE * m.responseLowLoadMs\n ? { low: Math.round(m.responseLowLoadMs), high: Math.round(m.responseHighLoadMs) } : null;\n });\n protected readonly sourceNote = computed(() => this.capacity.value()?.requestSource === 'metrics'\n ? 'Requests are counted from the http.server.request.duration metric, messages from spans.'\n : 'Requests and messages are counted from spans, which undercount if traces are sampled. That makes the cost per request read high. Exporting http.server.request.duration fixes the request count.');\n\n protected readonly notableQueue = NOTABLE_QUEUE;\n protected readonly memory = bytes;\n protected readonly perSecond = rate;\n protected readonly count = (value: number) => Math.round(value).toLocaleString('en-US');\n}\n","import { LinkPipe, ObservabilityLinks } from '../core/options';\nimport { ChangeDetectionStrategy, Component, computed, inject, input } from '@angular/core';\nimport { apiResource } from '../shared/resource';\nimport { MatProgressBarModule } from '@angular/material/progress-bar';\nimport { MatTabsModule } from '@angular/material/tabs';\nimport { MatButtonModule } from '@angular/material/button';\nimport { Router, RouterLink } from '@angular/router';\nimport { ApiService } from '../core/api.service';\nimport { ContextService } from '../core/context.service';\nimport { AgoPipe, DurationPipe, PercentPipe, ReasonPipe } from '../shared/format';\nimport { ConfidenceBadge, ContextBar, HealthBadge } from '../shared/ui';\nimport { LogTable, MetricExplorer, ServiceStatsCharts, TraceTable, problemText } from '../shared/telemetry';\nimport { ServiceCapacity } from '../shared/capacity';\n\nconst TABS = ['overview', 'operations', 'dependencies', 'traces', 'logs', 'metrics', 'capacity'] as const;\n\n/**\n * One service across its environments (Console requirements §8): health with reasons, instances, operations,\n * dependencies, traces, logs and metrics, without leaving the service. The tab and the selected operation are in the\n * URL, so the investigation can be shared and the back button returns to it.\n */\n@Component({\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [LinkPipe, RouterLink, MatTabsModule, MatProgressBarModule, MatButtonModule, ContextBar, HealthBadge, ConfidenceBadge,\n TraceTable, LogTable, MetricExplorer, ServiceStatsCharts, ServiceCapacity, AgoPipe, DurationPipe, PercentPipe, ReasonPipe],\n template: `\n <jc-context-bar>\n <a [routerLink]=\"['services'] | jcLink\" [queryParams]=\"ctx.keep()\" class=\"jc-crumb\">Services</a>\n <span class=\"jc-crumb-sep\">›</span>\n <h1>{{ service.value()?.key ?? '…' }}</h1>\n @for (l of service.value()?.links ?? []; track l.url) { <a mat-button [href]=\"l.url\" target=\"_blank\" rel=\"noopener\">{{ l.title }} ↗</a> }\n </jc-context-bar>\n @if (service.isLoading()) { <mat-progress-bar mode=\"indeterminate\" /> }\n @if (service.error()) { <p class=\"jc-error\">{{ error() }}</p> }\n\n @if (service.value(); as s) {\n <div class=\"jc-health-strip\">\n @for (h of health(); track h.environment) {\n <div class=\"jc-card jc-health-card\" [class.jc-selected]=\"h.environment === ctx.environment()\">\n <div class=\"jc-row\"><strong>{{ h.environment ?? 'no environment' }}</strong><jc-health [state]=\"h.state\" [stale]=\"h.stale\" /></div>\n <ul class=\"jc-reasons\">\n @for (r of h.reasons; track r) {\n <li>\n @if (dependencyOf(r); as dep) {\n {{ r | reason }} — <a [routerLink]=\"['services', dep.id] | jcLink\" [queryParams]=\"ctx.keep()\">open</a>\n } @else { {{ r | reason }} }\n </li>\n }\n </ul>\n <div class=\"jc-muted jc-small\">since {{ h.since | ago }} · evaluated {{ h.evaluatedAt | ago }}</div>\n @if (h.environment && h.environment !== ctx.environment()) {\n <button mat-button (click)=\"ctx.set({ env: h.environment })\">Investigate {{ h.environment }}</button>\n }\n </div>\n } @empty { <p class=\"jc-muted\">No health evaluated yet: no data.</p> }\n </div>\n\n <p><a mat-stroked-button [routerLink]=\"['timeline'] | jcLink\" [queryParams]=\"ctx.keep({ service: id() })\" data-testid=\"service-timeline\">Timeline</a></p>\n <mat-tab-group [selectedIndex]=\"tabIndex()\" (selectedIndexChange)=\"openTab($event)\" animationDuration=\"0ms\" mat-stretch-tabs=\"false\">\n <mat-tab label=\"Overview\">\n @if (tabIndex() === 0) {\n <jc-service-stats [query]=\"{ serviceId: id() }\" />\n <h3>Instances</h3>\n <table class=\"jc-table\">\n <thead><tr><th>Instance</th><th>Environment</th><th>Health</th><th>Version</th><th>State</th><th>Last seen</th><th></th></tr></thead>\n <tbody>\n @for (i of instances(); track i.id) {\n <tr>\n <td>{{ i.instanceKey }}@if (i.keySource !== 'Observed') { <span class=\"jc-muted jc-small\" title=\"No service.instance.id: derived from host and process\"> (derived)</span> }</td>\n <td>{{ i.environment }}</td>\n <td><jc-health [state]=\"i.health\" /></td>\n <td>{{ i.serviceVersion ?? '—' }}</td>\n <td>{{ i.state }}</td>\n <td>{{ i.lastSeen | ago }}</td>\n <td class=\"jc-nowrap\">\n <a [routerLink]=\"[]\" [queryParams]=\"ctx.keep({ tab: 'traces', instance: i.id })\">traces</a> ·\n <a [routerLink]=\"[]\" [queryParams]=\"ctx.keep({ tab: 'logs', instance: i.id })\">logs</a>\n @if (i.hostResourceId) { · <a [routerLink]=\"['resources', i.hostResourceId] | jcLink\" [queryParams]=\"ctx.keep()\">host</a> }\n </td>\n </tr>\n } @empty { <tr><td colspan=\"7\" class=\"jc-muted\">No instances.</td></tr> }\n </tbody>\n </table>\n }\n </mat-tab>\n\n <mat-tab label=\"Operations\">\n @if (tabIndex() === 1) {\n @if (operations.isLoading()) { <mat-progress-bar mode=\"indeterminate\" /> }\n <table class=\"jc-table\">\n <thead><tr><th>Operation</th><th>Kind</th><th>Requests</th><th title=\"Average over the selected time range. The chart shows each moment, so a burst reads higher there.\">Avg/s</th><th>Errors</th><th>p50</th><th>p95</th><th>p99</th><th>Last seen</th><th></th></tr></thead>\n <tbody>\n @for (o of operations.value()?.items ?? []; track o.name + o.kind) {\n <tr [class.jc-selected]=\"o.name === operation()\">\n <td><a [routerLink]=\"[]\" [queryParams]=\"ctx.keep({ tab: 'operations', op: o.name })\">{{ o.name }}</a></td>\n <td>{{ o.kind }}</td>\n <td>{{ o.count }}</td>\n <td>{{ o.requestsPerSecond.toFixed(2) }}</td>\n <td [class.jc-bad]=\"o.errorRate >= 0.05\">{{ o.errorRate | percent2 }}</td>\n <td>{{ o.p50Ms | duration }}</td><td>{{ o.p95Ms | duration }}</td><td>{{ o.p99Ms | duration }}</td>\n <td>{{ o.lastSeen | ago }}</td>\n <td class=\"jc-nowrap\">\n <a [routerLink]=\"[]\" [queryParams]=\"ctx.keep({ tab: 'traces', op: o.name, status: 'error' })\">error traces</a> ·\n <a [routerLink]=\"[]\" [queryParams]=\"ctx.keep({ tab: 'traces', op: o.name, slow: o.p95Ms })\">slow traces</a>\n </td>\n </tr>\n } @empty { <tr><td colspan=\"10\" class=\"jc-muted\">No operations in this window.</td></tr> }\n </tbody>\n </table>\n @if (operation(); as op) {\n <h3>{{ op }}</h3>\n <jc-service-stats [query]=\"{ serviceId: id(), operation: op }\" />\n }\n }\n </mat-tab>\n\n <mat-tab label=\"Dependencies\">\n @if (tabIndex() === 2) {\n <h3>Calls and uses</h3>\n <table class=\"jc-table\">\n <thead><tr><th>Target</th><th>Relation</th><th>Evidence</th><th>Spans seen</th><th>Last seen</th><th></th></tr></thead>\n <tbody>\n @for (d of downstream(); track d.edge.id) {\n <tr>\n <td><a [routerLink]=\"d.link\" [queryParams]=\"ctx.keep()\">{{ d.name }}</a>&nbsp;<span class=\"jc-muted jc-small\">{{ d.type }}</span></td>\n <td>{{ d.edge.relation }}</td>\n <td><jc-confidence [confidence]=\"d.edge.confidence\" /></td>\n <td>{{ d.edge.spanCount }}</td>\n <td>{{ d.edge.lastSeen | ago }}</td>\n <td><a [routerLink]=\"['topology'] | jcLink\" [queryParams]=\"ctx.keep({ edge: d.edge.id })\">evidence</a> ·\n <a [routerLink]=\"[]\" [queryParams]=\"ctx.keep({ tab: 'traces', dependency: d.edge.id })\">traces</a></td>\n </tr>\n } @empty { <tr><td colspan=\"6\" class=\"jc-muted\">No downstream dependencies seen.</td></tr> }\n </tbody>\n </table>\n <h3>Called by</h3>\n <table class=\"jc-table\">\n <tbody>\n @for (d of upstream(); track d.edge.id) {\n <tr><td><a [routerLink]=\"d.link\" [queryParams]=\"ctx.keep()\">{{ d.name }}</a></td><td>{{ d.edge.relation }}</td>\n <td><jc-confidence [confidence]=\"d.edge.confidence\" /></td><td>{{ d.edge.lastSeen | ago }}</td>\n <td><a [routerLink]=\"['topology'] | jcLink\" [queryParams]=\"ctx.keep({ edge: d.edge.id })\">evidence</a></td></tr>\n } @empty { <tr><td class=\"jc-muted\">No callers seen.</td></tr> }\n </tbody>\n </table>\n }\n </mat-tab>\n\n <mat-tab label=\"Traces\">\n @if (tabIndex() === 3) {\n <div class=\"jc-filters\">\n @for (f of traceFilters(); track f.label) { <span class=\"jc-chip\">{{ f.label }} <a [routerLink]=\"[]\" [queryParams]=\"f.clear\" queryParamsHandling=\"merge\" [attr.aria-label]=\"'Remove ' + f.label\">×</a></span> }\n </div>\n <jc-trace-table [query]=\"traceQuery()\" />\n }\n </mat-tab>\n\n <mat-tab label=\"Logs\">\n @if (tabIndex() === 4) { <jc-log-table [query]=\"{ serviceId: id(), instanceId: instanceFilter() }\" /> }\n </mat-tab>\n\n <mat-tab label=\"Metrics\">\n @if (tabIndex() === 5) { <jc-metric-explorer [scope]=\"{ serviceId: id(), instanceId: instanceFilter() }\" /> }\n </mat-tab>\n\n <mat-tab label=\"Capacity\">\n @if (tabIndex() === 6) { <jc-service-capacity [serviceId]=\"id()\" [environments]=\"environments()\" /> }\n </mat-tab>\n </mat-tab-group>\n }`,\n})\nexport class ServicePage {\n protected readonly ctx = inject(ContextService);\n private readonly api = inject(ApiService);\n private readonly router = inject(Router);\n private readonly links = inject(ObservabilityLinks);\n\n readonly id = input.required<string>();\n readonly tab = input<string>();\n readonly op = input<string>();\n readonly status = input<string>();\n readonly slow = input<string>();\n readonly instance = input<string>();\n readonly dependency = input<string>();\n\n protected readonly tabIndex = computed(() => Math.max(0, TABS.indexOf((this.tab() ?? 'overview') as typeof TABS[number])));\n protected readonly operation = computed(() => this.op() ?? null);\n protected readonly instanceFilter = computed(() => this.instance() ?? null);\n\n protected readonly service = apiResource({ params: () => this.id(), stream: ({ params }) => this.api.resource(params) });\n protected readonly topology = apiResource({ params: () => this.ctx.environment(), stream: ({ params }) => this.api.topology(params || null) });\n protected readonly operations = apiResource({\n params: () => ({ id: this.id(), env: this.ctx.environment(), range: this.ctx.range(), abs: this.ctx.absolute(), on: this.tabIndex() === 1 }),\n stream: ({ params }) => this.api.operations({ serviceId: params.id, environment: params.env, ...this.ctx.window(), limit: 200 }),\n });\n\n protected readonly error = computed(() => problemText(this.service.error()));\n protected readonly health = computed(() => (this.service.value()?.health ?? []).filter(h => h.subjectType === 'service'));\n protected readonly instances = computed(() => {\n const env = this.ctx.environment();\n return (this.service.value()?.instances ?? []).filter(i => !env || i.environment === env);\n });\n\n protected readonly environments = computed(() => (this.service.value()?.instances ?? []).map(i => i.environment));\n\n private readonly nodes = computed(() => new Map((this.topology.value()?.nodes ?? []).map(n => [n.id, n])));\n private edgesWhere(match: 'source' | 'target') {\n const other = match === 'source' ? 'target' : 'source';\n return (this.topology.value()?.edges ?? []).filter(e => e[match] === this.id()).map(edge => {\n const node = this.nodes().get(edge[other]);\n return {\n edge, name: node?.displayName ?? edge[other], type: node?.type ?? '',\n link: this.links.to(node?.type === 'service' ? 'services' : 'resources', edge[other]),\n };\n });\n }\n protected readonly downstream = computed(() => this.edgesWhere('source'));\n protected readonly upstream = computed(() => this.edgesWhere('target'));\n\n /** `dependency_failed:shop/payments` links to that service when it is in the topology. */\n dependencyOf(reason: string) {\n const name = reason.match(/^(?:critical_)?dependency_(?:failed|unknown):(.+)$/)?.[1];\n if (!name) return null;\n const node = [...this.nodes().values()].find(n => n.type === 'service' && (n.displayName === name || name.endsWith(`/${n.displayName}`)));\n return node ? { id: node.id } : null;\n }\n\n protected readonly traceQuery = computed(() => ({\n serviceId: this.id(), operation: this.op(), status: this.status(), minDurationMs: this.slow(),\n instanceId: this.instance(), dependencyId: this.dependency(),\n }));\n /** The trace filters in effect, each removable on its own. */\n protected readonly traceFilters = computed(() => {\n const filters: { label: string; clear: Record<string, null> }[] = [];\n if (this.op()) filters.push({ label: `operation: ${this.op()}`, clear: { op: null } });\n if (this.status()) filters.push({ label: `status: ${this.status()}`, clear: { status: null } });\n if (this.slow()) filters.push({ label: `slower than ${Math.round(Number(this.slow()))} ms`, clear: { slow: null } });\n if (this.instance()) filters.push({ label: 'one instance', clear: { instance: null } });\n if (this.dependency()) filters.push({ label: 'through one dependency', clear: { dependency: null } });\n return filters;\n });\n\n openTab(index: number) {\n void this.router.navigate([], { queryParams: { tab: TABS[index] }, queryParamsHandling: 'merge' });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AA2CA,SAAgB,aAAa,GAAa,GAAiB;CACzD,IAAI,CAAC,EAAE,qBAAqB,EAAE,qBAAqB,GAAG,OAAO;CAC7D,IAAI,EAAE,EAAE,QAAQ,KAAK,EAAE,YAAY,KAAK,EAAE,YAAY,KAAK,EAAE,aAAa,KAAK,EAAE,mBAAmB,KAAK,EAAE,gBAAgB,IAAI,OAAO;CACtI,MAAM,YAAY,EAAE,cAAc,KAAK;CACvC,IAAI,EAAE,eAAe,YAAY,GAAG,OAAO;CAE3C,MAAM,SAAS,EAAE,YAAY,EAAE,oBAAoB,EAAE,aAAa,MAAM,EAAE;CAC1E,IAAI,SAAS,GAAG,OAAO;CACvB,MAAM,YAAY,aAAa,CAAC,KAAK,EAAE,wBAAwB,QAAQ,aAAa;CACpF,MAAM,UAAU,cAAc,aAAa,EAAE,wBAAwB;CACrE,MAAM,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAE,eAAe;CAC5D,MAAM,YAAY,KAAK,IAAI,GAAG,KAAK,KAAK,YAAY,OAAO,CAAC;CAC5D,MAAM,cAAc,YAAY;CAChC,MAAM,cAAc,EAAE,gBAAgB,WAClC,EAAE,kBAAmB,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AA,CAAA,SAAA,SAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAE;IAAkB,UAAA;IAAA,QAAA,CAAA,OAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAE;IAAe,UAAA;IAAA,QAAA,CAAA,aAAA,cAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MADjE;IAAQ,MAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAC2D;IAAO,MAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAE;IAAY,MAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAE;IAAW,MAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAE;IAAU,MAAA;GAAA;EAAA;EAAA,iBAAA,GAAA,wBAAA;CAAA,CAAA;;AAmJhH,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAW,YAAA,CAAA;EAtJvB,MAAA;EAAU,MAAA,CAAA;GACT,iBAAiB,wBAAwB;GACzC,SAAS;IAAC;IAAU;IAAY;IAAe;IAAsB;IAAiB;IAAY;IAAa;IAC7G;IAAY;IAAU;IAAgB;IAAoB;IAAiB;IAAS;IAAc;IAAa;GAAU;GAC3H,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiJX,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"juice-js-observability-services.page-CBtxLm0R.mjs","names":[],"sources":["../../../../projects/juice-js/observability/src/lib/pages/services.page.ts"],"sourcesContent":["import { LinkPipe } from '../core/options';\nimport { ChangeDetectionStrategy, Component, computed, inject, input, signal } from '@angular/core';\nimport { apiResource } from '../shared/resource';\nimport { MatPaginatorModule } from '@angular/material/paginator';\nimport { MatProgressBarModule } from '@angular/material/progress-bar';\nimport { RouterLink } from '@angular/router';\nimport { SearchablePage } from '@juice-js/layout';\nimport { forkJoin, map } from 'rxjs';\nimport { ApiService } from '../core/api.service';\nimport { ContextService } from '../core/context.service';\nimport { Health, HealthState } from '../core/models';\nimport { AgoPipe, ReasonPipe } from '../shared/format';\nimport { ContextBar, HealthBadge } from '../shared/ui';\nimport { problemText } from '../shared/telemetry';\nimport { screenPages } from '../shared/paging';\n\nconst SEVERITY: HealthState[] = ['Critical', 'Unhealthy', 'Degraded', 'Offline', 'Unknown', 'Healthy'];\n\n/**\n * The service catalog (Console requirements §8): one row per service, environment-independent, with its health in\n * each environment. The toolbar search box filters it.\n */\n@Component({\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [LinkPipe, RouterLink, MatPaginatorModule, MatProgressBarModule, ContextBar, HealthBadge, AgoPipe],\n template: `\n <jc-context-bar><h1>Services</h1>\n @if (state()) { <span class=\"jc-chip\">{{ state() }} <a [routerLink]=\"['services'] | jcLink\" [queryParams]=\"ctx.keep()\">×</a></span> }\n </jc-context-bar>\n @if (data.isLoading()) { <mat-progress-bar mode=\"indeterminate\" /> }\n @if (data.error()) { <p class=\"jc-error\">{{ error() }}</p> }\n @if (capped()) { <p class=\"jc-notice\">Showing the first 5,000 only. Narrow the list with the search box or a filter.</p> }\n <table class=\"jc-table\">\n <thead><tr><th>Service</th><th>Health by environment</th><th>Why</th><th>Last seen</th></tr></thead>\n <tbody>\n @for (s of pages.visible(); track s.id) {\n <tr>\n <td><a [routerLink]=\"['services', s.id] | jcLink\" [queryParams]=\"ctx.keep()\">{{ s.key }}</a></td>\n <td class=\"jc-envs\">\n @for (h of s.health; track h.environment) {\n <span><span class=\"jc-muted jc-small\">{{ h.environment ?? '—' }}</span> <jc-health [state]=\"h.state\" [stale]=\"h.stale\" /></span>\n } @empty { <jc-health [state]=\"null\" /> }\n </td>\n <td class=\"jc-small\">{{ s.worst?.reasons?.slice(0, 2)?.map(reason)?.join(' · ') }}</td>\n <td>{{ s.lastSeen | ago }}</td>\n </tr>\n } @empty { <tr><td colspan=\"4\" class=\"jc-muted\">No services{{ filter() ? ' match \"' + filter() + '\"' : '' }}.</td></tr> }\n </tbody>\n </table>\n @if (pages.needed()) {\n <mat-paginator [length]=\"rows().length\" [pageSize]=\"pages.size()\" [pageIndex]=\"pages.index()\" [pageSizeOptions]=\"pages.sizes\"\n (page)=\"pages.change($event)\" aria-label=\"Pages\" />\n }`,\n})\nexport class ServicesPage implements SearchablePage {\n protected readonly ctx = inject(ContextService);\n private readonly api = inject(ApiService);\n readonly state = input<string>();\n protected readonly filter = signal('');\n private readonly reasonPipe = new ReasonPipe();\n protected readonly reason = (r: string) => this.reasonPipe.transform(r);\n\n protected readonly data = apiResource({\n stream: () => forkJoin({\n services: this.api.resources('service'),\n health: this.api.health({ subjectType: 'service' }),\n }).pipe(map(({ services, health }) => ({\n services: services.items, health: health.items, capped: services.nextCursor !== null || health.nextCursor !== null,\n }))),\n });\n protected readonly capped = computed(() => this.data.value()?.capped ?? false);\n protected readonly error = computed(() => problemText(this.data.error()));\n\n protected readonly rows = computed(() => {\n const data = this.data.value();\n if (!data) return [];\n const env = this.ctx.environment();\n const byService = new Map<string, Health[]>();\n for (const h of data.health) byService.set(h.subjectId, [...(byService.get(h.subjectId) ?? []), h]);\n const q = this.filter().toLowerCase();\n return data.services\n .map(s => {\n const health = (byService.get(s.id) ?? []).filter(h => !env || h.environment === env);\n const worst = [...health].sort((a, b) => SEVERITY.indexOf(a.state) - SEVERITY.indexOf(b.state))[0];\n return { ...s, health, worst };\n })\n // With an environment chosen, only the services seen in it.\n .filter(s => !env || s.health.length > 0)\n .filter(s => !q || s.key.toLowerCase().includes(q))\n .filter(s => !this.state() || s.health.some(h => h.state === this.state()))\n .sort((a, b) => SEVERITY.indexOf(a.worst?.state ?? 'Unknown') - SEVERITY.indexOf(b.worst?.state ?? 'Unknown') || a.key.localeCompare(b.key));\n });\n\n protected readonly pages = screenPages(this.rows);\n\n onSearch(query: string) { this.filter.set(query); }\n}\n"],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