Lead gateway overview with readable fault context

This commit is contained in:
Joseph Doherty
2026-11-13 19:30:52 -05:00
parent c9a6c31cb8
commit b06921ce85
42 changed files with 2113 additions and 47 deletions
@@ -0,0 +1,5 @@
@namespace MxUiCanary.Components
@page "/overview-fixture"
@inject IJSRuntime JS
<ThemeShell Product="Synthetic MX overview"><ChildContent><DashboardHome/></ChildContent></ThemeShell>
@code { protected override async Task OnAfterRenderAsync(bool firstRender){if(firstRender)await JS.InvokeVoidAsync("mxCanaryReady");} }
+18 -9
View File
@@ -7,16 +7,24 @@ using ZB.MOM.WW.MxGateway.Server.Security.Authorization;
internal sealed class StubSnapshotService : IDashboardSnapshotService
{
/// <inheritdoc />
public DashboardSnapshot GetSnapshot() => new(
GeneratedAt: DateTimeOffset.UnixEpoch,
GatewayStartedAt: DateTimeOffset.UnixEpoch,
GatewayUptime: TimeSpan.Zero,
GatewayStatus: "Healthy",
public string Scene { get; set; } = "mixed";
public DashboardSnapshot GetSnapshot()
{
string scene = Scene;
var at = new DateTimeOffset(2026, 11, 13, 20, 0, 0, TimeSpan.Zero);
bool mixed = scene == "mixed";
return new(
GeneratedAt: at,
GatewayStartedAt: at.AddHours(-3),
GatewayUptime: TimeSpan.FromHours(3),
GatewayStatus: mixed ? "Degraded" : "Healthy",
GatewayVersion: "test",
Sessions: [],
Sessions: scene == "zero" ? [] : [new("fixture-session", "synthetic", mixed ? ZB.MOM.WW.MxGateway.Contracts.Proto.SessionState.Faulted : ZB.MOM.WW.MxGateway.Contracts.Proto.SessionState.Ready,
null, null, null, at, at, null, 123, null, null, 0, mixed ? "Synthetic fixture fault" : null)],
Workers: [],
Metrics: [],
Faults: [],
Metrics: [new("mxgateway.sessions.open", scene == "zero" ? 0 : 1), new("mxgateway.workers.running", scene == "zero" ? 0 : 1), new("mxgateway.events.worker_queue.depth", mixed ? 3 : 0),
new("mxgateway.commands.failed", 104), new("mxgateway.events.received", 105), new("mxgateway.faults", 106), new("mxgateway.queues.overflows", 107)],
Faults: mixed ? [new("Worker", "fixture-session", 123, "Faulted", "Synthetic worker stopped responding. " + new string('x', 300) + " <script>fixture</script>", at)] : [],
ApiKeys:
[
new DashboardApiKeySummary(
@@ -37,7 +45,8 @@ using ZB.MOM.WW.MxGateway.Server.Security.Authorization;
RevokedUtc: null),
],
Configuration: null!,
Galaxy: null!);
Galaxy: DashboardGalaxySummary.Unknown with { Status = DashboardGalaxyStatus.Healthy, LastDeployTime = at, LastSuccessAt = at, LastQueriedAt = at, ObjectCount = 201, AreaCount = 202, AttributeCount = 203, HistorizedAttributeCount = 204, AlarmAttributeCount = 205 });
}
/// <inheritdoc />
public IAsyncEnumerable<DashboardSnapshot> WatchSnapshotsAsync(CancellationToken cancellationToken) =>
+4
View File
@@ -20,5 +20,9 @@ var app = builder.Build();
app.UseStaticFiles(new StaticFileOptions { FileProvider = new PhysicalFileProvider(Path.GetFullPath("../../../src/ZB.MOM.WW.MxGateway.Server/wwwroot")) });
app.UseStaticFiles();app.UseAntiforgery();
app.MapRazorComponents<FixtureApp>().AddInteractiveServerRenderMode();
app.MapPost("/fixtures/snapshot/{scene}",(string scene, IDashboardSnapshotService source) => {
if (scene is not ("healthy" or "mixed" or "zero")) return Results.BadRequest();
((StubSnapshotService)source).Scene = scene; return Results.Ok(new { scene, syntheticOnly=true });
});
app.MapGet("/provenance",()=>new { theme=typeof(ZB.MOM.WW.Theme.ThemeShell).Assembly.GetName().Version?.ToString(), syntheticOnly=true });
app.Run();