@juice-js/observability 1.2.0-alpha.37 → 1.3.0-alpha.39

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.
Files changed (60) hide show
  1. package/fesm2022/{juice-js-observability-agent.page-Vb7LDThl.mjs → juice-js-observability-agent.page-Coq-V7gR.mjs} +2 -20
  2. package/fesm2022/juice-js-observability-agent.page-Coq-V7gR.mjs.map +1 -0
  3. package/fesm2022/{juice-js-observability-agents.page-Ch-tBwQO.mjs → juice-js-observability-agents.page-BBYRMhUD.mjs} +2 -2
  4. package/fesm2022/{juice-js-observability-agents.page-Ch-tBwQO.mjs.map → juice-js-observability-agents.page-BBYRMhUD.mjs.map} +1 -1
  5. package/fesm2022/{juice-js-observability-alert.page-2kfKksIG.mjs → juice-js-observability-alert.page-BsnDaMDk.mjs} +3 -3
  6. package/fesm2022/{juice-js-observability-alert.page-2kfKksIG.mjs.map → juice-js-observability-alert.page-BsnDaMDk.mjs.map} +1 -1
  7. package/fesm2022/{juice-js-observability-alerts.page-BNmez0Ak.mjs → juice-js-observability-alerts.page-HFFiapGB.mjs} +2 -2
  8. package/fesm2022/{juice-js-observability-alerts.page-BNmez0Ak.mjs.map → juice-js-observability-alerts.page-HFFiapGB.mjs.map} +1 -1
  9. package/fesm2022/{juice-js-observability-approvals.page-DBLw-vl1.mjs → juice-js-observability-approvals.page-CU-EP0l4.mjs} +2 -2
  10. package/fesm2022/{juice-js-observability-approvals.page-DBLw-vl1.mjs.map → juice-js-observability-approvals.page-CU-EP0l4.mjs.map} +1 -1
  11. package/fesm2022/{juice-js-observability-incident.page-D2GvuIft.mjs → juice-js-observability-incident.page-D21BdwGq.mjs} +3 -3
  12. package/fesm2022/{juice-js-observability-incident.page-D2GvuIft.mjs.map → juice-js-observability-incident.page-D21BdwGq.mjs.map} +1 -1
  13. package/fesm2022/{juice-js-observability-incidents.page-DhC3BkBo.mjs → juice-js-observability-incidents.page-DHD3qgKI.mjs} +2 -2
  14. package/fesm2022/{juice-js-observability-incidents.page-DhC3BkBo.mjs.map → juice-js-observability-incidents.page-DHD3qgKI.mjs.map} +1 -1
  15. package/fesm2022/{juice-js-observability-load-runs.page-DVuO4zFp.mjs → juice-js-observability-load-runs.page-BalwtIhB.mjs} +2 -2
  16. package/fesm2022/{juice-js-observability-load-runs.page-DVuO4zFp.mjs.map → juice-js-observability-load-runs.page-BalwtIhB.mjs.map} +1 -1
  17. package/fesm2022/{juice-js-observability-logs.page-PXWQMcvL.mjs → juice-js-observability-logs.page-CpgT6y_E.mjs} +2 -2
  18. package/fesm2022/{juice-js-observability-logs.page-PXWQMcvL.mjs.map → juice-js-observability-logs.page-CpgT6y_E.mjs.map} +1 -1
  19. package/fesm2022/{juice-js-observability-metrics.page-Ctm_EEFb.mjs → juice-js-observability-metrics.page-CBHK7a9l.mjs} +2 -2
  20. package/fesm2022/{juice-js-observability-metrics.page-Ctm_EEFb.mjs.map → juice-js-observability-metrics.page-CBHK7a9l.mjs.map} +1 -1
  21. package/fesm2022/{juice-js-observability-notifications.page-CtcV3Ei4.mjs → juice-js-observability-notifications.page-Diy63nji.mjs} +2 -2
  22. package/fesm2022/{juice-js-observability-notifications.page-CtcV3Ei4.mjs.map → juice-js-observability-notifications.page-Diy63nji.mjs.map} +1 -1
  23. package/fesm2022/juice-js-observability-overview.page-g4Cv_Y5c.mjs +601 -0
  24. package/fesm2022/juice-js-observability-overview.page-g4Cv_Y5c.mjs.map +1 -0
  25. package/fesm2022/{juice-js-observability-resource.page-O4GGdirR.mjs → juice-js-observability-resource.page-DZ7DT_3f.mjs} +2 -2
  26. package/fesm2022/{juice-js-observability-resource.page-O4GGdirR.mjs.map → juice-js-observability-resource.page-DZ7DT_3f.mjs.map} +1 -1
  27. package/fesm2022/{juice-js-observability-resources.page-B_AVPpes.mjs → juice-js-observability-resources.page-Bp9o-_QG.mjs} +2 -2
  28. package/fesm2022/{juice-js-observability-resources.page-B_AVPpes.mjs.map → juice-js-observability-resources.page-Bp9o-_QG.mjs.map} +1 -1
  29. package/fesm2022/{juice-js-observability-rules.page-CARCWaw_.mjs → juice-js-observability-rules.page-zvXo2xtw.mjs} +2 -2
  30. package/fesm2022/{juice-js-observability-rules.page-CARCWaw_.mjs.map → juice-js-observability-rules.page-zvXo2xtw.mjs.map} +1 -1
  31. package/fesm2022/{juice-js-observability-service.page-DRj1GO0Q.mjs → juice-js-observability-service.page-Dx4p3DmT.mjs} +2 -2
  32. package/fesm2022/{juice-js-observability-service.page-DRj1GO0Q.mjs.map → juice-js-observability-service.page-Dx4p3DmT.mjs.map} +1 -1
  33. package/fesm2022/{juice-js-observability-services.page-BbFbbvyH.mjs → juice-js-observability-services.page-C5-ohRLS.mjs} +2 -2
  34. package/fesm2022/{juice-js-observability-services.page-BbFbbvyH.mjs.map → juice-js-observability-services.page-C5-ohRLS.mjs.map} +1 -1
  35. package/fesm2022/{juice-js-observability-silences.page-CoTqfGxY.mjs → juice-js-observability-silences.page-CR5LpnsR.mjs} +2 -2
  36. package/fesm2022/{juice-js-observability-silences.page-CoTqfGxY.mjs.map → juice-js-observability-silences.page-CR5LpnsR.mjs.map} +1 -1
  37. package/fesm2022/{juice-js-observability-slo.page-l7TOat-D.mjs → juice-js-observability-slo.page-BvqkTyKS.mjs} +3 -3
  38. package/fesm2022/{juice-js-observability-slo.page-l7TOat-D.mjs.map → juice-js-observability-slo.page-BvqkTyKS.mjs.map} +1 -1
  39. package/fesm2022/{juice-js-observability-slos.page-DNG6g6_R.mjs → juice-js-observability-slos.page-CiTI82Sq.mjs} +2 -2
  40. package/fesm2022/{juice-js-observability-slos.page-DNG6g6_R.mjs.map → juice-js-observability-slos.page-CiTI82Sq.mjs.map} +1 -1
  41. package/fesm2022/{juice-js-observability-suggestions-eQK_z0Nd.mjs → juice-js-observability-suggestions-BNFraGRP.mjs} +2 -2
  42. package/fesm2022/{juice-js-observability-suggestions-eQK_z0Nd.mjs.map → juice-js-observability-suggestions-BNFraGRP.mjs.map} +1 -1
  43. package/fesm2022/{juice-js-observability-telemetry-DVwUTHSz.mjs → juice-js-observability-telemetry-7uv9jeKI.mjs} +23 -3
  44. package/fesm2022/juice-js-observability-telemetry-7uv9jeKI.mjs.map +1 -0
  45. package/fesm2022/{juice-js-observability-timeline.page-CFSigOgk.mjs → juice-js-observability-timeline.page-BcMxG1eb.mjs} +2 -2
  46. package/fesm2022/{juice-js-observability-timeline.page-CFSigOgk.mjs.map → juice-js-observability-timeline.page-BcMxG1eb.mjs.map} +1 -1
  47. package/fesm2022/{juice-js-observability-topology.page-BDfNpiql.mjs → juice-js-observability-topology.page-Blq_mVC2.mjs} +2 -2
  48. package/fesm2022/{juice-js-observability-topology.page-BDfNpiql.mjs.map → juice-js-observability-topology.page-Blq_mVC2.mjs.map} +1 -1
  49. package/fesm2022/{juice-js-observability-trace.page-CdW09ADY.mjs → juice-js-observability-trace.page-rr-T5b3i.mjs} +2 -2
  50. package/fesm2022/{juice-js-observability-trace.page-CdW09ADY.mjs.map → juice-js-observability-trace.page-rr-T5b3i.mjs.map} +1 -1
  51. package/fesm2022/{juice-js-observability-traces.page-CMuItN_m.mjs → juice-js-observability-traces.page-C2z6MUzK.mjs} +2 -2
  52. package/fesm2022/{juice-js-observability-traces.page-CMuItN_m.mjs.map → juice-js-observability-traces.page-C2z6MUzK.mjs.map} +1 -1
  53. package/fesm2022/juice-js-observability.mjs +27 -24
  54. package/fesm2022/juice-js-observability.mjs.map +1 -1
  55. package/package.json +1 -1
  56. package/types/juice-js-observability.d.ts +113 -0
  57. package/fesm2022/juice-js-observability-agent.page-Vb7LDThl.mjs.map +0 -1
  58. package/fesm2022/juice-js-observability-overview.page-BRGpTOyc.mjs +0 -249
  59. package/fesm2022/juice-js-observability-overview.page-BRGpTOyc.mjs.map +0 -1
  60. package/fesm2022/juice-js-observability-telemetry-DVwUTHSz.mjs.map +0 -1
@@ -0,0 +1,601 @@
1
+ import { ApiService, ContextService, LinkPipe } from "./juice-js-observability.mjs";
2
+ import { C as formatPercent, S as formatDuration, c as ContextBar, g as AgoPipe, h as apiResource, l as HealthBadge, o as problemText, x as formatBytes, y as ReasonPipe } from "./juice-js-observability-telemetry-7uv9jeKI.mjs";
3
+ import * as i0 from "@angular/core";
4
+ import { ChangeDetectionStrategy, Component, computed, inject, signal } from "@angular/core";
5
+ import { RouterLink } from "@angular/router";
6
+ import { EMPTY, catchError, map, switchMap, takeWhile, tap, timer } from "rxjs";
7
+ import { toSignal } from "@angular/core/rxjs-interop";
8
+ import { DecimalPipe } from "@angular/common";
9
+ import * as i1 from "@angular/material/progress-bar";
10
+ import { MatProgressBarModule } from "@angular/material/progress-bar";
11
+ const REFRESH_MS = 15e3;
12
+ const LEVEL_CLASS = {
13
+ ok: "jc-health-healthy",
14
+ warn: "jc-health-degraded",
15
+ bad: "jc-health-unhealthy",
16
+ unknown: "jc-health-unknown"
17
+ };
18
+ const RESOURCE_NAMES = {
19
+ "clickhouse.cpu": "ClickHouse CPU",
20
+ "clickhouse.inserts_in_flight": "Collector inserts in flight",
21
+ "collector.queue": "Export queue"
22
+ };
23
+ function formatRate(perSecond) {
24
+ if (perSecond === null || perSecond === void 0) return "—";
25
+ return perSecond >= 1e3 ? `${(perSecond / 1e3).toFixed(perSecond >= 1e5 ? 0 : 1)}k/s` : `${perSecond.toFixed(perSecond >= 10 ? 0 : 1)}/s`;
26
+ }
27
+ function formatMeasure(value, unit) {
28
+ if (value === null || value === void 0) return "—";
29
+ return unit === "cores" || unit === "inserts" ? value.toFixed(value >= 10 ? 0 : 1) : formatPercent(value);
30
+ }
31
+ var PlatformPanel = class PlatformPanel {
32
+ api = inject(ApiService);
33
+ failed = signal(void 0, ...ngDevMode ? [{ debugName: "failed" }] : /* istanbul ignore next */ []);
34
+ overview = apiResource({ stream: () => this.api.tenant$.pipe(tap(() => this.failed.set(void 0)), switchMap((t) => t.canOperate ? timer(0, REFRESH_MS).pipe(takeWhile(() => this.failed()?.status !== 403), switchMap(() => this.api.platformOverview().pipe(tap(() => this.failed.set(void 0)), catchError((e) => {
35
+ this.failed.set(e);
36
+ return EMPTY;
37
+ })))) : EMPTY)) });
38
+ o = computed(() => this.overview.value(), ...ngDevMode ? [{ debugName: "o" }] : /* istanbul ignore next */ []);
39
+ canOperate = toSignal(this.api.tenant$.pipe(map((t) => !!t.canOperate)), { initialValue: false });
40
+ hidden = computed(() => !this.canOperate() || this.failed()?.status === 403, ...ngDevMode ? [{ debugName: "hidden" }] : /* istanbul ignore next */ []);
41
+ error = computed(() => this.failed() && !this.hidden() ? problemText(this.failed()) : "", ...ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []);
42
+ cls(level) {
43
+ return `jc-badge ${LEVEL_CLASS[level]}`;
44
+ }
45
+ pct(share) {
46
+ return formatPercent(share);
47
+ }
48
+ rate(perSecond) {
49
+ return formatRate(perSecond);
50
+ }
51
+ bytes(bytes) {
52
+ return formatBytes(bytes);
53
+ }
54
+ measure(value, unit) {
55
+ return formatMeasure(value, unit);
56
+ }
57
+ ms(seconds) {
58
+ return formatDuration(seconds === null ? null : seconds * 1e3);
59
+ }
60
+ seconds(s) {
61
+ return s >= 120 ? `${Math.round(s / 60)} min` : `${Math.round(s)} s`;
62
+ }
63
+ days(d) {
64
+ return d >= 365 ? "over a year" : `${Math.round(d)} days`;
65
+ }
66
+ resource(name) {
67
+ return RESOURCE_NAMES[name] ?? (name.startsWith("worker.") ? `Worker ${name.slice(7)}` : name);
68
+ }
69
+ static ɵfac = i0.ɵɵngDeclareFactory({
70
+ minVersion: "12.0.0",
71
+ version: "22.2.4",
72
+ ngImport: i0,
73
+ type: PlatformPanel,
74
+ deps: [],
75
+ target: i0.ɵɵFactoryTarget.Component
76
+ });
77
+ static ɵcmp = i0.ɵɵngDeclareComponent({
78
+ minVersion: "17.0.0",
79
+ version: "22.2.4",
80
+ type: PlatformPanel,
81
+ isStandalone: true,
82
+ selector: "jc-platform-panel",
83
+ ngImport: i0,
84
+ template: `
85
+ @if (!hidden()) {
86
+ <section class="jc-card jc-platform" aria-labelledby="jc-platform-title">
87
+ <div class="jc-row">
88
+ <h2 id="jc-platform-title">Platform</h2>
89
+ @if (o(); as o) {
90
+ <span class="jc-badge" [class]="cls(o.status === 'ok' ? 'ok' : 'bad')">{{ o.status }}</span>
91
+ <span class="jc-muted">sampled {{ o.at | ago }}</span>
92
+ }
93
+ </div>
94
+ @if (error()) { <p class="jc-error">{{ error() }}</p> }
95
+ @if (o(); as o) {
96
+ <div class="jc-grid-2">
97
+ <div>
98
+ <h3>Workers</h3>
99
+ @for (w of o.workers; track w.name) {
100
+ <div class="jc-list-row">
101
+ <span class="jc-badge" [class]="cls(w.level)">{{ w.state }}</span>
102
+ <strong>{{ w.name }}</strong>
103
+ @if (w.utilisation !== null) { <span title="Its recent passes against its interval">{{ pct(w.utilisation) }} busy</span> }
104
+ @if (w.lastPassEndedAt) { <span class="jc-muted">last pass {{ w.lastPassEndedAt | ago }}</span> }
105
+ </div>
106
+ }
107
+ @for (b of o.backlogs; track b.name) {
108
+ <div class="jc-list-row">
109
+ <span class="jc-badge" [class]="cls(b.level)">{{ b.state }}</span>
110
+ <strong>{{ b.name }} backlog</strong>
111
+ <span class="jc-muted">{{ b.ageSeconds === null ? '—' : seconds(b.ageSeconds) }} of {{ seconds(b.lineSeconds) }}</span>
112
+ </div>
113
+ }
114
+ </div>
115
+ <div>
116
+ <h3>Ingestion</h3>
117
+ @if (o.ingestion; as i) {
118
+ @for (s of i.signals; track s.name) {
119
+ <div class="jc-list-row">
120
+ <span class="jc-badge" [class]="cls(s.level)">{{ s.name }}</span>
121
+ <span>{{ rate(s.acceptedPerSecond) }} received</span>
122
+ <span [class.jc-muted]="!s.refusedPerSecond">{{ rate(s.refusedPerSecond) }} refused</span>
123
+ <span [class.jc-muted]="!s.droppedPerSecond">{{ rate(s.droppedPerSecond) }} dropped</span>
124
+ </div>
125
+ }
126
+ @for (q of i.queues; track q.exporter) {
127
+ <div class="jc-list-row">
128
+ <span class="jc-badge" [class]="cls(q.level)">{{ pct(q.fill) }}</span>
129
+ <span>{{ q.exporter }} queue</span>
130
+ <span class="jc-muted">{{ q.size | number }} of {{ q.capacity | number }}</span>
131
+ </div>
132
+ }
133
+ } @else { <p class="jc-muted">No figures: the Collector's metrics page isn't read (Telemetry:CollectorMetricsUrl), or the last sample is old.</p> }
134
+
135
+ <h3>ClickHouse</h3>
136
+ @if (o.clickHouse; as c) {
137
+ <div class="jc-list-row">
138
+ <span class="jc-badge" [class]="cls(c.cpuLevel)">CPU</span>
139
+ <span>{{ c.cores === null ? '—' : c.cores.toFixed(1) }} of {{ c.coresAvailable ?? '—' }} cores</span>
140
+ <span class="jc-muted">{{ c.runningQueries }} queries running</span>
141
+ </div>
142
+ <div class="jc-list-row">
143
+ <span class="jc-badge" [class]="cls(c.insertLevel)">inserts</span>
144
+ <span>p95 {{ ms(c.insertP95Seconds) }}</span>
145
+ <span class="jc-muted">{{ c.insertsInFlight === null ? '—' : c.insertsInFlight.toFixed(1) }} in flight</span>
146
+ </div>
147
+ @for (r of c.reads.slice(0, 6); track r.name) {
148
+ <div class="jc-list-row">
149
+ <span class="jc-badge" [class]="cls(r.level)">p95 {{ ms(r.p95Seconds) }}</span>
150
+ <span>{{ r.name }}</span><span class="jc-muted">{{ r.count }} in the last minute</span>
151
+ </div>
152
+ }
153
+ } @else { <p class="jc-muted">No figures: ClickHouse isn't sampled (ClickHouse:MonitorConnectionString), or didn't answer.</p> }
154
+
155
+ <h3>Disk</h3>
156
+ @if (o.disk; as d) {
157
+ <div class="jc-list-row">
158
+ <span class="jc-badge" [class]="cls(d.level)">{{ d.daysUntilFull !== null ? days(d.daysUntilFull) + ' until full' : d.bytesPerDay === null ? 'no estimate yet' : d.bytesPerDay > 0 ? 'fits at retention' : 'not growing' }}</span>
159
+ <span>{{ bytes(d.used) }} used, {{ bytes(d.free) }} free</span>
160
+ </div>
161
+ <div class="jc-list-row">
162
+ <span>{{ bytes(d.bytesPerDay) }} a day@if (d.estimated) { <span class="jc-muted"> (estimated from today)</span> }</span>
163
+ <span class="jc-muted">at retention: {{ bytes(d.needAtRetention) }} of {{ bytes(d.total) }}</span>
164
+ </div>
165
+ } @else { <p class="jc-muted">No figures.</p> }
166
+ </div>
167
+ </div>
168
+
169
+ <h3>Capacity</h3>
170
+ <p class="jc-muted">{{ o.capacity.label }}</p>
171
+ <div class="jc-list-row">
172
+ @for (l of o.capacity.load; track l.signal) {
173
+ <span>{{ l.signal }} <strong>{{ l.multiple === null ? '—' : l.multiple.toFixed(1) + '×' }}</strong>
174
+ <span class="jc-muted">({{ rate(l.perSecond) }} of {{ rate(l.reference) }} at 1×)</span></span>
175
+ }
176
+ </div>
177
+ @if (o.capacity.calibrated) {
178
+ <p>Held every line to <strong>{{ o.capacity.heldTo }}×</strong>; crossed one by {{ o.capacity.crossedAt }}×
179
+ @if (o.capacity.crossed.length) { <span class="jc-muted">({{ o.capacity.crossed.join('; ') }})</span> }.
180
+ @if (o.capacity.headroom !== null) { Today's load is {{ (1 / o.capacity.headroom * 100).toFixed(0) }} % of what held. }</p>
181
+ }
182
+ <div class="jc-list-row jc-muted">
183
+ Now: {{ o.capacity.mix.rules ?? '—' }} rules, {{ o.capacity.mix.slos ?? '—' }} SLOs, {{ o.capacity.mix.services ?? '—' }} services
184
+ @if (o.capacity.mix.calibratedRules !== null) {
185
+ · calibrated with {{ o.capacity.mix.calibratedRules }} rules, {{ o.capacity.mix.calibratedSlos }} SLOs, {{ o.capacity.mix.calibratedServices }} services
186
+ and {{ o.capacity.mix.calibratedSearchesPerSecond }} searches a second
187
+ }
188
+ </div>
189
+ <table class="jc-table">
190
+ <thead><tr><th>Resource</th><th>Now</th>@if (o.capacity.calibrated) { <th>Where every line held ({{ o.capacity.heldTo }}×)</th><th>Where one crossed ({{ o.capacity.crossedAt }}×)</th> }</tr></thead>
191
+ <tbody>
192
+ @for (r of o.capacity.resources; track r.name) {
193
+ <tr>
194
+ <td>{{ resource(r.name) }}</td>
195
+ <td><span class="jc-badge" [class]="cls(r.level)">{{ measure(r.now, r.unit) }}</span></td>
196
+ @if (o.capacity.calibrated) { <td>{{ measure(r.atHeld, r.unit) }}</td><td>{{ measure(r.atCrossed, r.unit) }}</td> }
197
+ </tr>
198
+ }
199
+ </tbody>
200
+ </table>
201
+ }
202
+ </section>
203
+ }`,
204
+ isInline: true,
205
+ dependencies: [{
206
+ kind: "pipe",
207
+ type: AgoPipe,
208
+ name: "ago"
209
+ }, {
210
+ kind: "pipe",
211
+ type: DecimalPipe,
212
+ name: "number"
213
+ }],
214
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
215
+ });
216
+ };
217
+ i0.ɵɵngDeclareClassMetadata({
218
+ minVersion: "12.0.0",
219
+ version: "22.2.4",
220
+ ngImport: i0,
221
+ type: PlatformPanel,
222
+ decorators: [{
223
+ type: Component,
224
+ args: [{
225
+ selector: "jc-platform-panel",
226
+ changeDetection: ChangeDetectionStrategy.OnPush,
227
+ imports: [AgoPipe, DecimalPipe],
228
+ template: `
229
+ @if (!hidden()) {
230
+ <section class="jc-card jc-platform" aria-labelledby="jc-platform-title">
231
+ <div class="jc-row">
232
+ <h2 id="jc-platform-title">Platform</h2>
233
+ @if (o(); as o) {
234
+ <span class="jc-badge" [class]="cls(o.status === 'ok' ? 'ok' : 'bad')">{{ o.status }}</span>
235
+ <span class="jc-muted">sampled {{ o.at | ago }}</span>
236
+ }
237
+ </div>
238
+ @if (error()) { <p class="jc-error">{{ error() }}</p> }
239
+ @if (o(); as o) {
240
+ <div class="jc-grid-2">
241
+ <div>
242
+ <h3>Workers</h3>
243
+ @for (w of o.workers; track w.name) {
244
+ <div class="jc-list-row">
245
+ <span class="jc-badge" [class]="cls(w.level)">{{ w.state }}</span>
246
+ <strong>{{ w.name }}</strong>
247
+ @if (w.utilisation !== null) { <span title="Its recent passes against its interval">{{ pct(w.utilisation) }} busy</span> }
248
+ @if (w.lastPassEndedAt) { <span class="jc-muted">last pass {{ w.lastPassEndedAt | ago }}</span> }
249
+ </div>
250
+ }
251
+ @for (b of o.backlogs; track b.name) {
252
+ <div class="jc-list-row">
253
+ <span class="jc-badge" [class]="cls(b.level)">{{ b.state }}</span>
254
+ <strong>{{ b.name }} backlog</strong>
255
+ <span class="jc-muted">{{ b.ageSeconds === null ? '—' : seconds(b.ageSeconds) }} of {{ seconds(b.lineSeconds) }}</span>
256
+ </div>
257
+ }
258
+ </div>
259
+ <div>
260
+ <h3>Ingestion</h3>
261
+ @if (o.ingestion; as i) {
262
+ @for (s of i.signals; track s.name) {
263
+ <div class="jc-list-row">
264
+ <span class="jc-badge" [class]="cls(s.level)">{{ s.name }}</span>
265
+ <span>{{ rate(s.acceptedPerSecond) }} received</span>
266
+ <span [class.jc-muted]="!s.refusedPerSecond">{{ rate(s.refusedPerSecond) }} refused</span>
267
+ <span [class.jc-muted]="!s.droppedPerSecond">{{ rate(s.droppedPerSecond) }} dropped</span>
268
+ </div>
269
+ }
270
+ @for (q of i.queues; track q.exporter) {
271
+ <div class="jc-list-row">
272
+ <span class="jc-badge" [class]="cls(q.level)">{{ pct(q.fill) }}</span>
273
+ <span>{{ q.exporter }} queue</span>
274
+ <span class="jc-muted">{{ q.size | number }} of {{ q.capacity | number }}</span>
275
+ </div>
276
+ }
277
+ } @else { <p class="jc-muted">No figures: the Collector's metrics page isn't read (Telemetry:CollectorMetricsUrl), or the last sample is old.</p> }
278
+
279
+ <h3>ClickHouse</h3>
280
+ @if (o.clickHouse; as c) {
281
+ <div class="jc-list-row">
282
+ <span class="jc-badge" [class]="cls(c.cpuLevel)">CPU</span>
283
+ <span>{{ c.cores === null ? '—' : c.cores.toFixed(1) }} of {{ c.coresAvailable ?? '—' }} cores</span>
284
+ <span class="jc-muted">{{ c.runningQueries }} queries running</span>
285
+ </div>
286
+ <div class="jc-list-row">
287
+ <span class="jc-badge" [class]="cls(c.insertLevel)">inserts</span>
288
+ <span>p95 {{ ms(c.insertP95Seconds) }}</span>
289
+ <span class="jc-muted">{{ c.insertsInFlight === null ? '—' : c.insertsInFlight.toFixed(1) }} in flight</span>
290
+ </div>
291
+ @for (r of c.reads.slice(0, 6); track r.name) {
292
+ <div class="jc-list-row">
293
+ <span class="jc-badge" [class]="cls(r.level)">p95 {{ ms(r.p95Seconds) }}</span>
294
+ <span>{{ r.name }}</span><span class="jc-muted">{{ r.count }} in the last minute</span>
295
+ </div>
296
+ }
297
+ } @else { <p class="jc-muted">No figures: ClickHouse isn't sampled (ClickHouse:MonitorConnectionString), or didn't answer.</p> }
298
+
299
+ <h3>Disk</h3>
300
+ @if (o.disk; as d) {
301
+ <div class="jc-list-row">
302
+ <span class="jc-badge" [class]="cls(d.level)">{{ d.daysUntilFull !== null ? days(d.daysUntilFull) + ' until full' : d.bytesPerDay === null ? 'no estimate yet' : d.bytesPerDay > 0 ? 'fits at retention' : 'not growing' }}</span>
303
+ <span>{{ bytes(d.used) }} used, {{ bytes(d.free) }} free</span>
304
+ </div>
305
+ <div class="jc-list-row">
306
+ <span>{{ bytes(d.bytesPerDay) }} a day@if (d.estimated) { <span class="jc-muted"> (estimated from today)</span> }</span>
307
+ <span class="jc-muted">at retention: {{ bytes(d.needAtRetention) }} of {{ bytes(d.total) }}</span>
308
+ </div>
309
+ } @else { <p class="jc-muted">No figures.</p> }
310
+ </div>
311
+ </div>
312
+
313
+ <h3>Capacity</h3>
314
+ <p class="jc-muted">{{ o.capacity.label }}</p>
315
+ <div class="jc-list-row">
316
+ @for (l of o.capacity.load; track l.signal) {
317
+ <span>{{ l.signal }} <strong>{{ l.multiple === null ? '—' : l.multiple.toFixed(1) + '×' }}</strong>
318
+ <span class="jc-muted">({{ rate(l.perSecond) }} of {{ rate(l.reference) }} at 1×)</span></span>
319
+ }
320
+ </div>
321
+ @if (o.capacity.calibrated) {
322
+ <p>Held every line to <strong>{{ o.capacity.heldTo }}×</strong>; crossed one by {{ o.capacity.crossedAt }}×
323
+ @if (o.capacity.crossed.length) { <span class="jc-muted">({{ o.capacity.crossed.join('; ') }})</span> }.
324
+ @if (o.capacity.headroom !== null) { Today's load is {{ (1 / o.capacity.headroom * 100).toFixed(0) }} % of what held. }</p>
325
+ }
326
+ <div class="jc-list-row jc-muted">
327
+ Now: {{ o.capacity.mix.rules ?? '—' }} rules, {{ o.capacity.mix.slos ?? '—' }} SLOs, {{ o.capacity.mix.services ?? '—' }} services
328
+ @if (o.capacity.mix.calibratedRules !== null) {
329
+ · calibrated with {{ o.capacity.mix.calibratedRules }} rules, {{ o.capacity.mix.calibratedSlos }} SLOs, {{ o.capacity.mix.calibratedServices }} services
330
+ and {{ o.capacity.mix.calibratedSearchesPerSecond }} searches a second
331
+ }
332
+ </div>
333
+ <table class="jc-table">
334
+ <thead><tr><th>Resource</th><th>Now</th>@if (o.capacity.calibrated) { <th>Where every line held ({{ o.capacity.heldTo }}×)</th><th>Where one crossed ({{ o.capacity.crossedAt }}×)</th> }</tr></thead>
335
+ <tbody>
336
+ @for (r of o.capacity.resources; track r.name) {
337
+ <tr>
338
+ <td>{{ resource(r.name) }}</td>
339
+ <td><span class="jc-badge" [class]="cls(r.level)">{{ measure(r.now, r.unit) }}</span></td>
340
+ @if (o.capacity.calibrated) { <td>{{ measure(r.atHeld, r.unit) }}</td><td>{{ measure(r.atCrossed, r.unit) }}</td> }
341
+ </tr>
342
+ }
343
+ </tbody>
344
+ </table>
345
+ }
346
+ </section>
347
+ }`
348
+ }]
349
+ }]
350
+ });
351
+ const ORDER = [
352
+ "Critical",
353
+ "Unhealthy",
354
+ "Degraded",
355
+ "Offline",
356
+ "Unknown",
357
+ "Healthy"
358
+ ];
359
+ const SHOWN = 10;
360
+ var OverviewPage = class OverviewPage {
361
+ ctx = inject(ContextService);
362
+ api = inject(ApiService);
363
+ order = ORDER;
364
+ shown = SHOWN;
365
+ reasonPipe = new ReasonPipe();
366
+ reason = (r) => this.reasonPipe.transform(r);
367
+ health = apiResource({
368
+ params: () => this.ctx.environment(),
369
+ stream: ({ params }) => this.api.health({
370
+ subjectType: "service",
371
+ environment: params
372
+ }).pipe(map((p) => p.items))
373
+ });
374
+ alerts = apiResource({
375
+ params: () => this.ctx.environment(),
376
+ stream: ({ params }) => this.api.allAlerts({
377
+ state: "firing",
378
+ environment: params
379
+ }).pipe(map((p) => p.items))
380
+ });
381
+ error = computed(() => problemText(this.health.error()), ...ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []);
382
+ firing = computed(() => [...this.alerts.value() ?? []].sort((a, b) => Number(b.severity === "Critical") - Number(a.severity === "Critical") || (b.firedAt ?? "").localeCompare(a.firedAt ?? "")), ...ngDevMode ? [{ debugName: "firing" }] : /* istanbul ignore next */ []);
383
+ firingShown = computed(() => this.firing().slice(0, SHOWN), ...ngDevMode ? [{ debugName: "firingShown" }] : /* istanbul ignore next */ []);
384
+ criticalCount = computed(() => this.firing().filter((a) => a.severity === "Critical").length, ...ngDevMode ? [{ debugName: "criticalCount" }] : /* istanbul ignore next */ []);
385
+ counts = computed(() => {
386
+ const counts = {};
387
+ for (const h of this.health.value() ?? []) counts[h.state] = (counts[h.state] ?? 0) + 1;
388
+ return counts;
389
+ }, ...ngDevMode ? [{ debugName: "counts" }] : /* istanbul ignore next */ []);
390
+ attention = computed(() => (this.health.value() ?? []).filter((h) => h.state !== "Healthy").sort((a, b) => ORDER.indexOf(a.state) - ORDER.indexOf(b.state)), ...ngDevMode ? [{ debugName: "attention" }] : /* istanbul ignore next */ []);
391
+ static ɵfac = i0.ɵɵngDeclareFactory({
392
+ minVersion: "12.0.0",
393
+ version: "22.2.4",
394
+ ngImport: i0,
395
+ type: OverviewPage,
396
+ deps: [],
397
+ target: i0.ɵɵFactoryTarget.Component
398
+ });
399
+ static ɵcmp = i0.ɵɵngDeclareComponent({
400
+ minVersion: "17.0.0",
401
+ version: "22.2.4",
402
+ type: OverviewPage,
403
+ isStandalone: true,
404
+ selector: "ng-component",
405
+ ngImport: i0,
406
+ template: `
407
+ <jc-context-bar><h1>Overview</h1></jc-context-bar>
408
+ @if (health.isLoading() || alerts.isLoading()) { <mat-progress-bar mode="indeterminate" /> }
409
+ @if (health.error()) { <p class="jc-error">{{ error() }}</p> }
410
+
411
+ <div class="jc-tiles">
412
+ @for (s of order; track s) {
413
+ <a class="jc-card jc-tile" [routerLink]="['services'] | jcLink" [queryParams]="ctx.keep({ state: s })">
414
+ <jc-health [state]="s" /><strong>{{ counts()[s] ?? 0 }}</strong><span class="jc-muted">services</span>
415
+ </a>
416
+ }
417
+ </div>
418
+
419
+ <section class="jc-card">
420
+ <div class="jc-row">
421
+ <h2>Firing alerts @if (firing().length) { <span class="jc-muted">({{ firing().length }}@if (criticalCount()) { · {{ criticalCount() }} critical})</span> }</h2>
422
+ @if (firing().length) { <a [routerLink]="['alerts'] | jcLink" [queryParams]="ctx.keep({ state: 'firing' })">All firing alerts</a> }
423
+ </div>
424
+ @for (a of firingShown(); track a.id) {
425
+ <div class="jc-list-row">
426
+ <span class="jc-badge" [class.jc-health-unhealthy]="a.severity === 'Critical'" [class.jc-health-degraded]="a.severity !== 'Critical'">{{ a.severity }}</span>
427
+ <a [routerLink]="['alerts', a.id] | jcLink" [queryParams]="ctx.keep()">{{ a.rule }}</a>
428
+ <span>{{ a.subjectKey }}</span>
429
+ <span class="jc-muted">fired {{ a.firedAt | ago }}@if (a.acknowledgedBy) { · acknowledged by {{ a.acknowledgedBy }} }</span>
430
+ </div>
431
+ } @empty { <p class="jc-muted">Nothing firing.</p> }
432
+ @if (firing().length > shown) {
433
+ <p class="jc-more"><span class="jc-muted">Critical first, then the newest; {{ firing().length - shown }} more.</span>
434
+ <a [routerLink]="['alerts'] | jcLink" [queryParams]="ctx.keep({ state: 'firing' })">See all {{ firing().length }}</a></p>
435
+ }
436
+ </section>
437
+
438
+ <section class="jc-card">
439
+ <h2>Services needing attention @if (attention().length) { <span class="jc-muted">({{ attention().length }})</span> }</h2>
440
+ @for (h of attention().slice(0, shown); track h.subjectId + h.environment) {
441
+ <div class="jc-list-row">
442
+ <jc-health [state]="h.state" [stale]="h.stale" />
443
+ <a [routerLink]="['services', h.subjectId] | jcLink" [queryParams]="ctx.keep({ env: h.environment })">{{ h.subjectName }}</a>
444
+ <span class="jc-muted">{{ h.environment }}</span>
445
+ <span>{{ h.reasons.slice(0, 3).map(reason).join(' · ') }}</span>
446
+ <span class="jc-muted">since {{ h.since | ago }}</span>
447
+ </div>
448
+ } @empty { <p class="jc-muted">Every evaluated service is healthy.</p> }
449
+ @if (attention().length > shown) {
450
+ <p class="jc-more"><span class="jc-muted">The worst first; {{ attention().length - shown }} more. The counts above open each state's list:</span>
451
+ @for (s of order; track s) { @if (s !== 'Healthy' && counts()[s]) {
452
+ <a [routerLink]="['services'] | jcLink" [queryParams]="ctx.keep({ state: s })">{{ counts()[s] }} {{ s.toLowerCase() }}</a>
453
+ } }</p>
454
+ }
455
+ </section>
456
+
457
+ <jc-platform-panel />`,
458
+ isInline: true,
459
+ dependencies: [
460
+ {
461
+ kind: "directive",
462
+ type: RouterLink,
463
+ selector: "[routerLink]",
464
+ inputs: [
465
+ "target",
466
+ "queryParams",
467
+ "fragment",
468
+ "queryParamsHandling",
469
+ "state",
470
+ "info",
471
+ "relativeTo",
472
+ "preserveFragment",
473
+ "skipLocationChange",
474
+ "replaceUrl",
475
+ "browserUrl",
476
+ "routerLink"
477
+ ]
478
+ },
479
+ {
480
+ kind: "ngmodule",
481
+ type: MatProgressBarModule
482
+ },
483
+ {
484
+ kind: "component",
485
+ type: i1.MatProgressBar,
486
+ selector: "mat-progress-bar",
487
+ inputs: [
488
+ "color",
489
+ "value",
490
+ "bufferValue",
491
+ "mode"
492
+ ],
493
+ outputs: ["animationEnd"],
494
+ exportAs: ["matProgressBar"]
495
+ },
496
+ {
497
+ kind: "component",
498
+ type: ContextBar,
499
+ selector: "jc-context-bar"
500
+ },
501
+ {
502
+ kind: "component",
503
+ type: HealthBadge,
504
+ selector: "jc-health",
505
+ inputs: ["state", "stale"]
506
+ },
507
+ {
508
+ kind: "component",
509
+ type: PlatformPanel,
510
+ selector: "jc-platform-panel"
511
+ },
512
+ {
513
+ kind: "pipe",
514
+ type: LinkPipe,
515
+ name: "jcLink"
516
+ },
517
+ {
518
+ kind: "pipe",
519
+ type: AgoPipe,
520
+ name: "ago"
521
+ }
522
+ ],
523
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
524
+ });
525
+ };
526
+ i0.ɵɵngDeclareClassMetadata({
527
+ minVersion: "12.0.0",
528
+ version: "22.2.4",
529
+ ngImport: i0,
530
+ type: OverviewPage,
531
+ decorators: [{
532
+ type: Component,
533
+ args: [{
534
+ changeDetection: ChangeDetectionStrategy.OnPush,
535
+ imports: [
536
+ LinkPipe,
537
+ RouterLink,
538
+ MatProgressBarModule,
539
+ ContextBar,
540
+ HealthBadge,
541
+ AgoPipe,
542
+ PlatformPanel
543
+ ],
544
+ template: `
545
+ <jc-context-bar><h1>Overview</h1></jc-context-bar>
546
+ @if (health.isLoading() || alerts.isLoading()) { <mat-progress-bar mode="indeterminate" /> }
547
+ @if (health.error()) { <p class="jc-error">{{ error() }}</p> }
548
+
549
+ <div class="jc-tiles">
550
+ @for (s of order; track s) {
551
+ <a class="jc-card jc-tile" [routerLink]="['services'] | jcLink" [queryParams]="ctx.keep({ state: s })">
552
+ <jc-health [state]="s" /><strong>{{ counts()[s] ?? 0 }}</strong><span class="jc-muted">services</span>
553
+ </a>
554
+ }
555
+ </div>
556
+
557
+ <section class="jc-card">
558
+ <div class="jc-row">
559
+ <h2>Firing alerts @if (firing().length) { <span class="jc-muted">({{ firing().length }}@if (criticalCount()) { · {{ criticalCount() }} critical})</span> }</h2>
560
+ @if (firing().length) { <a [routerLink]="['alerts'] | jcLink" [queryParams]="ctx.keep({ state: 'firing' })">All firing alerts</a> }
561
+ </div>
562
+ @for (a of firingShown(); track a.id) {
563
+ <div class="jc-list-row">
564
+ <span class="jc-badge" [class.jc-health-unhealthy]="a.severity === 'Critical'" [class.jc-health-degraded]="a.severity !== 'Critical'">{{ a.severity }}</span>
565
+ <a [routerLink]="['alerts', a.id] | jcLink" [queryParams]="ctx.keep()">{{ a.rule }}</a>
566
+ <span>{{ a.subjectKey }}</span>
567
+ <span class="jc-muted">fired {{ a.firedAt | ago }}@if (a.acknowledgedBy) { · acknowledged by {{ a.acknowledgedBy }} }</span>
568
+ </div>
569
+ } @empty { <p class="jc-muted">Nothing firing.</p> }
570
+ @if (firing().length > shown) {
571
+ <p class="jc-more"><span class="jc-muted">Critical first, then the newest; {{ firing().length - shown }} more.</span>
572
+ <a [routerLink]="['alerts'] | jcLink" [queryParams]="ctx.keep({ state: 'firing' })">See all {{ firing().length }}</a></p>
573
+ }
574
+ </section>
575
+
576
+ <section class="jc-card">
577
+ <h2>Services needing attention @if (attention().length) { <span class="jc-muted">({{ attention().length }})</span> }</h2>
578
+ @for (h of attention().slice(0, shown); track h.subjectId + h.environment) {
579
+ <div class="jc-list-row">
580
+ <jc-health [state]="h.state" [stale]="h.stale" />
581
+ <a [routerLink]="['services', h.subjectId] | jcLink" [queryParams]="ctx.keep({ env: h.environment })">{{ h.subjectName }}</a>
582
+ <span class="jc-muted">{{ h.environment }}</span>
583
+ <span>{{ h.reasons.slice(0, 3).map(reason).join(' · ') }}</span>
584
+ <span class="jc-muted">since {{ h.since | ago }}</span>
585
+ </div>
586
+ } @empty { <p class="jc-muted">Every evaluated service is healthy.</p> }
587
+ @if (attention().length > shown) {
588
+ <p class="jc-more"><span class="jc-muted">The worst first; {{ attention().length - shown }} more. The counts above open each state's list:</span>
589
+ @for (s of order; track s) { @if (s !== 'Healthy' && counts()[s]) {
590
+ <a [routerLink]="['services'] | jcLink" [queryParams]="ctx.keep({ state: s })">{{ counts()[s] }} {{ s.toLowerCase() }}</a>
591
+ } }</p>
592
+ }
593
+ </section>
594
+
595
+ <jc-platform-panel />`
596
+ }]
597
+ }]
598
+ });
599
+ export { OverviewPage };
600
+
601
+ //# sourceMappingURL=juice-js-observability-overview.page-g4Cv_Y5c.mjs.map