@juice-js/observability 1.3.1-alpha.42 → 1.4.0-alpha.44
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/README.md +10 -0
- package/fesm2022/{juice-js-observability-agent.page-BJ0R-pGG.mjs → juice-js-observability-agent.page-DE84_XZr.mjs} +3 -3
- package/fesm2022/{juice-js-observability-agent.page-BJ0R-pGG.mjs.map → juice-js-observability-agent.page-DE84_XZr.mjs.map} +1 -1
- package/fesm2022/{juice-js-observability-agents.page-D-z66p2m.mjs → juice-js-observability-agents.page-C-o-OXai.mjs} +3 -3
- package/fesm2022/{juice-js-observability-agents.page-D-z66p2m.mjs.map → juice-js-observability-agents.page-C-o-OXai.mjs.map} +1 -1
- package/fesm2022/{juice-js-observability-alert.page-DhcSGLH0.mjs → juice-js-observability-alert.page-KyakwaUL.mjs} +4 -4
- package/fesm2022/{juice-js-observability-alert.page-DhcSGLH0.mjs.map → juice-js-observability-alert.page-KyakwaUL.mjs.map} +1 -1
- package/fesm2022/{juice-js-observability-alerts.page-B0ZpGPk9.mjs → juice-js-observability-alerts.page-up57Y8fX.mjs} +2 -2
- package/fesm2022/{juice-js-observability-alerts.page-B0ZpGPk9.mjs.map → juice-js-observability-alerts.page-up57Y8fX.mjs.map} +1 -1
- package/fesm2022/{juice-js-observability-approvals.page-l5mwxlcl.mjs → juice-js-observability-approvals.page-BgHDUGd4.mjs} +3 -3
- package/fesm2022/{juice-js-observability-approvals.page-l5mwxlcl.mjs.map → juice-js-observability-approvals.page-BgHDUGd4.mjs.map} +1 -1
- package/fesm2022/{juice-js-observability-incident.page-DyT-D0XB.mjs → juice-js-observability-incident.page-BryX9L8h.mjs} +4 -4
- package/fesm2022/{juice-js-observability-incident.page-DyT-D0XB.mjs.map → juice-js-observability-incident.page-BryX9L8h.mjs.map} +1 -1
- package/fesm2022/{juice-js-observability-incidents.page-AK09qCjN.mjs → juice-js-observability-incidents.page-B4DbQAWr.mjs} +3 -3
- package/fesm2022/{juice-js-observability-incidents.page-AK09qCjN.mjs.map → juice-js-observability-incidents.page-B4DbQAWr.mjs.map} +1 -1
- package/fesm2022/{juice-js-observability-load-runs.page-CGCfrsZj.mjs → juice-js-observability-load-runs.page-UPQFzG3h.mjs} +2 -2
- package/fesm2022/{juice-js-observability-load-runs.page-CGCfrsZj.mjs.map → juice-js-observability-load-runs.page-UPQFzG3h.mjs.map} +1 -1
- package/fesm2022/{juice-js-observability-logs.page-DZiAYl0A.mjs → juice-js-observability-logs.page-DtCoZuZg.mjs} +2 -2
- package/fesm2022/{juice-js-observability-logs.page-DZiAYl0A.mjs.map → juice-js-observability-logs.page-DtCoZuZg.mjs.map} +1 -1
- package/fesm2022/{juice-js-observability-metrics.page-DY8SFoxp.mjs → juice-js-observability-metrics.page-By3pnaJz.mjs} +2 -2
- package/fesm2022/{juice-js-observability-metrics.page-DY8SFoxp.mjs.map → juice-js-observability-metrics.page-By3pnaJz.mjs.map} +1 -1
- package/fesm2022/{juice-js-observability-notifications.page-COeOVY1T.mjs → juice-js-observability-notifications.page-DIXE52Rt.mjs} +3 -3
- package/fesm2022/{juice-js-observability-notifications.page-COeOVY1T.mjs.map → juice-js-observability-notifications.page-DIXE52Rt.mjs.map} +1 -1
- package/fesm2022/{juice-js-observability-overview.page-CUJFOlnm.mjs → juice-js-observability-overview.page-CdSUNH6a.mjs} +3 -3
- package/fesm2022/{juice-js-observability-overview.page-CUJFOlnm.mjs.map → juice-js-observability-overview.page-CdSUNH6a.mjs.map} +1 -1
- package/fesm2022/{juice-js-observability-resource.page-BrLwpTXN.mjs → juice-js-observability-resource.page-CIY0hWSX.mjs} +2 -2
- package/fesm2022/{juice-js-observability-resource.page-BrLwpTXN.mjs.map → juice-js-observability-resource.page-CIY0hWSX.mjs.map} +1 -1
- package/fesm2022/{juice-js-observability-resources.page-Dyh7AjOW.mjs → juice-js-observability-resources.page-Ch6GVPyx.mjs} +2 -2
- package/fesm2022/{juice-js-observability-resources.page-Dyh7AjOW.mjs.map → juice-js-observability-resources.page-Ch6GVPyx.mjs.map} +1 -1
- package/fesm2022/{juice-js-observability-rules.page-C_qiLXN_.mjs → juice-js-observability-rules.page-AbY-0A8n.mjs} +2 -2
- package/fesm2022/{juice-js-observability-rules.page-C_qiLXN_.mjs.map → juice-js-observability-rules.page-AbY-0A8n.mjs.map} +1 -1
- package/fesm2022/{juice-js-observability-service.page-AxzRoXqg.mjs → juice-js-observability-service.page-BAUPza0x.mjs} +2 -2
- package/fesm2022/{juice-js-observability-service.page-AxzRoXqg.mjs.map → juice-js-observability-service.page-BAUPza0x.mjs.map} +1 -1
- package/fesm2022/{juice-js-observability-services.page-CpEdbC2L.mjs → juice-js-observability-services.page-CBtxLm0R.mjs} +2 -2
- package/fesm2022/{juice-js-observability-services.page-CpEdbC2L.mjs.map → juice-js-observability-services.page-CBtxLm0R.mjs.map} +1 -1
- package/fesm2022/{juice-js-observability-silences.page-DI4q9Fx-.mjs → juice-js-observability-silences.page-WxGogpDD.mjs} +2 -2
- package/fesm2022/{juice-js-observability-silences.page-DI4q9Fx-.mjs.map → juice-js-observability-silences.page-WxGogpDD.mjs.map} +1 -1
- package/fesm2022/{juice-js-observability-slo.page-CAdDtj28.mjs → juice-js-observability-slo.page-BRigA4Ss.mjs} +4 -4
- package/fesm2022/{juice-js-observability-slo.page-CAdDtj28.mjs.map → juice-js-observability-slo.page-BRigA4Ss.mjs.map} +1 -1
- package/fesm2022/{juice-js-observability-slos.page-CQRX3Kmn.mjs → juice-js-observability-slos.page-DVg2gK4Y.mjs} +3 -3
- package/fesm2022/{juice-js-observability-slos.page-CQRX3Kmn.mjs.map → juice-js-observability-slos.page-DVg2gK4Y.mjs.map} +1 -1
- package/fesm2022/{juice-js-observability-suggestions-CX_srxh1.mjs → juice-js-observability-suggestions-CBuNlU0Y.mjs} +3 -3
- package/fesm2022/{juice-js-observability-suggestions-CX_srxh1.mjs.map → juice-js-observability-suggestions-CBuNlU0Y.mjs.map} +1 -1
- package/fesm2022/{juice-js-observability-telemetry-CwdIXE9m.mjs → juice-js-observability-telemetry-CaunxC3Y.mjs} +2 -2
- package/fesm2022/{juice-js-observability-telemetry-CwdIXE9m.mjs.map → juice-js-observability-telemetry-CaunxC3Y.mjs.map} +1 -1
- package/fesm2022/{juice-js-observability-timeline.page-dH4NzP4l.mjs → juice-js-observability-timeline.page-ChDtTC3b.mjs} +3 -3
- package/fesm2022/{juice-js-observability-timeline.page-dH4NzP4l.mjs.map → juice-js-observability-timeline.page-ChDtTC3b.mjs.map} +1 -1
- package/fesm2022/{juice-js-observability-topology.page-IJrW71aU.mjs → juice-js-observability-topology.page-BN5NL2st.mjs} +2 -2
- package/fesm2022/{juice-js-observability-topology.page-IJrW71aU.mjs.map → juice-js-observability-topology.page-BN5NL2st.mjs.map} +1 -1
- package/fesm2022/{juice-js-observability-trace.page-Bp8ZBzEh.mjs → juice-js-observability-trace.page-CtJQZkNW.mjs} +3 -3
- package/fesm2022/{juice-js-observability-trace.page-Bp8ZBzEh.mjs.map → juice-js-observability-trace.page-CtJQZkNW.mjs.map} +1 -1
- package/fesm2022/{juice-js-observability-traces.page-CPcODdxw.mjs → juice-js-observability-traces.page-BkGlHFEK.mjs} +2 -2
- package/fesm2022/{juice-js-observability-traces.page-CPcODdxw.mjs.map → juice-js-observability-traces.page-BkGlHFEK.mjs.map} +1 -1
- package/fesm2022/juice-js-observability.mjs +120 -129
- package/fesm2022/juice-js-observability.mjs.map +1 -1
- package/package.json +3 -3
- package/types/juice-js-observability.d.ts +14 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"juice-js-observability-trace.page-Bp8ZBzEh.mjs","names":[],"sources":["../../../../projects/juice-js/observability/src/lib/pages/trace.page.ts"],"sourcesContent":["import { LinkPipe, ObservabilityLinks } from '../core/options';\nimport { ChangeDetectionStrategy, Component, computed, inject, input, signal } from '@angular/core';\nimport { apiResource } from '../shared/resource';\nimport { DatePipe } from '@angular/common';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatProgressBarModule } from '@angular/material/progress-bar';\nimport { Router, RouterLink } from '@angular/router';\nimport { ApiService } from '../core/api.service';\nimport { ContextService } from '../core/context.service';\nimport { Span } from '../core/models';\nimport { DurationPipe, formatDuration, plainTraceId, preciseTime } from '../shared/format';\nimport { ContextBar, KeyValueTable } from '../shared/ui';\nimport { InstanceMetric, LogTable, problemText } from '../shared/telemetry';\nimport { themeColor } from '../shared/theme';\n\ninterface Row { span: Span; depth: number; children: number; offset: number; selfError: boolean; slowest: boolean; }\n\nconst MaxUsageInstances = 8;\nconst UsageMarginMs = 2 * 60_000;\n\n/**\n * .NET's built-in System.Runtime meter (.NET 9+). Counters arrive as a rate per second. The thread pool's queue length is\n * a level that .NET reports as a counter.\n */\nconst UsageMetrics = [\n { title: 'CPU', name: 'dotnet.process.cpu.time', level: false, format: (v: number) => `${Math.round(v * 100)} % of a core` },\n { title: 'Memory', name: 'dotnet.process.memory.working_set', level: false, format: (v: number) => `${Math.round(v / 1048576)} MiB` },\n { title: 'GC pause', name: 'dotnet.gc.pause.time', level: false, format: (v: number) => `${Math.round(v * 10000) / 10} ms/s` },\n { title: 'Thread pool queue', name: 'dotnet.thread_pool.queue.length', level: true, format: (v: number) => String(Math.round(v * 10) / 10) },\n];\n\n/** A stable colour per service, from a small palette that reads in both themes. */\n\n/**\n * A trace as a waterfall (Console requirements §6): the span hierarchy with timing relative to the trace start, so\n * parallel calls show side by side; errors and the slowest spans marked; subtrees collapsible. The selected span is\n * in the URL (`span`), with its details, its logs, and links to its service, its dependency, and the metrics and logs\n * around it (§7).\n */\n@Component({\n changeDetection: ChangeDetectionStrategy.OnPush,\n // Fills the window; the waterfall and the span scroll on their own (styles.scss).\n host: { class: 'jc-fill-page' },\n imports: [LinkPipe, RouterLink, DatePipe, MatButtonModule, MatIconModule, MatProgressBarModule, ContextBar, KeyValueTable, LogTable, DurationPipe, InstanceMetric],\n template: `\n <jc-context-bar>\n <a [routerLink]=\"['traces'] | jcLink\" [queryParams]=\"ctx.keep()\" class=\"jc-crumb\">Traces</a>\n <span class=\"jc-crumb-sep\">›</span>\n <h1 class=\"jc-mono\">{{ id() }}</h1>\n </jc-context-bar>\n @if (trace.isLoading()) { <mat-progress-bar mode=\"indeterminate\" /> }\n @if (trace.error()) { <p class=\"jc-error\">{{ error() }}</p> }\n\n @if (trace.value(); as t) {\n <div class=\"jc-summary\">\n <span><strong>{{ root()?.service }}</strong> · {{ root()?.name }}</span>\n <span>{{ start() | date: 'MMM d, HH:mm:ss.SSS' }}</span>\n <span>{{ total() | duration }}</span>\n <span>{{ t.spans.length }} spans · {{ services().length }} services</span>\n @if (errors() > 0) { <span class=\"jc-badge jc-health-unhealthy\">{{ errors() }} failed</span> }\n <button mat-button (click)=\"showErrorsOnly.set(!showErrorsOnly())\">{{ showErrorsOnly() ? 'Show all spans' : 'Error paths only' }}</button>\n <a mat-button [routerLink]=\"['logs'] | jcLink\" [queryParams]=\"ctx.keep({ trace: id() })\">Logs of this trace</a>\n <button mat-button [attr.aria-expanded]=\"showUsage()\" (click)=\"toggleUsage()\">Resource usage</button>\n @if (auditLink(); as link) {\n @if ('route' in link) { <a mat-button [routerLink]=\"link.route\" data-testid=\"audit-link\">Audit records ↗</a> }\n @else { <a mat-button [href]=\"link.href\" target=\"_blank\" rel=\"noopener\" data-testid=\"audit-link\">Audit records ↗</a> }\n }\n @if (t.truncated) { <span class=\"jc-muted\">Showing the first {{ t.spans.length }} spans.</span> }\n </div>\n <div class=\"jc-legend\">@for (s of services(); track s) { <span><i [style.background]=\"color(s)\"></i>{{ s }}</span> }</div>\n\n @if (showUsage()) {\n <section class=\"jc-card jc-trace-usage\" aria-label=\"Resource usage\">\n @for (i of instances(); track i.id) {\n <h3>{{ i.service }} · {{ i.name }}</h3>\n <div class=\"jc-usage-charts\">\n @for (m of usageMetrics; track m.name) {\n <jc-instance-metric [title]=\"m.title\" [name]=\"m.name\" [format]=\"m.format\" [level]=\"m.level\" [instanceId]=\"i.id\"\n [from]=\"usageWindow().from\" [to]=\"usageWindow().to\" [marks]=\"usageMarks()\" />\n }\n </div>\n } @empty {\n <p class=\"jc-muted\">The spans of this trace name no known instance.</p>\n }\n @if (hiddenInstances() > 0) { <p class=\"jc-muted\">And {{ hiddenInstances() }} more instances.</p> }\n <p class=\"jc-muted jc-small\">Dashed lines mark the trace. No data: the host does not collect the <code>System.Runtime</code> meter.</p>\n </section>\n }\n\n <div class=\"jc-trace\" [class.jc-with-detail]=\"selected()\">\n <div class=\"jc-waterfall\" role=\"tree\">\n <div class=\"jc-wf-head\"><span>Span</span><span class=\"jc-wf-scale\">\n @for (tick of ticks(); track tick.at) { <span [style.left.%]=\"tick.at\">{{ tick.label }}</span> }</span></div>\n @for (r of visible(); track r.span.spanId) {\n <div class=\"jc-wf-row\" role=\"treeitem\" [class.jc-selected]=\"r.span.spanId === selectedId()\"\n [class.jc-wf-error]=\"r.selfError\" (click)=\"select(r.span.spanId)\" tabindex=\"0\" (keydown.enter)=\"select(r.span.spanId)\">\n <span class=\"jc-wf-name\" [style.padding-left.px]=\"r.depth * 14\">\n @if (r.children > 0) {\n <button class=\"jc-wf-toggle\" (click)=\"toggle(r.span.spanId, $event)\" [attr.aria-label]=\"collapsed().has(r.span.spanId) ? 'Expand' : 'Collapse'\">\n {{ collapsed().has(r.span.spanId) ? '▸' : '▾' }}</button>\n } @else { <span class=\"jc-wf-toggle\"></span> }\n <i class=\"jc-dot\" [style.background]=\"color(r.span.service)\"></i>\n <span class=\"jc-wf-service\">{{ r.span.service }}</span> <span>{{ r.span.name }}</span>\n @if (r.selfError) { <mat-icon class=\"jc-wf-icon jc-bad\" title=\"Failed\">error</mat-icon> }\n @if (r.slowest) { <mat-icon class=\"jc-wf-icon\" title=\"Among the slowest spans\">schedule</mat-icon> }\n @if (collapsed().has(r.span.spanId)) { <span class=\"jc-muted jc-small\">+{{ r.children }}</span> }\n </span>\n <span class=\"jc-wf-track\">\n <span class=\"jc-wf-bar\" [style.left.%]=\"r.offset\" [style.width.%]=\"width(r.span)\" [style.background]=\"color(r.span.service)\"></span>\n <span class=\"jc-wf-time\" [style.left.%]=\"r.offset\">{{ r.span.durationMs | duration }}</span>\n </span>\n </div>\n }\n </div>\n\n @if (selected(); as s) {\n <aside class=\"jc-card jc-span-detail\">\n <div class=\"jc-row\"><h2>{{ s.name }}</h2><button mat-icon-button (click)=\"select(null)\" aria-label=\"Close\"><mat-icon>close</mat-icon></button></div>\n <div class=\"jc-span-facts\">\n <span class=\"jc-badge\" [class.jc-health-unhealthy]=\"s.status === 'Error'\" [class.jc-health-healthy]=\"s.status === 'Ok'\">{{ s.status }}</span>\n <span>{{ s.kind }}</span><span>{{ s.durationMs | duration }}</span>\n <span>at +{{ offsetMs(s) | duration }}</span>\n </div>\n @if (s.statusMessage) { <p class=\"jc-error\">{{ s.statusMessage }}</p> }\n\n <nav class=\"jc-actions\">\n @if (s.serviceId) { <a mat-stroked-button [routerLink]=\"['services', s.serviceId] | jcLink\" [queryParams]=\"ctx.keep()\" [title]=\"'Service ' + s.service\">Service {{ s.service }}</a> }\n @if (s.target; as target) {\n <a mat-stroked-button [routerLink]=\"(target.kind === 'service' ? ['services', target.id] : ['resources', target.id]) | jcLink\" [queryParams]=\"ctx.keep()\"\n [title]=\"(target.kind === 'service' ? 'Calls ' : 'Uses ') + target.name\">\n {{ target.kind === 'service' ? 'Calls' : 'Uses' }} {{ target.name }}</a>\n }\n @if (s.serviceId) {\n <a mat-stroked-button [routerLink]=\"['services', s.serviceId] | jcLink\" [queryParams]=\"aroundSpan(s, { tab: 'metrics' })\">Metrics around</a>\n <a mat-stroked-button [routerLink]=\"['services', s.serviceId] | jcLink\" [queryParams]=\"aroundSpan(s, { tab: 'logs' })\">Service logs around</a>\n <a mat-stroked-button [routerLink]=\"['services', s.serviceId] | jcLink\" [queryParams]=\"ctx.keep({ tab: 'traces', op: s.name })\" [title]=\"'Other traces of ' + s.name\">Other traces of {{ s.name }}</a>\n }\n </nav>\n\n <h3>Logs of this span</h3>\n <jc-log-table [query]=\"spanLogQuery()\" [compact]=\"true\" />\n\n <h3>Span</h3>\n <jc-kv [values]=\"{ 'service': s.service, 'environment': s.environment, 'instance': s.instance, 'host': s.host,\n 'trace id': id(), 'span id': s.spanId, 'parent span id': s.parentSpanId, 'started': s.startedAt,\n 'instrumentation scope': s.scope ? s.scope + (s.scopeVersion ? ' ' + s.scopeVersion : '') : null }\" />\n <h3>Attributes</h3>\n <jc-kv [values]=\"s.attributes\" empty=\"No attributes.\" />\n @if (s.events.length) {\n <h3>Events</h3>\n @for (e of s.events; track $index) {\n <div class=\"jc-event\" [class.jc-wf-error]=\"e.name === 'exception'\">\n <strong>{{ e.name }}</strong> <span class=\"jc-muted\">+{{ eventOffset(s, e.at) | duration }}</span>\n <jc-kv [values]=\"e.attributes\" empty=\"\" />\n </div>\n }\n }\n @if (s.links.length) {\n <h3>Links</h3>\n @for (l of s.links; track l.spanId) {\n <a [routerLink]=\"['traces', l.traceId] | jcLink\" [queryParams]=\"ctx.keep({ span: l.spanId })\" class=\"jc-mono\">{{ l.traceId }} / {{ l.spanId }}</a>\n }\n }\n </aside>\n }\n </div>\n }`,\n})\nexport class TracePage {\n protected readonly ctx = inject(ContextService);\n private readonly api = inject(ApiService);\n private readonly router = inject(Router);\n private readonly links = inject(ObservabilityLinks);\n\n /** A trace id, or a W3C traceparent such as a Juice.Audit record before 10.4 holds; links from either open the trace. */\n readonly traceId = input.required<string>();\n readonly span = input<string>();\n /** 'on' shows the resource usage strip; in the URL so a shared link keeps it. */\n readonly usage = input<string>();\n\n protected readonly id = computed(() => plainTraceId(this.traceId()));\n protected readonly trace = apiResource({ params: () => this.id(), stream: ({ params }) => this.api.trace(params) });\n protected readonly error = computed(() => problemText(this.trace.error()));\n /** The host's audit records of this trace (`auditLink`): the requests it served and the data they changed. */\n protected readonly auditLink = computed(() => this.links.audit(this.id()));\n protected readonly collapsed = signal(new Set<string>());\n protected readonly showErrorsOnly = signal(false);\n protected readonly selectedId = computed(() => this.span() ?? null);\n\n private readonly spans = computed(() => this.trace.value()?.spans ?? []);\n // Sub-millisecond precision: spans of a fast in-process flow start microseconds apart.\n protected readonly start = computed(() => Math.min(...this.spans().map(s => preciseTime(s.startedAt))));\n protected readonly total = computed(() =>\n Math.max(0.001, Math.max(...this.spans().map(s => preciseTime(s.startedAt) + s.durationMs)) - this.start()));\n protected readonly root = computed(() => this.spans().find(s => !s.parentSpanId) ?? this.spans()[0]);\n protected readonly services = computed(() => [...new Set(this.spans().map(s => s.service))]);\n protected readonly errors = computed(() => this.spans().filter(s => s.status === 'Error').length);\n protected readonly selected = computed(() => this.spans().find(s => s.spanId === this.selectedId()) ?? null);\n protected readonly spanLogQuery = computed(() => {\n const s = this.selected();\n return s ? { spanId: s.spanId, ...this.windowAround(s) } : {};\n });\n\n protected readonly showUsage = computed(() => this.usage() === 'on');\n /** The instances that served this trace, in the order they joined it. */\n private readonly allInstances = computed(() => {\n const byId = new Map<string, { id: string; name: string; service: string }>();\n for (const s of this.spans()) {\n if (s.instanceId && !byId.has(s.instanceId)) byId.set(s.instanceId, { id: s.instanceId, name: s.instance ?? s.instanceId, service: s.service });\n }\n return [...byId.values()];\n });\n protected readonly instances = computed(() => this.allInstances().slice(0, MaxUsageInstances));\n protected readonly hiddenInstances = computed(() => this.allInstances().length - this.instances().length);\n /** Metrics are exported every few seconds, so a short trace needs a margin to have any points beside it. */\n protected readonly usageWindow = computed(() => ({\n from: new Date(this.start() - UsageMarginMs).toISOString(),\n to: new Date(this.start() + this.total() + UsageMarginMs).toISOString(),\n }));\n protected readonly usageMarks = computed(() => [new Date(this.start()).toISOString(), new Date(this.start() + this.total()).toISOString()]);\n protected readonly usageMetrics = UsageMetrics;\n\n /** Depth-first order with depth; spans whose parent is missing are roots. Children start-ordered. */\n private readonly rows = computed<Row[]>(() => {\n const spans = this.spans();\n const ids = new Set(spans.map(s => s.spanId));\n const byParent = new Map<string | null, Span[]>();\n for (const s of spans) {\n const parent = s.parentSpanId && ids.has(s.parentSpanId) ? s.parentSpanId : null;\n byParent.set(parent, [...(byParent.get(parent) ?? []), s]);\n }\n const slowest = new Set([...spans].sort((a, b) => b.durationMs - a.durationMs).slice(0, Math.max(1, Math.ceil(spans.length * 0.05))).map(s => s.spanId));\n const rows: Row[] = [];\n const walk = (parent: string | null, depth: number) => {\n for (const s of (byParent.get(parent) ?? []).sort((a, b) => a.startedAt.localeCompare(b.startedAt))) {\n rows.push({\n span: s, depth, children: byParent.get(s.spanId)?.length ?? 0,\n offset: 100 * (preciseTime(s.startedAt) - this.start()) / this.total(),\n selfError: s.status === 'Error', slowest: slowest.has(s.spanId) && spans.length > 3,\n });\n walk(s.spanId, depth + 1);\n }\n };\n walk(null, 0);\n return rows;\n });\n\n /** Hides collapsed subtrees; \"error paths only\" keeps failed spans and their ancestors. */\n protected readonly visible = computed(() => {\n const rows = this.rows();\n const parentOf = new Map(this.spans().map(s => [s.spanId, s.parentSpanId]));\n let keep: Set<string> | null = null;\n if (this.showErrorsOnly()) {\n keep = new Set<string>();\n for (const r of rows.filter(r => r.selfError)) {\n for (let id: string | null | undefined = r.span.spanId; id; id = parentOf.get(id)) keep.add(id);\n }\n }\n const out: Row[] = [];\n let hiddenBelow: number | null = null;\n for (const r of rows) {\n if (hiddenBelow !== null && r.depth > hiddenBelow) continue;\n hiddenBelow = null;\n if (keep && !keep.has(r.span.spanId)) continue;\n out.push(r);\n if (this.collapsed().has(r.span.spanId)) hiddenBelow = r.depth;\n }\n return out;\n });\n\n protected readonly ticks = computed(() => [0, 25, 50, 75].map(at => ({ at, label: formatDuration(this.total() * at / 100) })));\n\n /** The app's categorical colours (observability.colors $series), as CSS variables: a theme switch repaints them. */\n private readonly seriesCount = Math.max(1, Number(themeColor('series-count')) || 1);\n\n color(service: string) {\n return `var(--jc-series-${this.services().indexOf(service) % this.seriesCount + 1})`;\n }\n\n width(span: Span) {\n return Math.max(0.3, 100 * span.durationMs / this.total());\n }\n\n offsetMs(span: Span) {\n return preciseTime(span.startedAt) - this.start();\n }\n\n eventOffset(span: Span, at: string) {\n return preciseTime(at) - preciseTime(span.startedAt);\n }\n\n toggle(spanId: string, event: Event) {\n event.stopPropagation();\n const next = new Set(this.collapsed());\n if (!next.delete(spanId)) next.add(spanId);\n this.collapsed.set(next);\n }\n\n toggleUsage() {\n void this.router.navigate([], { queryParams: { usage: this.showUsage() ? null : 'on' }, queryParamsHandling: 'merge', replaceUrl: true });\n }\n\n select(spanId: string | null) {\n void this.router.navigate([], { queryParams: { span: spanId }, queryParamsHandling: 'merge', replaceUrl: true });\n }\n\n private windowAround(span: Span) {\n const start = new Date(span.startedAt).getTime();\n return { from: new Date(start - 60_000).toISOString(), to: new Date(start + span.durationMs + 60_000).toISOString() };\n }\n\n /** The service page over a window around this span, so its metrics and logs line up with it. */\n aroundSpan(span: Span, extra: Record<string, string>) {\n return { ...this.ctx.around(span.startedAt, span.durationMs), ...extra };\n }\n}\n"],"mappings":";;;;;;;;;;;;AAkBA,MAAM,oBAAoB;AAC1B,MAAM,gBAAgB;AAMtB,MAAM,eAAe;CACnB;EAAE,OAAO;EAAO,MAAM;EAA2B,OAAO;EAAO,SAAS,MAAc,GAAG,KAAK,MAAM,IAAI,GAAG,EAAC;CAAc;CAC1H;EAAE,OAAO;EAAU,MAAM;EAAqC,OAAO;EAAO,SAAS,MAAc,GAAG,KAAK,MAAM,IAAI,OAAO,EAAC;CAAM;CACnI;EAAE,OAAO;EAAY,MAAM;EAAwB,OAAO;EAAO,SAAS,MAAc,GAAG,KAAK,MAAM,IAAI,GAAK,IAAI,GAAE;CAAO;CAC5H;EAAE,OAAO;EAAqB,MAAM;EAAmC,OAAO;EAAM,SAAS,MAAc,OAAO,KAAK,MAAM,IAAI,EAAE,IAAI,EAAE;CAAC;AAC3I;AA2ID,IAAa,YAAb,MAAa,UAAS;CACD,MAAM,OAAO,cAAc;CAC7B,MAAM,OAAO,UAAU;CACvB,SAAS,OAAO,MAAM;CACtB,QAAQ,OAAO,kBA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;IAAA,QAAA,CAAA,SAAA,SAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAgB;IAAc,UAAA;IAAA,QAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;IAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAvJ;IAAQ,MAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAc;IAAQ,MAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAA6F;IAAY,MAAA;GAAA;EAAA;EAAA,iBAAA,GAAA,wBAAA;CAAA,CAAA;;AA6HtI,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAS,YAAA,CAAA;EAjIrB,MAAA;EAAU,MAAA,CAAA;GACT,iBAAiB,wBAAwB;GAEzC,MAAM,EAAE,OAAO,eAAc;GAC7B,SAAS;IAAC;IAAU;IAAY;IAAU;IAAiB;IAAe;IAAsB;IAAY;IAAe;IAAU;IAAc;GAAc;GACjK,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2HX,CAAA"}
|
|
1
|
+
{"version":3,"file":"juice-js-observability-trace.page-CtJQZkNW.mjs","names":[],"sources":["../../../../projects/juice-js/observability/src/lib/pages/trace.page.ts"],"sourcesContent":["import { LinkPipe, ObservabilityLinks } from '../core/options';\nimport { ChangeDetectionStrategy, Component, computed, inject, input, signal } from '@angular/core';\nimport { apiResource } from '../shared/resource';\nimport { DatePipe } from '@angular/common';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatProgressBarModule } from '@angular/material/progress-bar';\nimport { Router, RouterLink } from '@angular/router';\nimport { ApiService } from '../core/api.service';\nimport { ContextService } from '../core/context.service';\nimport { Span } from '../core/models';\nimport { DurationPipe, formatDuration, plainTraceId, preciseTime } from '../shared/format';\nimport { ContextBar, KeyValueTable } from '../shared/ui';\nimport { InstanceMetric, LogTable, problemText } from '../shared/telemetry';\nimport { themeColor } from '../shared/theme';\n\ninterface Row { span: Span; depth: number; children: number; offset: number; selfError: boolean; slowest: boolean; }\n\nconst MaxUsageInstances = 8;\nconst UsageMarginMs = 2 * 60_000;\n\n/**\n * .NET's built-in System.Runtime meter (.NET 9+). Counters arrive as a rate per second. The thread pool's queue length is\n * a level that .NET reports as a counter.\n */\nconst UsageMetrics = [\n { title: 'CPU', name: 'dotnet.process.cpu.time', level: false, format: (v: number) => `${Math.round(v * 100)} % of a core` },\n { title: 'Memory', name: 'dotnet.process.memory.working_set', level: false, format: (v: number) => `${Math.round(v / 1048576)} MiB` },\n { title: 'GC pause', name: 'dotnet.gc.pause.time', level: false, format: (v: number) => `${Math.round(v * 10000) / 10} ms/s` },\n { title: 'Thread pool queue', name: 'dotnet.thread_pool.queue.length', level: true, format: (v: number) => String(Math.round(v * 10) / 10) },\n];\n\n/** A stable colour per service, from a small palette that reads in both themes. */\n\n/**\n * A trace as a waterfall (Console requirements §6): the span hierarchy with timing relative to the trace start, so\n * parallel calls show side by side; errors and the slowest spans marked; subtrees collapsible. The selected span is\n * in the URL (`span`), with its details, its logs, and links to its service, its dependency, and the metrics and logs\n * around it (§7).\n */\n@Component({\n changeDetection: ChangeDetectionStrategy.OnPush,\n // Fills the window; the waterfall and the span scroll on their own (styles.scss).\n host: { class: 'jc-fill-page' },\n imports: [LinkPipe, RouterLink, DatePipe, MatButtonModule, MatIconModule, MatProgressBarModule, ContextBar, KeyValueTable, LogTable, DurationPipe, InstanceMetric],\n template: `\n <jc-context-bar>\n <a [routerLink]=\"['traces'] | jcLink\" [queryParams]=\"ctx.keep()\" class=\"jc-crumb\">Traces</a>\n <span class=\"jc-crumb-sep\">›</span>\n <h1 class=\"jc-mono\">{{ id() }}</h1>\n </jc-context-bar>\n @if (trace.isLoading()) { <mat-progress-bar mode=\"indeterminate\" /> }\n @if (trace.error()) { <p class=\"jc-error\">{{ error() }}</p> }\n\n @if (trace.value(); as t) {\n <div class=\"jc-summary\">\n <span><strong>{{ root()?.service }}</strong> · {{ root()?.name }}</span>\n <span>{{ start() | date: 'MMM d, HH:mm:ss.SSS' }}</span>\n <span>{{ total() | duration }}</span>\n <span>{{ t.spans.length }} spans · {{ services().length }} services</span>\n @if (errors() > 0) { <span class=\"jc-badge jc-health-unhealthy\">{{ errors() }} failed</span> }\n <button mat-button (click)=\"showErrorsOnly.set(!showErrorsOnly())\">{{ showErrorsOnly() ? 'Show all spans' : 'Error paths only' }}</button>\n <a mat-button [routerLink]=\"['logs'] | jcLink\" [queryParams]=\"ctx.keep({ trace: id() })\">Logs of this trace</a>\n <button mat-button [attr.aria-expanded]=\"showUsage()\" (click)=\"toggleUsage()\">Resource usage</button>\n @if (auditLink(); as link) {\n @if ('route' in link) { <a mat-button [routerLink]=\"link.route\" data-testid=\"audit-link\">Audit records ↗</a> }\n @else { <a mat-button [href]=\"link.href\" target=\"_blank\" rel=\"noopener\" data-testid=\"audit-link\">Audit records ↗</a> }\n }\n @if (t.truncated) { <span class=\"jc-muted\">Showing the first {{ t.spans.length }} spans.</span> }\n </div>\n <div class=\"jc-legend\">@for (s of services(); track s) { <span><i [style.background]=\"color(s)\"></i>{{ s }}</span> }</div>\n\n @if (showUsage()) {\n <section class=\"jc-card jc-trace-usage\" aria-label=\"Resource usage\">\n @for (i of instances(); track i.id) {\n <h3>{{ i.service }} · {{ i.name }}</h3>\n <div class=\"jc-usage-charts\">\n @for (m of usageMetrics; track m.name) {\n <jc-instance-metric [title]=\"m.title\" [name]=\"m.name\" [format]=\"m.format\" [level]=\"m.level\" [instanceId]=\"i.id\"\n [from]=\"usageWindow().from\" [to]=\"usageWindow().to\" [marks]=\"usageMarks()\" />\n }\n </div>\n } @empty {\n <p class=\"jc-muted\">The spans of this trace name no known instance.</p>\n }\n @if (hiddenInstances() > 0) { <p class=\"jc-muted\">And {{ hiddenInstances() }} more instances.</p> }\n <p class=\"jc-muted jc-small\">Dashed lines mark the trace. No data: the host does not collect the <code>System.Runtime</code> meter.</p>\n </section>\n }\n\n <div class=\"jc-trace\" [class.jc-with-detail]=\"selected()\">\n <div class=\"jc-waterfall\" role=\"tree\">\n <div class=\"jc-wf-head\"><span>Span</span><span class=\"jc-wf-scale\">\n @for (tick of ticks(); track tick.at) { <span [style.left.%]=\"tick.at\">{{ tick.label }}</span> }</span></div>\n @for (r of visible(); track r.span.spanId) {\n <div class=\"jc-wf-row\" role=\"treeitem\" [class.jc-selected]=\"r.span.spanId === selectedId()\"\n [class.jc-wf-error]=\"r.selfError\" (click)=\"select(r.span.spanId)\" tabindex=\"0\" (keydown.enter)=\"select(r.span.spanId)\">\n <span class=\"jc-wf-name\" [style.padding-left.px]=\"r.depth * 14\">\n @if (r.children > 0) {\n <button class=\"jc-wf-toggle\" (click)=\"toggle(r.span.spanId, $event)\" [attr.aria-label]=\"collapsed().has(r.span.spanId) ? 'Expand' : 'Collapse'\">\n {{ collapsed().has(r.span.spanId) ? '▸' : '▾' }}</button>\n } @else { <span class=\"jc-wf-toggle\"></span> }\n <i class=\"jc-dot\" [style.background]=\"color(r.span.service)\"></i>\n <span class=\"jc-wf-service\">{{ r.span.service }}</span> <span>{{ r.span.name }}</span>\n @if (r.selfError) { <mat-icon class=\"jc-wf-icon jc-bad\" title=\"Failed\">error</mat-icon> }\n @if (r.slowest) { <mat-icon class=\"jc-wf-icon\" title=\"Among the slowest spans\">schedule</mat-icon> }\n @if (collapsed().has(r.span.spanId)) { <span class=\"jc-muted jc-small\">+{{ r.children }}</span> }\n </span>\n <span class=\"jc-wf-track\">\n <span class=\"jc-wf-bar\" [style.left.%]=\"r.offset\" [style.width.%]=\"width(r.span)\" [style.background]=\"color(r.span.service)\"></span>\n <span class=\"jc-wf-time\" [style.left.%]=\"r.offset\">{{ r.span.durationMs | duration }}</span>\n </span>\n </div>\n }\n </div>\n\n @if (selected(); as s) {\n <aside class=\"jc-card jc-span-detail\">\n <div class=\"jc-row\"><h2>{{ s.name }}</h2><button mat-icon-button (click)=\"select(null)\" aria-label=\"Close\"><mat-icon>close</mat-icon></button></div>\n <div class=\"jc-span-facts\">\n <span class=\"jc-badge\" [class.jc-health-unhealthy]=\"s.status === 'Error'\" [class.jc-health-healthy]=\"s.status === 'Ok'\">{{ s.status }}</span>\n <span>{{ s.kind }}</span><span>{{ s.durationMs | duration }}</span>\n <span>at +{{ offsetMs(s) | duration }}</span>\n </div>\n @if (s.statusMessage) { <p class=\"jc-error\">{{ s.statusMessage }}</p> }\n\n <nav class=\"jc-actions\">\n @if (s.serviceId) { <a mat-stroked-button [routerLink]=\"['services', s.serviceId] | jcLink\" [queryParams]=\"ctx.keep()\" [title]=\"'Service ' + s.service\">Service {{ s.service }}</a> }\n @if (s.target; as target) {\n <a mat-stroked-button [routerLink]=\"(target.kind === 'service' ? ['services', target.id] : ['resources', target.id]) | jcLink\" [queryParams]=\"ctx.keep()\"\n [title]=\"(target.kind === 'service' ? 'Calls ' : 'Uses ') + target.name\">\n {{ target.kind === 'service' ? 'Calls' : 'Uses' }} {{ target.name }}</a>\n }\n @if (s.serviceId) {\n <a mat-stroked-button [routerLink]=\"['services', s.serviceId] | jcLink\" [queryParams]=\"aroundSpan(s, { tab: 'metrics' })\">Metrics around</a>\n <a mat-stroked-button [routerLink]=\"['services', s.serviceId] | jcLink\" [queryParams]=\"aroundSpan(s, { tab: 'logs' })\">Service logs around</a>\n <a mat-stroked-button [routerLink]=\"['services', s.serviceId] | jcLink\" [queryParams]=\"ctx.keep({ tab: 'traces', op: s.name })\" [title]=\"'Other traces of ' + s.name\">Other traces of {{ s.name }}</a>\n }\n </nav>\n\n <h3>Logs of this span</h3>\n <jc-log-table [query]=\"spanLogQuery()\" [compact]=\"true\" />\n\n <h3>Span</h3>\n <jc-kv [values]=\"{ 'service': s.service, 'environment': s.environment, 'instance': s.instance, 'host': s.host,\n 'trace id': id(), 'span id': s.spanId, 'parent span id': s.parentSpanId, 'started': s.startedAt,\n 'instrumentation scope': s.scope ? s.scope + (s.scopeVersion ? ' ' + s.scopeVersion : '') : null }\" />\n <h3>Attributes</h3>\n <jc-kv [values]=\"s.attributes\" empty=\"No attributes.\" />\n @if (s.events.length) {\n <h3>Events</h3>\n @for (e of s.events; track $index) {\n <div class=\"jc-event\" [class.jc-wf-error]=\"e.name === 'exception'\">\n <strong>{{ e.name }}</strong> <span class=\"jc-muted\">+{{ eventOffset(s, e.at) | duration }}</span>\n <jc-kv [values]=\"e.attributes\" empty=\"\" />\n </div>\n }\n }\n @if (s.links.length) {\n <h3>Links</h3>\n @for (l of s.links; track l.spanId) {\n <a [routerLink]=\"['traces', l.traceId] | jcLink\" [queryParams]=\"ctx.keep({ span: l.spanId })\" class=\"jc-mono\">{{ l.traceId }} / {{ l.spanId }}</a>\n }\n }\n </aside>\n }\n </div>\n }`,\n})\nexport class TracePage {\n protected readonly ctx = inject(ContextService);\n private readonly api = inject(ApiService);\n private readonly router = inject(Router);\n private readonly links = inject(ObservabilityLinks);\n\n /** A trace id, or a W3C traceparent such as a Juice.Audit record before 10.4 holds; links from either open the trace. */\n readonly traceId = input.required<string>();\n readonly span = input<string>();\n /** 'on' shows the resource usage strip; in the URL so a shared link keeps it. */\n readonly usage = input<string>();\n\n protected readonly id = computed(() => plainTraceId(this.traceId()));\n protected readonly trace = apiResource({ params: () => this.id(), stream: ({ params }) => this.api.trace(params) });\n protected readonly error = computed(() => problemText(this.trace.error()));\n /** The host's audit records of this trace (`auditLink`): the requests it served and the data they changed. */\n protected readonly auditLink = computed(() => this.links.audit(this.id()));\n protected readonly collapsed = signal(new Set<string>());\n protected readonly showErrorsOnly = signal(false);\n protected readonly selectedId = computed(() => this.span() ?? null);\n\n private readonly spans = computed(() => this.trace.value()?.spans ?? []);\n // Sub-millisecond precision: spans of a fast in-process flow start microseconds apart.\n protected readonly start = computed(() => Math.min(...this.spans().map(s => preciseTime(s.startedAt))));\n protected readonly total = computed(() =>\n Math.max(0.001, Math.max(...this.spans().map(s => preciseTime(s.startedAt) + s.durationMs)) - this.start()));\n protected readonly root = computed(() => this.spans().find(s => !s.parentSpanId) ?? this.spans()[0]);\n protected readonly services = computed(() => [...new Set(this.spans().map(s => s.service))]);\n protected readonly errors = computed(() => this.spans().filter(s => s.status === 'Error').length);\n protected readonly selected = computed(() => this.spans().find(s => s.spanId === this.selectedId()) ?? null);\n protected readonly spanLogQuery = computed(() => {\n const s = this.selected();\n return s ? { spanId: s.spanId, ...this.windowAround(s) } : {};\n });\n\n protected readonly showUsage = computed(() => this.usage() === 'on');\n /** The instances that served this trace, in the order they joined it. */\n private readonly allInstances = computed(() => {\n const byId = new Map<string, { id: string; name: string; service: string }>();\n for (const s of this.spans()) {\n if (s.instanceId && !byId.has(s.instanceId)) byId.set(s.instanceId, { id: s.instanceId, name: s.instance ?? s.instanceId, service: s.service });\n }\n return [...byId.values()];\n });\n protected readonly instances = computed(() => this.allInstances().slice(0, MaxUsageInstances));\n protected readonly hiddenInstances = computed(() => this.allInstances().length - this.instances().length);\n /** Metrics are exported every few seconds, so a short trace needs a margin to have any points beside it. */\n protected readonly usageWindow = computed(() => ({\n from: new Date(this.start() - UsageMarginMs).toISOString(),\n to: new Date(this.start() + this.total() + UsageMarginMs).toISOString(),\n }));\n protected readonly usageMarks = computed(() => [new Date(this.start()).toISOString(), new Date(this.start() + this.total()).toISOString()]);\n protected readonly usageMetrics = UsageMetrics;\n\n /** Depth-first order with depth; spans whose parent is missing are roots. Children start-ordered. */\n private readonly rows = computed<Row[]>(() => {\n const spans = this.spans();\n const ids = new Set(spans.map(s => s.spanId));\n const byParent = new Map<string | null, Span[]>();\n for (const s of spans) {\n const parent = s.parentSpanId && ids.has(s.parentSpanId) ? s.parentSpanId : null;\n byParent.set(parent, [...(byParent.get(parent) ?? []), s]);\n }\n const slowest = new Set([...spans].sort((a, b) => b.durationMs - a.durationMs).slice(0, Math.max(1, Math.ceil(spans.length * 0.05))).map(s => s.spanId));\n const rows: Row[] = [];\n const walk = (parent: string | null, depth: number) => {\n for (const s of (byParent.get(parent) ?? []).sort((a, b) => a.startedAt.localeCompare(b.startedAt))) {\n rows.push({\n span: s, depth, children: byParent.get(s.spanId)?.length ?? 0,\n offset: 100 * (preciseTime(s.startedAt) - this.start()) / this.total(),\n selfError: s.status === 'Error', slowest: slowest.has(s.spanId) && spans.length > 3,\n });\n walk(s.spanId, depth + 1);\n }\n };\n walk(null, 0);\n return rows;\n });\n\n /** Hides collapsed subtrees; \"error paths only\" keeps failed spans and their ancestors. */\n protected readonly visible = computed(() => {\n const rows = this.rows();\n const parentOf = new Map(this.spans().map(s => [s.spanId, s.parentSpanId]));\n let keep: Set<string> | null = null;\n if (this.showErrorsOnly()) {\n keep = new Set<string>();\n for (const r of rows.filter(r => r.selfError)) {\n for (let id: string | null | undefined = r.span.spanId; id; id = parentOf.get(id)) keep.add(id);\n }\n }\n const out: Row[] = [];\n let hiddenBelow: number | null = null;\n for (const r of rows) {\n if (hiddenBelow !== null && r.depth > hiddenBelow) continue;\n hiddenBelow = null;\n if (keep && !keep.has(r.span.spanId)) continue;\n out.push(r);\n if (this.collapsed().has(r.span.spanId)) hiddenBelow = r.depth;\n }\n return out;\n });\n\n protected readonly ticks = computed(() => [0, 25, 50, 75].map(at => ({ at, label: formatDuration(this.total() * at / 100) })));\n\n /** The app's categorical colours (observability.colors $series), as CSS variables: a theme switch repaints them. */\n private readonly seriesCount = Math.max(1, Number(themeColor('series-count')) || 1);\n\n color(service: string) {\n return `var(--jc-series-${this.services().indexOf(service) % this.seriesCount + 1})`;\n }\n\n width(span: Span) {\n return Math.max(0.3, 100 * span.durationMs / this.total());\n }\n\n offsetMs(span: Span) {\n return preciseTime(span.startedAt) - this.start();\n }\n\n eventOffset(span: Span, at: string) {\n return preciseTime(at) - preciseTime(span.startedAt);\n }\n\n toggle(spanId: string, event: Event) {\n event.stopPropagation();\n const next = new Set(this.collapsed());\n if (!next.delete(spanId)) next.add(spanId);\n this.collapsed.set(next);\n }\n\n toggleUsage() {\n void this.router.navigate([], { queryParams: { usage: this.showUsage() ? null : 'on' }, queryParamsHandling: 'merge', replaceUrl: true });\n }\n\n select(spanId: string | null) {\n void this.router.navigate([], { queryParams: { span: spanId }, queryParamsHandling: 'merge', replaceUrl: true });\n }\n\n private windowAround(span: Span) {\n const start = new Date(span.startedAt).getTime();\n return { from: new Date(start - 60_000).toISOString(), to: new Date(start + span.durationMs + 60_000).toISOString() };\n }\n\n /** The service page over a window around this span, so its metrics and logs line up with it. */\n aroundSpan(span: Span, extra: Record<string, string>) {\n return { ...this.ctx.around(span.startedAt, span.durationMs), ...extra };\n }\n}\n"],"mappings":";;;;;;;;;;;;AAkBA,MAAM,oBAAoB;AAC1B,MAAM,gBAAgB;AAMtB,MAAM,eAAe;CACnB;EAAE,OAAO;EAAO,MAAM;EAA2B,OAAO;EAAO,SAAS,MAAc,GAAG,KAAK,MAAM,IAAI,GAAG,EAAC;CAAc;CAC1H;EAAE,OAAO;EAAU,MAAM;EAAqC,OAAO;EAAO,SAAS,MAAc,GAAG,KAAK,MAAM,IAAI,OAAO,EAAC;CAAM;CACnI;EAAE,OAAO;EAAY,MAAM;EAAwB,OAAO;EAAO,SAAS,MAAc,GAAG,KAAK,MAAM,IAAI,GAAK,IAAI,GAAE;CAAO;CAC5H;EAAE,OAAO;EAAqB,MAAM;EAAmC,OAAO;EAAM,SAAS,MAAc,OAAO,KAAK,MAAM,IAAI,EAAE,IAAI,EAAE;CAAC;AAC3I;AA2ID,IAAa,YAAb,MAAa,UAAS;CACD,MAAM,OAAO,cAAc;CAC7B,MAAM,OAAO,UAAU;CACvB,SAAS,OAAO,MAAM;CACtB,QAAQ,OAAO,kBAAkB;CAGzC,UAAU,MAAM,SAAkB,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;CAClC,OAAO,MAAe,GAAA,YAAA,CAAA,QAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CAE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J;IAAQ,MAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAc;IAAQ,MAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAA6F;IAAY,MAAA;GAAA;EAAA;EAAA,iBAAA,GAAA,wBAAA;CAAA,CAAA;;AA6HtI,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAS,YAAA,CAAA;EAjIrB,MAAA;EAAU,MAAA,CAAA;GACT,iBAAiB,wBAAwB;GAEzC,MAAM,EAAE,OAAO,eAAc;GAC7B,SAAS;IAAC;IAAU;IAAY;IAAU;IAAiB;IAAe;IAAsB;IAAY;IAAe;IAAU;IAAc;GAAc;GACjK,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2HX,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ApiService, ContextService } from "./juice-js-observability.mjs";
|
|
2
|
-
import { a as TraceTable, c as ContextBar, h as apiResource } from "./juice-js-observability-telemetry-
|
|
2
|
+
import { a as TraceTable, c as ContextBar, h as apiResource } from "./juice-js-observability-telemetry-CaunxC3Y.mjs";
|
|
3
3
|
import * as i0 from "@angular/core";
|
|
4
4
|
import { ChangeDetectionStrategy, Component, computed, inject, input } from "@angular/core";
|
|
5
5
|
import { Router } from "@angular/router";
|
|
@@ -517,4 +517,4 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
517
517
|
});
|
|
518
518
|
export { TracesPage };
|
|
519
519
|
|
|
520
|
-
//# sourceMappingURL=juice-js-observability-traces.page-
|
|
520
|
+
//# sourceMappingURL=juice-js-observability-traces.page-BkGlHFEK.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"juice-js-observability-traces.page-CPcODdxw.mjs","names":[],"sources":["../../../../projects/juice-js/observability/src/lib/pages/traces.page.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, computed, inject, input } from '@angular/core';\nimport { apiResource } from '../shared/resource';\nimport { FormsModule } from '@angular/forms';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatFormFieldModule } from '@angular/material/form-field';\nimport { MatInputModule } from '@angular/material/input';\nimport { MatSelectModule } from '@angular/material/select';\nimport { Router } from '@angular/router';\nimport { map } from 'rxjs';\nimport { ApiService } from '../core/api.service';\nimport { ContextService } from '../core/context.service';\nimport { ContextBar } from '../shared/ui';\nimport { TraceTable } from '../shared/telemetry';\n\n/**\n * Trace search (Console requirements §5): narrow from a service and time window to one trace by operation, status,\n * duration, instance, resource, dependency, trace or span id, and span attributes such as `http.route=/orders` or\n * `messaging.destination.name=orders`. Every filter is a URL parameter, so a search is a shareable link.\n */\n@Component({\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [FormsModule, MatButtonModule, MatFormFieldModule, MatInputModule, MatSelectModule, ContextBar, TraceTable],\n template: `\n <jc-context-bar><h1>Traces</h1></jc-context-bar>\n <form class=\"jc-filter-form\" (ngSubmit)=\"apply(f.value)\" #f=\"ngForm\">\n <mat-form-field subscriptSizing=\"dynamic\">\n <mat-label>Service</mat-label>\n <mat-select name=\"service\" [ngModel]=\"service() ?? ''\">\n <mat-option value=\"\">Any</mat-option>\n @for (s of services.value() ?? []; track s.id) { <mat-option [value]=\"s.id\">{{ s.key }}</mat-option> }\n </mat-select>\n </mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\"><mat-label>Operation</mat-label><input matInput name=\"op\" [ngModel]=\"op() ?? ''\"></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-sm\">\n <mat-label>Status</mat-label>\n <mat-select name=\"status\" [ngModel]=\"status() ?? ''\">\n <mat-option value=\"\">Any</mat-option><mat-option value=\"error\">Error</mat-option><mat-option value=\"ok\">No error</mat-option>\n </mat-select>\n </mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-md\"><mat-label>Min duration (ms)</mat-label><input matInput type=\"number\" min=\"0\" name=\"min\" [ngModel]=\"min() ?? ''\"></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-md\"><mat-label>Max duration (ms)</mat-label><input matInput type=\"number\" min=\"0\" name=\"max\" [ngModel]=\"max() ?? ''\"></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\"><mat-label>Trace ID</mat-label><input matInput name=\"trace\" [ngModel]=\"trace() ?? ''\"></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\"><mat-label>Span ID</mat-label><input matInput name=\"spanId\" [ngModel]=\"spanId() ?? ''\"></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-wide\">\n <mat-label>Attributes</mat-label>\n <input matInput name=\"attr\" [ngModel]=\"attributes().join(', ')\" placeholder=\"http.route=/orders, messaging.destination.name=orders\">\n </mat-form-field>\n <button mat-flat-button type=\"submit\">Search</button>\n <button mat-button type=\"button\" (click)=\"clear()\">Clear</button>\n </form>\n @if (instance() || resource() || dependency()) {\n <p class=\"jc-muted\">Also filtered by {{ scopeText() }}.\n <a href=\"\" (click)=\"$event.preventDefault(); apply({ instance: null, resource: null, dependency: null })\">Remove</a></p>\n }\n <jc-trace-table [query]=\"query()\" [limit]=\"100\" />`,\n})\nexport class TracesPage {\n protected readonly ctx = inject(ContextService);\n private readonly api = inject(ApiService);\n private readonly router = inject(Router);\n\n readonly service = input<string>();\n readonly op = input<string>();\n readonly status = input<string>();\n readonly min = input<string>();\n readonly max = input<string>();\n readonly trace = input<string>();\n readonly spanId = input<string>();\n readonly attr = input<string | string[]>();\n readonly instance = input<string>();\n readonly resource = input<string>();\n readonly dependency = input<string>();\n\n protected readonly services = apiResource({ stream: () => this.api.resources('service').pipe(map(p => p.items)) });\n protected readonly scopeText = computed(() =>\n [this.instance() && 'an instance', this.resource() && 'a resource', this.dependency() && 'a dependency'].filter(x => !!x).join(', '));\n protected readonly attributes = computed(() => {\n const a = this.attr();\n return a === undefined ? [] : Array.isArray(a) ? a : [a];\n });\n protected readonly query = computed(() => ({\n serviceId: this.service(), operation: this.op(), status: this.status(), minDurationMs: this.min(), maxDurationMs: this.max(),\n traceId: this.trace(), spanId: this.spanId(), attribute: this.attributes(), instanceId: this.instance(),\n resourceId: this.resource(), dependencyId: this.dependency(),\n }));\n\n apply(value: Record<string, unknown>) {\n const queryParams: Record<string, unknown> = {};\n for (const [key, v] of Object.entries(value)) queryParams[key] = v === '' || v === undefined ? null : v;\n if (typeof value['attr'] === 'string') {\n queryParams['attr'] = (value['attr'] as string).split(',').map(a => a.trim()).filter(Boolean);\n }\n void this.router.navigate([], { queryParams, queryParamsHandling: 'merge' });\n }\n\n clear() {\n void this.router.navigate([], { queryParams: this.ctx.keep() });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAwDA,IAAa,aAAb,MAAa,WAAU;CACF,MAAM,OAAO,cAAc;CAC7B,MAAM,OAAO,UAAU;CACvB,SAAS,OAAO,MAAM;CAE9B,UAAU,MAAe,GAAA,YAAA,CAAA,QAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;CACzB,KAAK,MAAe,GAAA,YAAA,CAAA,QAAA,EAAA,WAAA,KAAA,CAAA,+BAAA,CAAA,CAAA;CACpB,SAAS,MAAe,GAAA,YAAA,CAAA,QAAA,EAAA,WAAA,SAAA,CAAA,+BAAA,CAAA,CAAA;CACxB,MAAM,MAAe,GAAA,YAAA,CAAA,QAAA,EAAA,WAAA,MAAA,CAAA,+BAAA,CAAA,CAAA;CACrB,MAAM,MAAe,GAAA,YAAA,CAAA,QAAA,EAAA,WAAA,MAAA,CAAA,+BAAA,CAAA,CAAA;CACrB,QAAQ,MAAe,GAAA,YAAA,CAAA,QAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CACvB,SAAS,MAAe,GAAA,YAAA,CAAA,QAAA,EAAA,WAAA,SAAA,CAAA,+B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AAA,CAAA;GACT,iBAAiB,wBAAwB;GACzC,SAAS;IAAC;IAAa;IAAiB;IAAoB;IAAgB;IAAiB;IAAY;GAAU;GACnH,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiCX,CAAA"}
|
|
1
|
+
{"version":3,"file":"juice-js-observability-traces.page-BkGlHFEK.mjs","names":[],"sources":["../../../../projects/juice-js/observability/src/lib/pages/traces.page.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, computed, inject, input } from '@angular/core';\nimport { apiResource } from '../shared/resource';\nimport { FormsModule } from '@angular/forms';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatFormFieldModule } from '@angular/material/form-field';\nimport { MatInputModule } from '@angular/material/input';\nimport { MatSelectModule } from '@angular/material/select';\nimport { Router } from '@angular/router';\nimport { map } from 'rxjs';\nimport { ApiService } from '../core/api.service';\nimport { ContextService } from '../core/context.service';\nimport { ContextBar } from '../shared/ui';\nimport { TraceTable } from '../shared/telemetry';\n\n/**\n * Trace search (Console requirements §5): narrow from a service and time window to one trace by operation, status,\n * duration, instance, resource, dependency, trace or span id, and span attributes such as `http.route=/orders` or\n * `messaging.destination.name=orders`. Every filter is a URL parameter, so a search is a shareable link.\n */\n@Component({\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [FormsModule, MatButtonModule, MatFormFieldModule, MatInputModule, MatSelectModule, ContextBar, TraceTable],\n template: `\n <jc-context-bar><h1>Traces</h1></jc-context-bar>\n <form class=\"jc-filter-form\" (ngSubmit)=\"apply(f.value)\" #f=\"ngForm\">\n <mat-form-field subscriptSizing=\"dynamic\">\n <mat-label>Service</mat-label>\n <mat-select name=\"service\" [ngModel]=\"service() ?? ''\">\n <mat-option value=\"\">Any</mat-option>\n @for (s of services.value() ?? []; track s.id) { <mat-option [value]=\"s.id\">{{ s.key }}</mat-option> }\n </mat-select>\n </mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\"><mat-label>Operation</mat-label><input matInput name=\"op\" [ngModel]=\"op() ?? ''\"></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-sm\">\n <mat-label>Status</mat-label>\n <mat-select name=\"status\" [ngModel]=\"status() ?? ''\">\n <mat-option value=\"\">Any</mat-option><mat-option value=\"error\">Error</mat-option><mat-option value=\"ok\">No error</mat-option>\n </mat-select>\n </mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-md\"><mat-label>Min duration (ms)</mat-label><input matInput type=\"number\" min=\"0\" name=\"min\" [ngModel]=\"min() ?? ''\"></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-md\"><mat-label>Max duration (ms)</mat-label><input matInput type=\"number\" min=\"0\" name=\"max\" [ngModel]=\"max() ?? ''\"></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\"><mat-label>Trace ID</mat-label><input matInput name=\"trace\" [ngModel]=\"trace() ?? ''\"></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\"><mat-label>Span ID</mat-label><input matInput name=\"spanId\" [ngModel]=\"spanId() ?? ''\"></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-wide\">\n <mat-label>Attributes</mat-label>\n <input matInput name=\"attr\" [ngModel]=\"attributes().join(', ')\" placeholder=\"http.route=/orders, messaging.destination.name=orders\">\n </mat-form-field>\n <button mat-flat-button type=\"submit\">Search</button>\n <button mat-button type=\"button\" (click)=\"clear()\">Clear</button>\n </form>\n @if (instance() || resource() || dependency()) {\n <p class=\"jc-muted\">Also filtered by {{ scopeText() }}.\n <a href=\"\" (click)=\"$event.preventDefault(); apply({ instance: null, resource: null, dependency: null })\">Remove</a></p>\n }\n <jc-trace-table [query]=\"query()\" [limit]=\"100\" />`,\n})\nexport class TracesPage {\n protected readonly ctx = inject(ContextService);\n private readonly api = inject(ApiService);\n private readonly router = inject(Router);\n\n readonly service = input<string>();\n readonly op = input<string>();\n readonly status = input<string>();\n readonly min = input<string>();\n readonly max = input<string>();\n readonly trace = input<string>();\n readonly spanId = input<string>();\n readonly attr = input<string | string[]>();\n readonly instance = input<string>();\n readonly resource = input<string>();\n readonly dependency = input<string>();\n\n protected readonly services = apiResource({ stream: () => this.api.resources('service').pipe(map(p => p.items)) });\n protected readonly scopeText = computed(() =>\n [this.instance() && 'an instance', this.resource() && 'a resource', this.dependency() && 'a dependency'].filter(x => !!x).join(', '));\n protected readonly attributes = computed(() => {\n const a = this.attr();\n return a === undefined ? [] : Array.isArray(a) ? a : [a];\n });\n protected readonly query = computed(() => ({\n serviceId: this.service(), operation: this.op(), status: this.status(), minDurationMs: this.min(), maxDurationMs: this.max(),\n traceId: this.trace(), spanId: this.spanId(), attribute: this.attributes(), instanceId: this.instance(),\n resourceId: this.resource(), dependencyId: this.dependency(),\n }));\n\n apply(value: Record<string, unknown>) {\n const queryParams: Record<string, unknown> = {};\n for (const [key, v] of Object.entries(value)) queryParams[key] = v === '' || v === undefined ? null : v;\n if (typeof value['attr'] === 'string') {\n queryParams['attr'] = (value['attr'] as string).split(',').map(a => a.trim()).filter(Boolean);\n }\n void this.router.navigate([], { queryParams, queryParamsHandling: 'merge' });\n }\n\n clear() {\n void this.router.navigate([], { queryParams: this.ctx.keep() });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAwDA,IAAa,aAAb,MAAa,WAAU;CACF,MAAM,OAAO,cAAc;CAC7B,MAAM,OAAO,UAAU;CACvB,SAAS,OAAO,MAAM;CAE9B,UAAU,MAAe,GAAA,YAAA,CAAA,QAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;CACzB,KAAK,MAAe,GAAA,YAAA,CAAA,QAAA,EAAA,WAAA,KAAA,CAAA,+BAAA,CAAA,CAAA;CACpB,SAAS,MAAe,GAAA,YAAA,CAAA,QAAA,EAAA,WAAA,SAAA,CAAA,+BAAA,CAAA,CAAA;CACxB,MAAM,MAAe,GAAA,YAAA,CAAA,QAAA,EAAA,WAAA,MAAA,CAAA,+BAAA,CAAA,CA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UAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAE;IAAU,UAAA;IAAA,QAAA,CAAA,SAAA,OAAA;GAAA;EAAA;EAAA,iBAAA,GAAA,wBAAA;CAAA,CAAA;;AAmCxG,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAU,YAAA,CAAA;EArCtB,MAAA;EAAU,MAAA,CAAA;GACT,iBAAiB,wBAAwB;GACzC,SAAS;IAAC;IAAa;IAAiB;IAAoB;IAAgB;IAAiB;IAAY;GAAU;GACnH,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiCX,CAAA"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
2
|
import { DestroyRef, Injectable, InjectionToken, Pipe, computed, effect, inject, makeEnvironmentProviders, provideEnvironmentInitializer, signal, untracked } from "@angular/core";
|
|
3
|
+
import { DOCUMENT } from "@angular/common";
|
|
3
4
|
import { NavigationEnd, Router } from "@angular/router";
|
|
4
|
-
import { EMPTY, expand, filter, map, reduce, shareReplay, startWith, switchMap, tap, timer } from "rxjs";
|
|
5
|
+
import { EMPTY, expand, filter, fromEvent, map, reduce, shareReplay, startWith, switchMap, tap, timer } from "rxjs";
|
|
6
|
+
import { MenuBadgeService } from "@juice-js/layout";
|
|
5
7
|
import { HttpClient, HttpParams } from "@angular/common/http";
|
|
6
8
|
import { toSignal } from "@angular/core/rxjs-interop";
|
|
7
9
|
function idempotencyKey() {
|
|
@@ -336,6 +338,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
336
338
|
var ApprovalCount = class ApprovalCount {
|
|
337
339
|
static Every = 3e4;
|
|
338
340
|
api = inject(ApiService);
|
|
341
|
+
document = inject(DOCUMENT);
|
|
339
342
|
polling = null;
|
|
340
343
|
forYou = signal(0, ...ngDevMode ? [{ debugName: "forYou" }] : /* istanbul ignore next */ []);
|
|
341
344
|
constructor() {
|
|
@@ -345,8 +348,12 @@ var ApprovalCount = class ApprovalCount {
|
|
|
345
348
|
const navigations = inject(Router).events.pipe(filter((e) => e instanceof NavigationEnd)).subscribe(() => {
|
|
346
349
|
if (!this.polling && this.api.tenantKnown()) this.start();
|
|
347
350
|
});
|
|
351
|
+
const shown = fromEvent(this.document, "visibilitychange").pipe(filter(() => !this.document.hidden)).subscribe(() => {
|
|
352
|
+
if (this.polling) this.start();
|
|
353
|
+
});
|
|
348
354
|
inject(DestroyRef).onDestroy(() => {
|
|
349
355
|
navigations.unsubscribe();
|
|
356
|
+
shown.unsubscribe();
|
|
350
357
|
this.polling?.unsubscribe();
|
|
351
358
|
});
|
|
352
359
|
}
|
|
@@ -355,7 +362,7 @@ var ApprovalCount = class ApprovalCount {
|
|
|
355
362
|
}
|
|
356
363
|
start() {
|
|
357
364
|
this.polling?.unsubscribe();
|
|
358
|
-
this.polling = timer(0, ApprovalCount.Every).pipe(switchMap(() => this.api.waitingRequests())).subscribe({
|
|
365
|
+
this.polling = timer(0, ApprovalCount.Every).pipe(filter(() => !this.document.hidden), switchMap(() => this.api.waitingRequests())).subscribe({
|
|
359
366
|
next: (w) => this.forYou.set(w.forYou),
|
|
360
367
|
error: () => {
|
|
361
368
|
this.forYou.set(0);
|
|
@@ -390,52 +397,18 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
390
397
|
}],
|
|
391
398
|
ctorParameters: () => []
|
|
392
399
|
});
|
|
400
|
+
const APPROVALS_MENU_ID = "approvals";
|
|
393
401
|
var ApprovalMenuBadge = class ApprovalMenuBadge {
|
|
394
|
-
static Icon = "approval";
|
|
395
|
-
count = inject(ApprovalCount);
|
|
396
|
-
observer = null;
|
|
397
402
|
constructor() {
|
|
398
|
-
|
|
399
|
-
effect(() =>
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
requestAnimationFrame(() => {
|
|
405
|
-
scheduled = false;
|
|
406
|
-
this.apply(this.count.forYou());
|
|
403
|
+
const count = inject(ApprovalCount), badges = inject(MenuBadgeService);
|
|
404
|
+
effect(() => {
|
|
405
|
+
const n = count.forYou();
|
|
406
|
+
badges.set(APPROVALS_MENU_ID, {
|
|
407
|
+
count: n,
|
|
408
|
+
hint: `${n} request${n === 1 ? "" : "s"} waiting for your approval`
|
|
407
409
|
});
|
|
408
410
|
});
|
|
409
|
-
|
|
410
|
-
childList: true,
|
|
411
|
-
subtree: true
|
|
412
|
-
});
|
|
413
|
-
inject(DestroyRef).onDestroy(() => this.observer?.disconnect());
|
|
414
|
-
}
|
|
415
|
-
apply(count) {
|
|
416
|
-
for (const icon of Array.from(document.querySelectorAll("juice-nav-menu mat-icon"))) {
|
|
417
|
-
if (icon.textContent?.trim() !== ApprovalMenuBadge.Icon) continue;
|
|
418
|
-
const item = icon.closest("mat-list-item, .mat-mdc-list-item");
|
|
419
|
-
const title = item?.querySelector("[matListItemTitle], .mdc-list-item__primary-text");
|
|
420
|
-
if (!item || !title) continue;
|
|
421
|
-
let badge = title.querySelector(".jc-menu-badge");
|
|
422
|
-
if (count <= 0) {
|
|
423
|
-
badge?.remove();
|
|
424
|
-
item.removeAttribute("title");
|
|
425
|
-
continue;
|
|
426
|
-
}
|
|
427
|
-
if (!badge) {
|
|
428
|
-
badge = document.createElement("span");
|
|
429
|
-
badge.className = "jc-menu-badge";
|
|
430
|
-
badge.setAttribute("data-testid", "approvals-badge");
|
|
431
|
-
badge.style.cssText = "display:inline-block;min-width:1.25rem;margin-left:.5rem;padding:0 .375rem;border-radius:999px;font-size:.75rem;line-height:1.25rem;text-align:center;font-weight:600;background:var(--mat-sys-error,#b3261e);color:var(--mat-sys-on-error,#fff)";
|
|
432
|
-
title.appendChild(badge);
|
|
433
|
-
}
|
|
434
|
-
const text = count > 99 ? "99+" : String(count);
|
|
435
|
-
if (badge.textContent !== text) badge.textContent = text;
|
|
436
|
-
const hint = `${count} request${count === 1 ? "" : "s"} waiting for your approval`;
|
|
437
|
-
if (item.getAttribute("title") !== hint) item.setAttribute("title", hint);
|
|
438
|
-
}
|
|
411
|
+
inject(DestroyRef).onDestroy(() => badges.clear(APPROVALS_MENU_ID));
|
|
439
412
|
}
|
|
440
413
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
441
414
|
minVersion: "12.0.0",
|
|
@@ -664,142 +637,160 @@ function page(path, title, load) {
|
|
|
664
637
|
};
|
|
665
638
|
}
|
|
666
639
|
const OBSERVABILITY_ROUTES = [
|
|
667
|
-
page("", "Overview", () => import("./juice-js-observability-overview.page-
|
|
668
|
-
page("services", "Services", () => import("./juice-js-observability-services.page-
|
|
669
|
-
page("services/:id", "Service", () => import("./juice-js-observability-service.page-
|
|
670
|
-
page("traces", "Traces", () => import("./juice-js-observability-traces.page-
|
|
671
|
-
page("traces/:traceId", "Trace", () => import("./juice-js-observability-trace.page-
|
|
672
|
-
page("topology", "Dependencies", () => import("./juice-js-observability-topology.page-
|
|
673
|
-
page("logs", "Logs", () => import("./juice-js-observability-logs.page-
|
|
674
|
-
page("metrics", "Metrics", () => import("./juice-js-observability-metrics.page-
|
|
675
|
-
page("resources", "Resources", () => import("./juice-js-observability-resources.page-
|
|
676
|
-
page("resources/:id", "Resource", () => import("./juice-js-observability-resource.page-
|
|
677
|
-
page("alerts", "Alerts", () => import("./juice-js-observability-alerts.page-
|
|
678
|
-
page("alerts/:id", "Alert", () => import("./juice-js-observability-alert.page-
|
|
679
|
-
page("rules", "Rules", () => import("./juice-js-observability-rules.page-
|
|
680
|
-
page("notifications", "Notifications", () => import("./juice-js-observability-notifications.page-
|
|
681
|
-
page("silences", "Silences", () => import("./juice-js-observability-silences.page-
|
|
682
|
-
page("incidents", "Incidents", () => import("./juice-js-observability-incidents.page-
|
|
683
|
-
page("incidents/:id", "Incident", () => import("./juice-js-observability-incident.page-
|
|
684
|
-
page("agents", "Agents", () => import("./juice-js-observability-agents.page-
|
|
685
|
-
page("agents/:id", "Agent", () => import("./juice-js-observability-agent.page-
|
|
686
|
-
page("approvals", "Approvals", () => import("./juice-js-observability-approvals.page-
|
|
687
|
-
page("slos", "SLOs", () => import("./juice-js-observability-slos.page-
|
|
688
|
-
page("slos/:key", "SLO", () => import("./juice-js-observability-slo.page-
|
|
689
|
-
page("timeline", "Timeline", () => import("./juice-js-observability-timeline.page-
|
|
690
|
-
page("load-runs", "Load runs", () => import("./juice-js-observability-load-runs.page-
|
|
640
|
+
page("", "Overview", () => import("./juice-js-observability-overview.page-CdSUNH6a.mjs").then((m) => m.OverviewPage)),
|
|
641
|
+
page("services", "Services", () => import("./juice-js-observability-services.page-CBtxLm0R.mjs").then((m) => m.ServicesPage)),
|
|
642
|
+
page("services/:id", "Service", () => import("./juice-js-observability-service.page-BAUPza0x.mjs").then((m) => m.ServicePage)),
|
|
643
|
+
page("traces", "Traces", () => import("./juice-js-observability-traces.page-BkGlHFEK.mjs").then((m) => m.TracesPage)),
|
|
644
|
+
page("traces/:traceId", "Trace", () => import("./juice-js-observability-trace.page-CtJQZkNW.mjs").then((m) => m.TracePage)),
|
|
645
|
+
page("topology", "Dependencies", () => import("./juice-js-observability-topology.page-BN5NL2st.mjs").then((m) => m.TopologyPage)),
|
|
646
|
+
page("logs", "Logs", () => import("./juice-js-observability-logs.page-DtCoZuZg.mjs").then((m) => m.LogsPage)),
|
|
647
|
+
page("metrics", "Metrics", () => import("./juice-js-observability-metrics.page-By3pnaJz.mjs").then((m) => m.MetricsPage)),
|
|
648
|
+
page("resources", "Resources", () => import("./juice-js-observability-resources.page-Ch6GVPyx.mjs").then((m) => m.ResourcesPage)),
|
|
649
|
+
page("resources/:id", "Resource", () => import("./juice-js-observability-resource.page-CIY0hWSX.mjs").then((m) => m.ResourcePage)),
|
|
650
|
+
page("alerts", "Alerts", () => import("./juice-js-observability-alerts.page-up57Y8fX.mjs").then((m) => m.AlertsPage)),
|
|
651
|
+
page("alerts/:id", "Alert", () => import("./juice-js-observability-alert.page-KyakwaUL.mjs").then((m) => m.AlertPage)),
|
|
652
|
+
page("rules", "Rules", () => import("./juice-js-observability-rules.page-AbY-0A8n.mjs").then((m) => m.RulesPage)),
|
|
653
|
+
page("notifications", "Notifications", () => import("./juice-js-observability-notifications.page-DIXE52Rt.mjs").then((m) => m.NotificationsPage)),
|
|
654
|
+
page("silences", "Silences", () => import("./juice-js-observability-silences.page-WxGogpDD.mjs").then((m) => m.SilencesPage)),
|
|
655
|
+
page("incidents", "Incidents", () => import("./juice-js-observability-incidents.page-B4DbQAWr.mjs").then((m) => m.IncidentsPage)),
|
|
656
|
+
page("incidents/:id", "Incident", () => import("./juice-js-observability-incident.page-BryX9L8h.mjs").then((m) => m.IncidentPage)),
|
|
657
|
+
page("agents", "Agents", () => import("./juice-js-observability-agents.page-C-o-OXai.mjs").then((m) => m.AgentsPage)),
|
|
658
|
+
page("agents/:id", "Agent", () => import("./juice-js-observability-agent.page-DE84_XZr.mjs").then((m) => m.AgentPage)),
|
|
659
|
+
page("approvals", "Approvals", () => import("./juice-js-observability-approvals.page-BgHDUGd4.mjs").then((m) => m.ApprovalsPage)),
|
|
660
|
+
page("slos", "SLOs", () => import("./juice-js-observability-slos.page-DVg2gK4Y.mjs").then((m) => m.SlosPage)),
|
|
661
|
+
page("slos/:key", "SLO", () => import("./juice-js-observability-slo.page-BRigA4Ss.mjs").then((m) => m.SloPage)),
|
|
662
|
+
page("timeline", "Timeline", () => import("./juice-js-observability-timeline.page-ChDtTC3b.mjs").then((m) => m.TimelinePage)),
|
|
663
|
+
page("load-runs", "Load runs", () => import("./juice-js-observability-load-runs.page-UPQFzG3h.mjs").then((m) => m.LoadRunsPage))
|
|
691
664
|
];
|
|
692
665
|
function observabilityMenus(basePath = "/", order = 1) {
|
|
693
666
|
const base = normalizeBasePath(basePath);
|
|
694
667
|
const link = (path) => base === "/" ? `/${path}` : path ? `${base}/${path}` : base;
|
|
668
|
+
const group = (id, label, icon, children) => ({
|
|
669
|
+
id,
|
|
670
|
+
label,
|
|
671
|
+
icon,
|
|
672
|
+
routerLink: children[0].routerLink,
|
|
673
|
+
replaceChildRouterLink: false,
|
|
674
|
+
children
|
|
675
|
+
});
|
|
695
676
|
return [
|
|
696
677
|
{
|
|
697
678
|
id: "overview",
|
|
698
679
|
label: "Overview",
|
|
699
680
|
icon: "dashboard",
|
|
700
|
-
routerLink: link("")
|
|
681
|
+
routerLink: link(""),
|
|
682
|
+
shortcut: "g o"
|
|
701
683
|
},
|
|
702
684
|
{
|
|
703
685
|
id: "services",
|
|
704
686
|
label: "Services",
|
|
705
687
|
icon: "hub",
|
|
706
|
-
routerLink: link("services")
|
|
688
|
+
routerLink: link("services"),
|
|
689
|
+
shortcut: "g s"
|
|
707
690
|
},
|
|
708
691
|
{
|
|
709
692
|
id: "traces",
|
|
710
693
|
label: "Traces",
|
|
711
694
|
icon: "timeline",
|
|
712
|
-
routerLink: link("traces")
|
|
713
|
-
|
|
714
|
-
{
|
|
715
|
-
id: "topology",
|
|
716
|
-
label: "Dependencies",
|
|
717
|
-
icon: "account_tree",
|
|
718
|
-
routerLink: link("topology")
|
|
695
|
+
routerLink: link("traces"),
|
|
696
|
+
shortcut: "g t"
|
|
719
697
|
},
|
|
720
698
|
{
|
|
721
699
|
id: "logs",
|
|
722
700
|
label: "Logs",
|
|
723
701
|
icon: "notes",
|
|
724
|
-
routerLink: link("logs")
|
|
702
|
+
routerLink: link("logs"),
|
|
703
|
+
shortcut: "g l"
|
|
725
704
|
},
|
|
726
705
|
{
|
|
727
706
|
id: "metrics",
|
|
728
707
|
label: "Metrics",
|
|
729
708
|
icon: "show_chart",
|
|
730
|
-
routerLink: link("metrics")
|
|
731
|
-
|
|
732
|
-
{
|
|
733
|
-
id: "resources",
|
|
734
|
-
label: "Resources",
|
|
735
|
-
icon: "dns",
|
|
736
|
-
routerLink: link("resources")
|
|
709
|
+
routerLink: link("metrics"),
|
|
710
|
+
shortcut: "g m"
|
|
737
711
|
},
|
|
738
712
|
{
|
|
739
713
|
id: "alerts",
|
|
740
714
|
label: "Alerts",
|
|
741
715
|
icon: "notifications",
|
|
742
|
-
routerLink: link("alerts")
|
|
716
|
+
routerLink: link("alerts"),
|
|
717
|
+
shortcut: "g a"
|
|
743
718
|
},
|
|
744
719
|
{
|
|
745
720
|
id: "incidents",
|
|
746
721
|
label: "Incidents",
|
|
747
722
|
icon: "emergency",
|
|
748
|
-
routerLink: link("incidents")
|
|
749
|
-
|
|
750
|
-
{
|
|
751
|
-
id: "rules",
|
|
752
|
-
label: "Rules",
|
|
753
|
-
icon: "rule",
|
|
754
|
-
routerLink: link("rules")
|
|
755
|
-
},
|
|
756
|
-
{
|
|
757
|
-
id: "silences",
|
|
758
|
-
label: "Silences",
|
|
759
|
-
icon: "notifications_paused",
|
|
760
|
-
routerLink: link("silences")
|
|
723
|
+
routerLink: link("incidents"),
|
|
724
|
+
shortcut: "g i"
|
|
761
725
|
},
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
726
|
+
group("observability-explore", "Explore", "explore", [
|
|
727
|
+
{
|
|
728
|
+
id: "topology",
|
|
729
|
+
label: "Dependencies",
|
|
730
|
+
icon: "account_tree",
|
|
731
|
+
routerLink: link("topology")
|
|
732
|
+
},
|
|
733
|
+
{
|
|
734
|
+
id: "resources",
|
|
735
|
+
label: "Resources",
|
|
736
|
+
icon: "dns",
|
|
737
|
+
routerLink: link("resources")
|
|
738
|
+
},
|
|
739
|
+
{
|
|
740
|
+
id: "slos",
|
|
741
|
+
label: "SLOs",
|
|
742
|
+
icon: "track_changes",
|
|
743
|
+
routerLink: link("slos")
|
|
744
|
+
},
|
|
745
|
+
{
|
|
746
|
+
id: "timeline",
|
|
747
|
+
label: "Timeline",
|
|
748
|
+
icon: "history",
|
|
749
|
+
routerLink: link("timeline")
|
|
750
|
+
},
|
|
751
|
+
{
|
|
752
|
+
id: "load-runs",
|
|
753
|
+
label: "Load runs",
|
|
754
|
+
icon: "speed",
|
|
755
|
+
routerLink: link("load-runs")
|
|
756
|
+
}
|
|
757
|
+
]),
|
|
758
|
+
group("observability-automation", "Automation", "precision_manufacturing", [{
|
|
775
759
|
id: "agents",
|
|
776
760
|
label: "Agents",
|
|
777
761
|
icon: "smart_toy",
|
|
778
762
|
routerLink: link("agents")
|
|
779
|
-
},
|
|
780
|
-
|
|
781
|
-
id: "approvals",
|
|
763
|
+
}, {
|
|
764
|
+
id: APPROVALS_MENU_ID,
|
|
782
765
|
label: "Approvals",
|
|
783
766
|
icon: "approval",
|
|
784
767
|
routerLink: link("approvals")
|
|
785
|
-
},
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
768
|
+
}]),
|
|
769
|
+
group("observability-configure", "Configure", "tune", [
|
|
770
|
+
{
|
|
771
|
+
id: "rules",
|
|
772
|
+
label: "Rules",
|
|
773
|
+
icon: "rule",
|
|
774
|
+
routerLink: link("rules")
|
|
775
|
+
},
|
|
776
|
+
{
|
|
777
|
+
id: "silences",
|
|
778
|
+
label: "Silences",
|
|
779
|
+
icon: "notifications_paused",
|
|
780
|
+
routerLink: link("silences")
|
|
781
|
+
},
|
|
782
|
+
{
|
|
783
|
+
id: "notifications",
|
|
784
|
+
label: "Notifications",
|
|
785
|
+
icon: "campaign",
|
|
786
|
+
routerLink: link("notifications")
|
|
787
|
+
}
|
|
788
|
+
])
|
|
798
789
|
].map((menu, index) => ({
|
|
799
790
|
...menu,
|
|
800
791
|
order: order + index
|
|
801
792
|
}));
|
|
802
793
|
}
|
|
803
|
-
export { ApiService, ApprovalCount, ApprovalMenuBadge, ContextService, LinkPipe, MAX_SEARCH_MS, OBSERVABILITY_OPTIONS, OBSERVABILITY_ROUTES, ObservabilityLinks, RANGES, idempotencyKey, normalizeBasePath, observabilityMenus, provideJuiceObservability };
|
|
794
|
+
export { APPROVALS_MENU_ID, ApiService, ApprovalCount, ApprovalMenuBadge, ContextService, LinkPipe, MAX_SEARCH_MS, OBSERVABILITY_OPTIONS, OBSERVABILITY_ROUTES, ObservabilityLinks, RANGES, idempotencyKey, normalizeBasePath, observabilityMenus, provideJuiceObservability };
|
|
804
795
|
|
|
805
796
|
//# sourceMappingURL=juice-js-observability.mjs.map
|