test+docs: serialise data-connection gauge tests, add metrics instrument reference (ScadaBridge#99)
DataConnectionGaugeTests and ExtendedInstrumentTests both mutate the process-global data connection registry; put them in a non-parallel xUnit collection. Add docs/operations/metrics-reference.md. Claude-Session: https://claude.ai/code/session_01GT67AEHd2Acv1YPwGfXEoV
This commit is contained in:
+15
@@ -0,0 +1,15 @@
|
||||
namespace ZB.MOM.WW.ScadaBridge.Commons.Tests.Observability;
|
||||
|
||||
/// <summary>
|
||||
/// Serialises every test class that mutates the process-global data-connection gauge
|
||||
/// registry in <c>ScadaBridgeTelemetry</c> (Gitea #99). The delta-against-baseline assertions in
|
||||
/// <c>DataConnectionGaugeTests</c> are only valid if no other test adds or removes a connection
|
||||
/// between the baseline read and the assertion; <c>DisableParallelization</c> makes this
|
||||
/// collection run alone, not concurrently with any other collection in the assembly.
|
||||
/// </summary>
|
||||
[CollectionDefinition(Name, DisableParallelization = true)]
|
||||
public sealed class DataConnectionGaugeCollection
|
||||
{
|
||||
/// <summary>Collection name shared by the classes that touch the gauge registry.</summary>
|
||||
public const string Name = "DataConnectionGauge";
|
||||
}
|
||||
@@ -16,8 +16,11 @@ namespace ZB.MOM.WW.ScadaBridge.Commons.Tests.Observability;
|
||||
/// gauges is a process-global static, so absolute assertions would inherit the register
|
||||
/// row 32 flake that makes <c>QueueDepthGaugeTests</c> pass alone and fail under the full
|
||||
/// concurrent suite. Each test also removes its own connections in a <c>finally</c> so it
|
||||
/// leaves the shared registry exactly as it found it.
|
||||
/// leaves the shared registry exactly as it found it. The class is also in the
|
||||
/// non-parallel <c>DataConnectionGauge</c> collection (Gitea #99), because the deltas can still be
|
||||
/// corrupted by another class mutating the registry between baseline and assertion.
|
||||
/// </remarks>
|
||||
[Collection(DataConnectionGaugeCollection.Name)]
|
||||
public sealed class DataConnectionGaugeTests
|
||||
{
|
||||
private const string ConnectedGauge = "scadabridge.site.data_connections.connected";
|
||||
|
||||
@@ -9,6 +9,7 @@ namespace ZB.MOM.WW.ScadaBridge.Commons.Tests.Observability;
|
||||
/// <see cref="MeterListener"/> filtered to the emitting (test) thread, because the meter is
|
||||
/// process-global and other tests emit on it concurrently.
|
||||
/// </summary>
|
||||
[Collection(DataConnectionGaugeCollection.Name)]
|
||||
public sealed class ExtendedInstrumentTests
|
||||
{
|
||||
private static List<(long Value, Dictionary<string, object?> Tags)> Capture(string instrument, Action act)
|
||||
|
||||
Reference in New Issue
Block a user