feat(scadabridge): add ScadaBridgeTelemetry meter + 4 instruments; register with OTel

This commit is contained in:
Joseph Doherty
2026-06-01 16:41:52 -04:00
parent bbc9f09268
commit fe25ac3e51
3 changed files with 130 additions and 1 deletions
@@ -0,0 +1,32 @@
using ZB.MOM.WW.ScadaBridge.Commons.Observability;
namespace ZB.MOM.WW.ScadaBridge.Host.Tests;
/// <summary>
/// Infrastructure-free guards for <see cref="ScadaBridgeTelemetry"/>: the meter name is the
/// stable value registered with OTel, and the emit helpers are safe to call (they are no-op
/// until follow-on tasks wire real emit points and a listener attaches).
/// </summary>
public class ScadaBridgeTelemetryTests
{
[Fact]
public void MeterName_IsStableValue()
{
Assert.Equal("ZB.MOM.WW.ScadaBridge", ScadaBridgeTelemetry.MeterName);
}
[Fact]
public void EmitHelpers_DoNotThrow()
{
var ex = Record.Exception(() =>
{
ScadaBridgeTelemetry.RecordDeploymentApplied();
ScadaBridgeTelemetry.RecordInboundApiRequest("X");
ScadaBridgeTelemetry.SiteConnectionOpened();
ScadaBridgeTelemetry.SiteConnectionClosed();
ScadaBridgeTelemetry.SetQueueDepthProvider(() => 5);
});
Assert.Null(ex);
}
}