@juice-js/observability 1.5.0-alpha.62 → 1.5.0-alpha.93
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/{juice-js-observability-alert.page-CEGqjaqf.mjs → juice-js-observability-alert.page-DbO20r7s.mjs} +19 -45
- package/fesm2022/juice-js-observability-alert.page-DbO20r7s.mjs.map +1 -0
- package/fesm2022/juice-js-observability-notifications.page-COE-1zr0.mjs +486 -0
- package/fesm2022/juice-js-observability-notifications.page-COE-1zr0.mjs.map +1 -0
- package/fesm2022/juice-js-observability.mjs +36 -39
- package/fesm2022/juice-js-observability.mjs.map +1 -1
- package/package.json +1 -1
- package/types/juice-js-observability.d.ts +29 -89
- package/fesm2022/juice-js-observability-alert.page-CEGqjaqf.mjs.map +0 -1
- package/fesm2022/juice-js-observability-notifications.page-BpiDip9e.mjs +0 -790
- package/fesm2022/juice-js-observability-notifications.page-BpiDip9e.mjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"juice-js-observability-notifications.page-COE-1zr0.mjs","names":[],"sources":["../../../../projects/juice-js/observability/src/lib/pages/notifications.page.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, computed, inject, signal } from '@angular/core';\nimport { DatePipe } from '@angular/common';\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 { RouterLink } from '@angular/router';\nimport { map } from 'rxjs';\nimport { ApiService } from '../core/api.service';\nimport { OBSERVABILITY_CAN_ADMIN, ObservabilityLinks } from '../core/options';\nimport { EscalationPolicy } from '../core/models';\nimport { apiResource } from '../shared/resource';\nimport { problemText } from '../shared/telemetry';\nimport { ContextBar } from '../shared/ui';\n\nconst list = (text: string) => text.split(',').map(s => s.trim()).filter(Boolean);\n\ninterface PolicyForm { editing: boolean; key: string; name: string; ruleKeys: string; environments: string; minimumSeverity: string; enabled: boolean; }\n\nconst NEW_POLICY: PolicyForm = { editing: false, key: '', name: '', ruleKeys: '', environments: '', minimumSeverity: 'Critical', enabled: true };\n\n/**\n * Escalation selection: which alerts take which escalation policy. What a policy does (its steps, who is told, when it stops) is on the\n * Notifications Escalation Policies page; a selection here needs a policy with the same key there. Changing a selection needs the admin role.\n */\n@Component({\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [DatePipe, FormsModule, MatButtonModule, MatCheckboxModule, MatFormFieldModule, MatInputModule, MatProgressBarModule, MatSelectModule, ContextBar, RouterLink],\n template: `\n <jc-context-bar><h1>Escalation selection</h1></jc-context-bar>\n @if (data.isLoading()) { <mat-progress-bar mode=\"indeterminate\" /> }\n @if (error()) { <p class=\"jc-error\">{{ error() }}</p> }\n\n <section class=\"jc-card\">\n <h2>Selections @if (admin()) { <button mat-button type=\"button\" data-testid=\"policy-new\" (click)=\"policy.set(newPolicy())\">New selection</button> }</h2>\n <p class=\"jc-muted jc-small\">Which alerts escalate. What an escalation does is set on the Notifications Escalation Policies page.</p>\n @if (policy(); as f) {\n <form class=\"jc-form\" data-testid=\"policy-form\" (ngSubmit)=\"savePolicy(f)\">\n @if (!f.editing) { <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-sm\"><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>Only these rules</mat-label><input matInput name=\"ruleKeys\" [(ngModel)]=\"f.ruleKeys\"></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\"><mat-label>Only these environments</mat-label><input matInput name=\"environments\" [(ngModel)]=\"f.environments\"></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-sm\"><mat-label>Severity at least</mat-label>\n <mat-select name=\"minimumSeverity\" [(ngModel)]=\"f.minimumSeverity\"><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 <mat-checkbox name=\"policyEnabled\" [(ngModel)]=\"f.enabled\">Enabled</mat-checkbox>\n <div class=\"jc-form-actions\">\n <button mat-flat-button type=\"submit\" data-testid=\"policy-save\" [disabled]=\"saving()\">Save</button>\n <button mat-button type=\"button\" (click)=\"policy.set(null)\">Cancel</button>\n @if (policyError()) { <span class=\"jc-error\" data-testid=\"policy-error\">{{ policyError() }}</span> }\n </div>\n </form>\n }\n <table class=\"jc-table\" data-testid=\"policies\">\n <thead><tr><th>Selection</th><th>Applies to</th><th>Steps</th><th>Changed</th><th></th></tr></thead>\n <tbody>\n @for (p of policies(); track p.id) {\n <tr [class.jc-muted]=\"!p.enabled\">\n <td><strong>{{ p.name }}</strong><div class=\"jc-muted jc-small\">{{ p.key }}@if (!p.enabled) { · disabled }</div></td>\n <td class=\"jc-small\">{{ p.minimumSeverity }} and above@if (p.environments.length) { · {{ p.environments.join(', ') }} }@if (p.ruleKeys.length) { · {{ p.ruleKeys.join(', ') }} }</td>\n <td class=\"jc-small\">\n @if (steps(); as link) {\n @if (link.href) { <a [href]=\"link.href\" [attr.data-testid]=\"'steps-' + p.key\">Steps</a> }\n @else { <a [routerLink]=\"link.route\" [attr.data-testid]=\"'steps-' + p.key\">Steps</a> }\n }\n @if (!p.pipelinePolicyExists) { <span class=\"jc-bad\" [attr.data-testid]=\"'no-pipeline-policy-' + p.key\">No policy with this key in Notifications: alerts notify once</span> }\n </td>\n <td class=\"jc-small jc-nowrap\">{{ p.updatedAt | date: 'MMM d, HH:mm' }}</td>\n <td class=\"jc-row-actions\">@if (admin()) {\n <button mat-button type=\"button\" [attr.data-testid]=\"'policy-change-' + p.key\" (click)=\"editPolicy(p)\">Change</button>\n <button mat-button type=\"button\" [attr.data-testid]=\"'policy-delete-' + p.key\" [disabled]=\"saving()\" (click)=\"deletePolicy(p.key)\">Delete</button>\n }</td>\n </tr>\n } @empty { <tr><td colspan=\"5\" class=\"jc-muted\">No selections: a firing alert notifies once.</td></tr> }\n </tbody>\n </table>\n @if (deleteError()) { <p class=\"jc-error\" data-testid=\"policy-delete-error\">{{ deleteError() }}</p> }\n </section>`,\n})\nexport class NotificationsPage {\n private readonly api = inject(ApiService);\n private readonly links = inject(ObservabilityLinks);\n private readonly canAdmin = inject(OBSERVABILITY_CAN_ADMIN);\n /** Changing a selection needs the admin role; the buttons are hidden without it (the API refuses with 403 anyway). */\n protected readonly admin = () => this.canAdmin();\n protected readonly deleteError = signal('');\n protected readonly policy = signal<PolicyForm | null>(null);\n protected readonly saving = signal(false);\n protected readonly policyError = signal('');\n\n protected readonly data = apiResource({ stream: () => this.api.escalationPolicies().pipe(map(p => p.items)) });\n protected readonly error = computed(() => problemText(this.data.error()));\n protected readonly policies = computed(() => this.data.value() ?? []);\n\n /** The Notifications Escalation Policies page, when the host mounted the notification pages. */\n protected steps() {\n const l = this.links.admin('escalation-policies');\n return l ? { href: 'href' in l ? l.href : null, route: 'route' in l ? l.route : [] } : null;\n }\n\n protected newPolicy(): PolicyForm { this.policyError.set(''); return { ...NEW_POLICY }; }\n\n protected editPolicy(p: EscalationPolicy) {\n this.policyError.set('');\n this.policy.set({ editing: true, key: p.key, name: p.name, ruleKeys: p.ruleKeys.join(', '), environments: p.environments.join(', '), minimumSeverity: p.minimumSeverity, enabled: p.enabled });\n }\n\n protected savePolicy(f: PolicyForm) {\n const body = { key: f.key, name: f.name, enabled: f.enabled, ruleKeys: list(f.ruleKeys), environments: list(f.environments).map(e => e.toLowerCase()), minimumSeverity: f.minimumSeverity };\n this.saving.set(true);\n this.policyError.set('');\n (f.editing ? this.api.updateEscalationPolicy(f.key, body) : this.api.createEscalationPolicy(body)).subscribe({\n next: () => { this.saving.set(false); this.policy.set(null); this.data.reload(); },\n error: e => { this.saving.set(false); this.policyError.set((e as { status?: number }).status === 403 ? 'This needs the admin role.' : problemText(e)); },\n });\n }\n\n /** Removes a selection, including an orphaned one whose pipeline policy is gone. */\n protected deletePolicy(key: string) {\n this.saving.set(true);\n this.deleteError.set('');\n this.api.deleteEscalationPolicy(key).subscribe({\n next: () => { this.saving.set(false); this.data.reload(); },\n error: e => { this.saving.set(false); this.deleteError.set((e as { status?: number }).status === 403 ? 'This needs the admin role.' : problemText(e)); },\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAkBA,MAAM,QAAQ,SAAiB,KAAK,MAAM,GAAG,CAAC,CAAC,KAAI,MAAK,EAAE,KAAI,CAAE,CAAC,CAAC,OAAO,OAAO;AAIhF,MAAM,aAAyB;CAAE,SAAS;CAAO,KAAK;CAAI,MAAM;CAAI,UAAU;CAAI,cAAc;CAAI,iBAAiB;CAAY,SAAS;AAAI;AA4D9I,IAAa,oBAAb,MAAa,kBAAiB;CACX,MAAM,OAAO,UAAU;CACvB,QAAQ,OAAO,kBAAkB;CACjC,WAAW,OAAO,uBAAuB;CAEvC,cAAc,KAAK,SAAQ;CAC3B,cAAc,OAAO,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,cAAA,CAAA,+BAAA,CAAA,CAAA;CACxB,SAAS,OAA0B,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,SAAA,CAAA,+BAAA,CAAA,CAAA;CACxC,SAAS,OAAO,OAAM,GAAA,YAAA,CAAA,EAAA,WAAA,SAAA,CAAA,+BAAA,CAAA,CAAA;CACtB,cAAc,OAAO,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,cAAA,CAAA,+BAAA,CAAA,CAAA;CAExB,OAAO,YAAY,EAAE,cAAc,KAAK,IAAI,mBAAkB,CAAE,CAAC,KAAK,KAAI,MAAK,EAAE,KAAK,CAAC,EAAC,CAAE;CAC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A,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,MAAE;IAAU,UAAA;IAAA,QAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;IAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAA5J;IAAQ,MAAA;GAAA;EAAA;EAAA,iBAAA,GAAA,wBAAA;CAAA,CAAA;;AAoDP,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAiB,YAAA,CAAA;EAtD7B,MAAA;EAAU,MAAA,CAAA;GACT,iBAAiB,wBAAwB;GACzC,SAAS;IAAC;IAAU;IAAa;IAAiB;IAAmB;IAAoB;IAAgB;IAAsB;IAAiB;IAAY;GAAU;GACtK,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkDX,CAAA"}
|
|
@@ -91,39 +91,6 @@ var ApiService = class ApiService {
|
|
|
91
91
|
updateRule(key, definition, etag) {
|
|
92
92
|
return this.send("PUT", `/rules/${key}`, definition, { "If-Match": `"${etag}"` });
|
|
93
93
|
}
|
|
94
|
-
channels() {
|
|
95
|
-
return this.get("/webhooks");
|
|
96
|
-
}
|
|
97
|
-
createChannel(body) {
|
|
98
|
-
return this.send("POST", "/webhooks", body);
|
|
99
|
-
}
|
|
100
|
-
updateChannel(id, body) {
|
|
101
|
-
return this.send("PUT", `/webhooks/${id}`, body);
|
|
102
|
-
}
|
|
103
|
-
deliveries(id, query = {}) {
|
|
104
|
-
return this.get(`/webhooks/${id}/deliveries`, {
|
|
105
|
-
limit: 50,
|
|
106
|
-
...query
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
testChannel(id) {
|
|
110
|
-
return this.send("POST", `/webhooks/${id}/test`);
|
|
111
|
-
}
|
|
112
|
-
retryDelivery(channelId, deliveryId) {
|
|
113
|
-
return this.send("POST", `/webhooks/${channelId}/deliveries/${deliveryId}/retry`);
|
|
114
|
-
}
|
|
115
|
-
allowlist() {
|
|
116
|
-
return this.get("/webhooks/allowlist");
|
|
117
|
-
}
|
|
118
|
-
putAllowlist(destination, ports) {
|
|
119
|
-
return this.send("PUT", "/webhooks/allowlist", {
|
|
120
|
-
destination,
|
|
121
|
-
ports
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
removeAllowlist(destination) {
|
|
125
|
-
return this.send("DELETE", `/webhooks/allowlist?destination=${encodeURIComponent(destination)}`);
|
|
126
|
-
}
|
|
127
94
|
escalationPolicies() {
|
|
128
95
|
return this.get("/escalation-policies");
|
|
129
96
|
}
|
|
@@ -133,6 +100,9 @@ var ApiService = class ApiService {
|
|
|
133
100
|
updateEscalationPolicy(key, body) {
|
|
134
101
|
return this.send("PUT", `/escalation-policies/${key}`, body);
|
|
135
102
|
}
|
|
103
|
+
deleteEscalationPolicy(key) {
|
|
104
|
+
return this.send("DELETE", `/escalation-policies/${key}`);
|
|
105
|
+
}
|
|
136
106
|
silences(query = {}) {
|
|
137
107
|
return this.get("/silences", {
|
|
138
108
|
limit: 200,
|
|
@@ -478,6 +448,19 @@ var ObservabilityLinks = class ObservabilityLinks {
|
|
|
478
448
|
to(...segments) {
|
|
479
449
|
return [this.base, ...segments];
|
|
480
450
|
}
|
|
451
|
+
admin(...segments) {
|
|
452
|
+
const base = this.options.notificationsLink;
|
|
453
|
+
if (!base) return null;
|
|
454
|
+
if (/^https?:\/\//i.test(base)) return { href: `${base.replace(/\/+$/, "")}/go/${segments.map(encodeURIComponent).join("/")}` };
|
|
455
|
+
return { route: [
|
|
456
|
+
normalizeBasePath(base),
|
|
457
|
+
"go",
|
|
458
|
+
...segments
|
|
459
|
+
] };
|
|
460
|
+
}
|
|
461
|
+
correlation(key) {
|
|
462
|
+
return key ? this.admin("correlations", "observability", key) : null;
|
|
463
|
+
}
|
|
481
464
|
audit(traceId) {
|
|
482
465
|
if (!traceId || !this.options.auditLink) return null;
|
|
483
466
|
const link = this.options.auditLink(traceId);
|
|
@@ -542,6 +525,10 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
542
525
|
args: [{ name: "jcLink" }]
|
|
543
526
|
}]
|
|
544
527
|
});
|
|
528
|
+
const OBSERVABILITY_CAN_ADMIN = new InjectionToken("OBSERVABILITY_CAN_ADMIN", {
|
|
529
|
+
providedIn: "root",
|
|
530
|
+
factory: () => () => true
|
|
531
|
+
});
|
|
545
532
|
const RANGES = {
|
|
546
533
|
"15m": 9e5,
|
|
547
534
|
"1h": 36e5,
|
|
@@ -659,9 +646,19 @@ const OBSERVABILITY_ROUTES = [
|
|
|
659
646
|
page("resources", "Resources", () => import("./juice-js-observability-resources.page-5NFM0Q92.mjs").then((m) => m.ResourcesPage)),
|
|
660
647
|
page("resources/:id", "Resource", () => import("./juice-js-observability-resource.page-Yj_jtwmS.mjs").then((m) => m.ResourcePage)),
|
|
661
648
|
page("alerts", "Alerts", () => import("./juice-js-observability-alerts.page-C5zfUEHp.mjs").then((m) => m.AlertsPage)),
|
|
662
|
-
page("alerts/:id", "Alert", () => import("./juice-js-observability-alert.page-
|
|
649
|
+
page("alerts/:id", "Alert", () => import("./juice-js-observability-alert.page-DbO20r7s.mjs").then((m) => m.AlertPage)),
|
|
663
650
|
page("rules", "Rules", () => import("./juice-js-observability-rules.page-CXSJCNpv.mjs").then((m) => m.RulesPage)),
|
|
664
|
-
page("
|
|
651
|
+
page("escalation", "Escalation selection", () => import("./juice-js-observability-notifications.page-COE-1zr0.mjs").then((m) => m.NotificationsPage)),
|
|
652
|
+
{
|
|
653
|
+
path: "notifications",
|
|
654
|
+
children: [{
|
|
655
|
+
path: "**",
|
|
656
|
+
redirectTo: () => {
|
|
657
|
+
const base = normalizeBasePath(inject(OBSERVABILITY_OPTIONS).basePath);
|
|
658
|
+
return `${base === "/" ? "" : base}/escalation`;
|
|
659
|
+
}
|
|
660
|
+
}]
|
|
661
|
+
},
|
|
665
662
|
page("silences", "Silences", () => import("./juice-js-observability-silences.page-DMaUp5Ax.mjs").then((m) => m.SilencesPage)),
|
|
666
663
|
page("incidents", "Incidents", () => import("./juice-js-observability-incidents.page-CObvTD52.mjs").then((m) => m.IncidentsPage)),
|
|
667
664
|
page("incidents/:id", "Incident", () => import("./juice-js-observability-incident.page-g1q8yaVb.mjs").then((m) => m.IncidentPage)),
|
|
@@ -792,10 +789,10 @@ function observabilityMenus(basePath = "/", order = 1, alertNotifications) {
|
|
|
792
789
|
routerLink: link("silences")
|
|
793
790
|
},
|
|
794
791
|
{
|
|
795
|
-
id: "
|
|
796
|
-
label:
|
|
792
|
+
id: "escalation",
|
|
793
|
+
label: "Escalation selection",
|
|
797
794
|
icon: "campaign",
|
|
798
|
-
routerLink: link("
|
|
795
|
+
routerLink: link("escalation")
|
|
799
796
|
}
|
|
800
797
|
])
|
|
801
798
|
].map((menu, index) => ({
|
|
@@ -818,6 +815,6 @@ function alertNotificationsGroup(items) {
|
|
|
818
815
|
children
|
|
819
816
|
};
|
|
820
817
|
}
|
|
821
|
-
export { ALERT_NOTIFICATIONS_MENU_ID, APPROVALS_MENU_ID, ApiService, ApprovalCount, ApprovalMenuBadge, ContextService, LinkPipe, MAX_SEARCH_MS, OBSERVABILITY_OPTIONS, OBSERVABILITY_ROUTES, ObservabilityLinks, RANGES, idempotencyKey, normalizeBasePath, observabilityMenus, provideJuiceObservability };
|
|
818
|
+
export { ALERT_NOTIFICATIONS_MENU_ID, APPROVALS_MENU_ID, ApiService, ApprovalCount, ApprovalMenuBadge, ContextService, LinkPipe, MAX_SEARCH_MS, OBSERVABILITY_CAN_ADMIN, OBSERVABILITY_OPTIONS, OBSERVABILITY_ROUTES, ObservabilityLinks, RANGES, idempotencyKey, normalizeBasePath, observabilityMenus, provideJuiceObservability };
|
|
822
819
|
|
|
823
820
|
//# sourceMappingURL=juice-js-observability.mjs.map
|
|
@@ -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, 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 /**\n * Where the host mounted the notification pages (`@juice-js/notifications-admin`, phase 5 M48), such as `/alerts/notifications`: the\n * webhooks page links to them. Without it, no link.\n */\n notificationsLink?: string | 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, notificationsLink: 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 notificationsLink: options.notificationsLink ?? 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 *\n * `alertNotifications` (phase 5, M48): the menu of the notification pages the host mounted, shown as the Alerts › Notifications group after\n * Alerts; the webhooks page is then labelled Webhooks, and links to it.\n */\nexport function observabilityMenus(basePath = '/', order = 1, alertNotifications?: Menus): 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 ...(alertNotifications?.length ? [alertNotificationsGroup(alertNotifications)] : []),\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: alertNotifications?.length ? 'Webhooks' : 'Notifications', icon: 'campaign', routerLink: link('notifications') },\n ]),\n ];\n return menus.map((menu, index) => ({ ...menu, order: order + index }));\n}\n\n/** The menu id of the Alerts › Notifications group {@link observabilityMenus} adds when the host mounts the notification pages. */\nexport const ALERT_NOTIFICATIONS_MENU_ID = 'observability-alert-notifications';\n\n/**\n * The Alerts › Notifications group (phase 5, M48): the notification pages the host mounted (`@juice-js/notifications-admin`'s menu), in one\n * level, as juice-layout shows one. Their own groups are flattened in order; ids get a `notifications-admin-` prefix and lose their go-to\n * keys, which would clash with the platform's own (g o, g i, g s…).\n */\nfunction alertNotificationsGroup(items: Menus): Menus[number] {\n const flat = items.flatMap(item => (item.children?.length ? item.children : [item]));\n const children: Menus = flat.map(({ shortcut: _, children: __, ...item }) => ({ ...item, id: `notifications-admin-${item.id}` }));\n return { id: ALERT_NOTIFICATIONS_MENU_ID, label: 'Alert notifications', icon: 'campaign', routerLink: children[0].routerLink,\n replaceChildRouterLink: false, children };\n}\n"],"mappings":";;;;;;;;AAcA,SAAgB,iBAAc;CAC5B,MAAM,IAAI,OAAO,gCAAgB,IAAI,WAAW,EAAE,CAAC;CACnD,EAAE,KAAM,EAAE,KAAK,KAAQ;CACvB,EAAE,KAAM,EAAE,KAAK,KAAQ;CACvB,MAAM,MAAM,MAAM,KAAK,IAAG,MAAK,EAAE,SAAS,EAAE,CAAC,CAAC,SAAS,GAAG,GAAG,CAAC,CAAC,CAAC,KAAK,EAAE;CACvE,OAAO,GAAG,IAAI,MAAM,GAAG,CAAC,EAAC,GAAI,IAAI,MAAM,GAAG,EAAE,EAAC,GAAI,IAAI,MAAM,IAAI,EAAE,EAAC,GAAI,IAAI,MAAM,IAAI,EAAE,EAAC,GAAI,IAAI,MAAM,EAAE;AACzG;AASA,IAAa,aAAb,MAAa,WAAU;CACJ,OAAO,OAAO,UAAU;CACxB,OAAO,GAAG,OAAO,qBAAqB,CAAC,CAAC,QAAO;CAGvD,cAAc,OAAO,OAAM,GAAA,YAAA,CAAA,EAAA,WAAA,cAAA,CAAA,+BAAA,CAAA,CAAA;CAG3B,U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,CAAM,KAAK,MAAM,WAAW;EAAE,GAAG;EAAM,OAAO,QAAQ;CAAK,EAAG;AACvE;AAGA,MAAa,8BAA8B;AAO3C,SAAS,wBAAwB,OAAY;CAE3C,MAAM,WADO,MAAM,SAAQ,SAAS,KAAK,UAAU,SAAS,KAAK,WAAW,CAAC,IAAI,CACzD,CAAA,CAAK,KAAK,EAAE,UAAU,GAAG,UAAU,IAAI,GAAG,YAAY;EAAE,GAAG;EAAM,IAAI,uBAAuB,KAAK;CAAI,EAAG;CAChI,OAAO;EAAE,IAAI;EAA6B,OAAO;EAAuB,MAAM;EAAY,YAAY,SAAS,EAAE,CAAC;EAChH,wBAAwB;EAAO;CAAQ;AAC3C"}
|
|
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, Application, 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 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 /** Removes a selection (admin); the pipeline's own policy of that key is not touched. */\n deleteEscalationPolicy(key: string) { return this.send<void>('DELETE', `/escalation-policies/${key}`); }\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 /**\n * Where the host mounted the notification pages (`@juice-js/notifications-admin`, phase 5 M48), such as `/alerts/notifications`: the\n * escalation page and the alert page link to them (an absolute URL is used as written). Without it, no link.\n */\n notificationsLink?: string | 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, notificationsLink: 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 notificationsLink: options.notificationsLink ?? 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 /**\n * A Notifications admin page (`<notificationsLink>/go/<segments>`; `go` picks the tenant the signed-in user may use). Without\n * `notificationsLink`, no link. A configured absolute URL is used as written, as text with its host case and port kept, never\n * re-serialised; a path becomes a router link.\n */\n admin(...segments: string[]): { route: unknown[] } | { href: string } | null {\n const base = this.options.notificationsLink;\n if (!base) return null;\n if (/^https?:\\/\\//i.test(base)) return { href: `${base.replace(/\\/+$/, '')}/go/${segments.map(encodeURIComponent).join('/')}` };\n return { route: [normalizeBasePath(base), 'go', ...segments] };\n }\n\n /** The admin page of a correlation of this platform's alerts (`alert:{id}`). */\n correlation(key: string | null | undefined) { return key ? this.admin('correlations', 'observability', key) : null; }\n\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\n/**\n * Whether the signed-in user has the admin role, which the API requires to change an escalation selection. The host answers it from its\n * sign-in (Console: the access token's roles); the default is true, which hides nothing, and the API still refuses a non-admin with 403.\n */\nexport const OBSERVABILITY_CAN_ADMIN = new InjectionToken<() => boolean>('OBSERVABILITY_CAN_ADMIN', { providedIn: 'root', factory: () => () => true });\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 { inject } from '@angular/core';\nimport { Routes } from '@angular/router';\nimport { Menus } from '@juice-js/core';\nimport { APPROVALS_MENU_ID } from './core/approval-count';\nimport { OBSERVABILITY_OPTIONS, 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('escalation', 'Escalation selection', () => import('./pages/notifications.page').then(m => m.NotificationsPage)),\n // The old Webhooks page and any deep link under it open Escalation selection, under the host's base path.\n { path: 'notifications', children: [{ path: '**', redirectTo: () => { const base = normalizeBasePath(inject(OBSERVABILITY_OPTIONS).basePath); return `${base === '/' ? '' : base}/escalation`; } }] },\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 *\n * `alertNotifications` (phase 5, M48): the menu of the notification pages the host mounted, shown as the Alerts › Notifications group after\n * Alerts; the escalation selection page links to its Escalation Policies page.\n */\nexport function observabilityMenus(basePath = '/', order = 1, alertNotifications?: Menus): 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 ...(alertNotifications?.length ? [alertNotificationsGroup(alertNotifications)] : []),\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: 'escalation', label: 'Escalation selection', icon: 'campaign', routerLink: link('escalation') },\n ]),\n ];\n return menus.map((menu, index) => ({ ...menu, order: order + index }));\n}\n\n/** The menu id of the Alerts › Notifications group {@link observabilityMenus} adds when the host mounts the notification pages. */\nexport const ALERT_NOTIFICATIONS_MENU_ID = 'observability-alert-notifications';\n\n/**\n * The Alerts › Notifications group (phase 5, M48): the notification pages the host mounted (`@juice-js/notifications-admin`'s menu), in one\n * level, as juice-layout shows one. Their own groups are flattened in order; ids get a `notifications-admin-` prefix and lose their go-to\n * keys, which would clash with the platform's own (g o, g i, g s…).\n */\nfunction alertNotificationsGroup(items: Menus): Menus[number] {\n const flat = items.flatMap(item => (item.children?.length ? item.children : [item]));\n const children: Menus = flat.map(({ shortcut: _, children: __, ...item }) => ({ ...item, id: `notifications-admin-${item.id}` }));\n return { id: ALERT_NOTIFICATIONS_MENU_ID, label: 'Alert notifications', icon: 'campaign', routerLink: children[0].routerLink,\n replaceChildRouterLink: false, children };\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,KAA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;GAAa,YAAY,KAAK,QAAQ;EAAC,GAC9E;GAAE,IAAI;GAAmB,OAAO;GAAa,MAAM;GAAY,YAAY,KAAK,WAAW;EAAC,CAC7F,CAAA;EACD,MAAM,2BAA2B,aAAa,QAAQ;GACpD;IAAE,IAAI;IAAS,OAAO;IAAS,MAAM;IAAQ,YAAY,KAAK,OAAO;GAAC;GACtE;IAAE,IAAI;IAAY,OAAO;IAAY,MAAM;IAAwB,YAAY,KAAK,UAAU;GAAC;GAC/F;IAAE,IAAI;IAAc,OAAO;IAAwB,MAAM;IAAY,YAAY,KAAK,YAAY;GAAC;EACpG,CAAA;CAEI,CAAA,CAAM,KAAK,MAAM,WAAW;EAAE,GAAG;EAAM,OAAO,QAAQ;CAAK,EAAG;AACvE;AAGA,MAAa,8BAA8B;AAO3C,SAAS,wBAAwB,OAAY;CAE3C,MAAM,WADO,MAAM,SAAQ,SAAS,KAAK,UAAU,SAAS,KAAK,WAAW,CAAC,IAAI,CACzD,CAAA,CAAK,KAAK,EAAE,UAAU,GAAG,UAAU,IAAI,GAAG,YAAY;EAAE,GAAG;EAAM,IAAI,uBAAuB,KAAK;CAAI,EAAG;CAChI,OAAO;EAAE,IAAI;EAA6B,OAAO;EAAuB,MAAM;EAAY,YAAY,SAAS,EAAE,CAAC;EAChH,wBAAwB;EAAO;CAAQ;AAC3C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@juice-js/observability",
|
|
3
|
-
"version": "1.5.0-alpha.
|
|
3
|
+
"version": "1.5.0-alpha.93",
|
|
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",
|
|
@@ -16,7 +16,7 @@ export interface ObservabilityOptions {
|
|
|
16
16
|
auditLink?: ((traceId: string) => unknown[] | string | null) | null;
|
|
17
17
|
/**
|
|
18
18
|
* Where the host mounted the notification pages (`@juice-js/notifications-admin`, phase 5 M48), such as `/alerts/notifications`: the
|
|
19
|
-
*
|
|
19
|
+
* escalation page and the alert page link to them (an absolute URL is used as written). Without it, no link.
|
|
20
20
|
*/
|
|
21
21
|
notificationsLink?: string | null;
|
|
22
22
|
/** Show on the Approvals menu entry how many action requests wait for the signed-in user. On unless false. */
|
|
@@ -36,6 +36,22 @@ export declare class ObservabilityLinks {
|
|
|
36
36
|
readonly base: string;
|
|
37
37
|
/** `to('services', id)` → `['/observability', 'services', id]`. */
|
|
38
38
|
to(...segments: unknown[]): unknown[];
|
|
39
|
+
/**
|
|
40
|
+
* A Notifications admin page (`<notificationsLink>/go/<segments>`; `go` picks the tenant the signed-in user may use). Without
|
|
41
|
+
* `notificationsLink`, no link. A configured absolute URL is used as written, as text with its host case and port kept, never
|
|
42
|
+
* re-serialised; a path becomes a router link.
|
|
43
|
+
*/
|
|
44
|
+
admin(...segments: string[]): {
|
|
45
|
+
route: unknown[];
|
|
46
|
+
} | {
|
|
47
|
+
href: string;
|
|
48
|
+
} | null;
|
|
49
|
+
/** The admin page of a correlation of this platform's alerts (`alert:{id}`). */
|
|
50
|
+
correlation(key: string | null | undefined): {
|
|
51
|
+
route: unknown[];
|
|
52
|
+
} | {
|
|
53
|
+
href: string;
|
|
54
|
+
} | null;
|
|
39
55
|
/** The host's link to the audit records of a trace, if it gave one. */
|
|
40
56
|
audit(traceId: string | null | undefined): {
|
|
41
57
|
route: unknown[];
|
|
@@ -52,6 +68,11 @@ export declare class LinkPipe implements PipeTransform {
|
|
|
52
68
|
static ɵfac: i0.ɵɵFactoryDeclaration<LinkPipe, never>;
|
|
53
69
|
static ɵpipe: i0.ɵɵPipeDeclaration<LinkPipe, "jcLink", true>;
|
|
54
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* Whether the signed-in user has the admin role, which the API requires to change an escalation selection. The host answers it from its
|
|
73
|
+
* sign-in (Console: the access token's roles); the default is true, which hides nothing, and the API still refuses a non-admin with 403.
|
|
74
|
+
*/
|
|
75
|
+
export declare const OBSERVABILITY_CAN_ADMIN: InjectionToken<() => boolean>;
|
|
55
76
|
export interface Page<T> {
|
|
56
77
|
items: T[];
|
|
57
78
|
nextCursor: string | null;
|
|
@@ -227,31 +248,6 @@ export interface Rule {
|
|
|
227
248
|
/** Why the rule can never observe the service it names: it reads a signal pack the service has never sent. */
|
|
228
249
|
quiet?: string | null;
|
|
229
250
|
}
|
|
230
|
-
export interface Channel {
|
|
231
|
-
id: string;
|
|
232
|
-
key: string;
|
|
233
|
-
kind: string;
|
|
234
|
-
destination: string;
|
|
235
|
-
events: string[];
|
|
236
|
-
ruleKeys: string[];
|
|
237
|
-
environments: string[];
|
|
238
|
-
recipients: string[] | null;
|
|
239
|
-
secretRef: string | null;
|
|
240
|
-
groupWindowSeconds: number;
|
|
241
|
-
minimumSeverity: string;
|
|
242
|
-
enabled: boolean;
|
|
243
|
-
managedBy: string;
|
|
244
|
-
loadedAt: string;
|
|
245
|
-
recentFailures: number;
|
|
246
|
-
waiting: number;
|
|
247
|
-
}
|
|
248
|
-
export interface DeliveryAttempt {
|
|
249
|
-
number: number;
|
|
250
|
-
at: string;
|
|
251
|
-
statusCode: number | null;
|
|
252
|
-
error: string | null;
|
|
253
|
-
durationMs: number;
|
|
254
|
-
}
|
|
255
251
|
/** A Juice Agent. `online` means it called in within the last 2 minutes; a revoked agent is never online. */
|
|
256
252
|
export interface Agent {
|
|
257
253
|
id: string;
|
|
@@ -381,43 +377,8 @@ export interface AgentCommand {
|
|
|
381
377
|
result: Record<string, unknown> | null;
|
|
382
378
|
durationMs: number | null;
|
|
383
379
|
}
|
|
384
|
-
export interface Delivery {
|
|
385
|
-
id: string;
|
|
386
|
-
alertId: string | null;
|
|
387
|
-
actionRequestId?: string | null;
|
|
388
|
-
event: string;
|
|
389
|
-
status: string;
|
|
390
|
-
attempts: number;
|
|
391
|
-
createdAt: string;
|
|
392
|
-
firstAttemptAt: string | null;
|
|
393
|
-
deliveredAt: string | null;
|
|
394
|
-
nextAttemptAt: string | null;
|
|
395
|
-
lastStatusCode: number | null;
|
|
396
|
-
lastError: string | null;
|
|
397
|
-
history: DeliveryAttempt[];
|
|
398
|
-
suppressedBy: string | null;
|
|
399
|
-
groupedInto: string | null;
|
|
400
|
-
escalationStep: number;
|
|
401
|
-
}
|
|
402
|
-
/** What a test send did; id is the webhook-id it carried. */
|
|
403
|
-
export interface ChannelTestResult {
|
|
404
|
-
id: string;
|
|
405
|
-
delivered: boolean;
|
|
406
|
-
statusCode: number | null;
|
|
407
|
-
error: string | null;
|
|
408
|
-
durationMs: number;
|
|
409
|
-
}
|
|
410
|
-
export interface AllowlistEntry {
|
|
411
|
-
destination: string;
|
|
412
|
-
ports: number[];
|
|
413
|
-
managedBy: string;
|
|
414
|
-
loadedAt: string;
|
|
415
|
-
}
|
|
416
|
-
export interface EscalationStep {
|
|
417
|
-
afterMinutes: number;
|
|
418
|
-
endpointKeys: string[];
|
|
419
|
-
}
|
|
420
380
|
export interface EscalationPolicy {
|
|
381
|
+
/** Which alerts take the policy; its steps live in Notifications, and `pipelinePolicyExists` says whether a policy with this key is there. */
|
|
421
382
|
id: string;
|
|
422
383
|
key: string;
|
|
423
384
|
name: string;
|
|
@@ -425,8 +386,7 @@ export interface EscalationPolicy {
|
|
|
425
386
|
ruleKeys: string[];
|
|
426
387
|
environments: string[];
|
|
427
388
|
minimumSeverity: string;
|
|
428
|
-
|
|
429
|
-
steps: EscalationStep[];
|
|
389
|
+
pipelinePolicyExists: boolean;
|
|
430
390
|
updatedAt: string;
|
|
431
391
|
}
|
|
432
392
|
export interface Silence {
|
|
@@ -475,21 +435,8 @@ export interface IncidentDetail {
|
|
|
475
435
|
openAlerts: number;
|
|
476
436
|
}
|
|
477
437
|
export interface AlertNotifications {
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
kind: string;
|
|
481
|
-
delivery: Delivery;
|
|
482
|
-
}[];
|
|
483
|
-
escalations: {
|
|
484
|
-
policy: string;
|
|
485
|
-
name: string;
|
|
486
|
-
state: string;
|
|
487
|
-
stepsSent: number;
|
|
488
|
-
steps: number;
|
|
489
|
-
nextAt: string | null;
|
|
490
|
-
stopReason: string | null;
|
|
491
|
-
endedAt: string | null;
|
|
492
|
-
}[];
|
|
438
|
+
/** `alert:{id}`: deliveries and escalation state are on the Notifications correlation page for it. */
|
|
439
|
+
correlationKey: string;
|
|
493
440
|
silences: Silence[];
|
|
494
441
|
incidents: IncidentSummary[];
|
|
495
442
|
}
|
|
@@ -1013,18 +960,11 @@ export declare class ApiService {
|
|
|
1013
960
|
createRule(definition: unknown): Observable<Rule>;
|
|
1014
961
|
/** With the rule's etag, so a change made since it was read isn't overwritten. */
|
|
1015
962
|
updateRule(key: string, definition: unknown, etag: string): Observable<Rule>;
|
|
1016
|
-
channels(): Observable<Page<Channel>>;
|
|
1017
|
-
createChannel(body: unknown): Observable<Channel>;
|
|
1018
|
-
updateChannel(id: string, body: unknown): Observable<Channel>;
|
|
1019
|
-
deliveries(id: string, query?: Query): Observable<Page<Delivery>>;
|
|
1020
|
-
testChannel(id: string): Observable<ChannelTestResult>;
|
|
1021
|
-
retryDelivery(channelId: string, deliveryId: string): Observable<Delivery>;
|
|
1022
|
-
allowlist(): Observable<Page<AllowlistEntry>>;
|
|
1023
|
-
putAllowlist(destination: string, ports: number[]): Observable<AllowlistEntry>;
|
|
1024
|
-
removeAllowlist(destination: string): Observable<void>;
|
|
1025
963
|
escalationPolicies(): Observable<Page<EscalationPolicy>>;
|
|
1026
964
|
createEscalationPolicy(body: unknown): Observable<EscalationPolicy>;
|
|
1027
965
|
updateEscalationPolicy(key: string, body: unknown): Observable<EscalationPolicy>;
|
|
966
|
+
/** Removes a selection (admin); the pipeline's own policy of that key is not touched. */
|
|
967
|
+
deleteEscalationPolicy(key: string): Observable<void>;
|
|
1028
968
|
silences(query?: Query): Observable<Page<Silence>>;
|
|
1029
969
|
createSilence(body: unknown): Observable<Silence>;
|
|
1030
970
|
cancelSilence(id: string): Observable<void>;
|
|
@@ -1172,7 +1112,7 @@ export declare const OBSERVABILITY_ROUTES: Routes;
|
|
|
1172
1112
|
* Group ids carry an `observability-` prefix, as the host's menu sits beside them.
|
|
1173
1113
|
*
|
|
1174
1114
|
* `alertNotifications` (phase 5, M48): the menu of the notification pages the host mounted, shown as the Alerts › Notifications group after
|
|
1175
|
-
* Alerts; the
|
|
1115
|
+
* Alerts; the escalation selection page links to its Escalation Policies page.
|
|
1176
1116
|
*/
|
|
1177
1117
|
export declare function observabilityMenus(basePath?: string, order?: number, alertNotifications?: Menus): Menus;
|
|
1178
1118
|
/** The menu id of the Alerts › Notifications group {@link observabilityMenus} adds when the host mounts the notification pages. */
|