Lead gateway overview with readable fault context
This commit is contained in:
@@ -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) =>
|
||||
|
||||
Reference in New Issue
Block a user