feat: add CLI debug snapshot command for one-shot instance state inspection
Adds `debug snapshot --id <int>` to query a running instance's current attribute values and alarm states without the subscribe/stream overhead of the debug view. Routes through ManagementActor → CommunicationService → site DeploymentManager → InstanceActor using the existing remote query pattern.
This commit is contained in:
@@ -71,6 +71,7 @@ public class DeploymentManagerActor : ReceiveActor, IWithTimers
|
||||
// Debug View — route to Instance Actors
|
||||
Receive<SubscribeDebugViewRequest>(RouteDebugViewSubscribe);
|
||||
Receive<UnsubscribeDebugViewRequest>(RouteDebugViewUnsubscribe);
|
||||
Receive<DebugSnapshotRequest>(RouteDebugSnapshot);
|
||||
|
||||
// Internal startup messages
|
||||
Receive<StartupConfigsLoaded>(HandleStartupConfigsLoaded);
|
||||
@@ -453,6 +454,22 @@ public class DeploymentManagerActor : ReceiveActor, IWithTimers
|
||||
}
|
||||
}
|
||||
|
||||
private void RouteDebugSnapshot(DebugSnapshotRequest request)
|
||||
{
|
||||
if (_instanceActors.TryGetValue(request.InstanceUniqueName, out var instanceActor))
|
||||
{
|
||||
instanceActor.Forward(request);
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.LogWarning(
|
||||
"Debug snapshot for unknown instance {Instance}", request.InstanceUniqueName);
|
||||
Sender.Tell(new DebugViewSnapshot(
|
||||
request.InstanceUniqueName, Array.Empty<Commons.Messages.Streaming.AttributeValueChanged>(),
|
||||
Array.Empty<Commons.Messages.Streaming.AlarmStateChanged>(), DateTimeOffset.UtcNow));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// WP-33: Handles system-wide artifact deployment (shared scripts, external systems, etc.).
|
||||
/// Persists artifacts to SiteStorageService and recompiles shared scripts.
|
||||
|
||||
Reference in New Issue
Block a user