fix(telemetry): release a removed driver's resilience tracker state so the publisher stops re-emitting it (#609)
Review R1 M1: StopChild evicted the hub cache, but DriverResilienceStatusPublisherService re-emits the tracker every tick. IDriverCapabilityInvokerFactory.Release (default no-op) now invalidates the pipeline builder + status tracker; the host calls it before Evict. Test runs a publisher tick after removal, with a neighbour instance as positive control. Claude-Session: https://claude.ai/code/session_01Ef2ozxS7QPanGT8uoATbTe
This commit is contained in:
@@ -28,6 +28,16 @@ public interface IDriverCapabilityInvokerFactory
|
||||
/// </param>
|
||||
/// <returns>A per-instance <see cref="IDriverCapabilityInvoker"/>.</returns>
|
||||
IDriverCapabilityInvoker Create(string driverInstanceId, string driverType, string? resilienceConfigJson = null);
|
||||
|
||||
/// <summary>
|
||||
/// Release every piece of shared resilience state held for <paramref name="driverInstanceId"/> — called
|
||||
/// by the host when the instance leaves the deployed plan (#609). A concrete factory drops the
|
||||
/// instance's cached pipelines and its status-tracker snapshots, so the periodic resilience publisher
|
||||
/// stops re-emitting (and re-priming new telemetry subscribers with) a decommissioned driver's last
|
||||
/// breaker/failure counters. Default: no-op (a factory that holds no state).
|
||||
/// </summary>
|
||||
/// <param name="driverInstanceId">The driver instance that was removed.</param>
|
||||
void Release(string driverInstanceId) { }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -90,4 +90,16 @@ public sealed class DriverCapabilityInvokerFactory : IDriverCapabilityInvokerFac
|
||||
statusTracker: _statusTracker,
|
||||
optionsGeneration: generation);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <remarks>
|
||||
/// #609: without this the tracker kept a removed instance's snapshots forever (only <see cref="Create"/>
|
||||
/// invalidated, and a removed instance is never re-created), and the resilience publisher re-emitted
|
||||
/// them every tick — undoing the host's telemetry-hub eviction within one interval.
|
||||
/// </remarks>
|
||||
public void Release(string driverInstanceId)
|
||||
{
|
||||
_builder.Invalidate(driverInstanceId);
|
||||
_statusTracker.Invalidate(driverInstanceId);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user