feat(scadabridge): wire AddZbTelemetry + /metrics in both composition roots
This commit is contained in:
@@ -11,6 +11,7 @@ using ZB.MOM.WW.ScadaBridge.NotificationService;
|
||||
using ZB.MOM.WW.ScadaBridge.SiteEventLogging;
|
||||
using ZB.MOM.WW.ScadaBridge.SiteRuntime;
|
||||
using ZB.MOM.WW.ScadaBridge.StoreAndForward;
|
||||
using ZB.MOM.WW.Telemetry;
|
||||
|
||||
namespace ZB.MOM.WW.ScadaBridge.Host;
|
||||
|
||||
@@ -114,5 +115,19 @@ public static class SiteServiceRegistration
|
||||
// writers so they can stamp the SourceNode column. Registered here in
|
||||
// shared bootstrap because every node (central + site) needs it.
|
||||
services.AddSingleton<INodeIdentityProvider, NodeIdentityProvider>();
|
||||
|
||||
// Observability — shared ZB.MOM.WW.Telemetry. Registered in shared bootstrap so
|
||||
// BOTH the central and site composition roots wire the OTel Resource (the
|
||||
// service.name/site.id/node.role identity triple) + standard instrumentation +
|
||||
// the always-on Prometheus exporter. Mount the /metrics scrape endpoint per role
|
||||
// with app.MapZbMetrics(). The same `?? "central"` SiteId default Program.cs uses
|
||||
// is applied here so the Resource attribute matches the log-enricher value.
|
||||
// Meters left empty — application instruments are a deferred follow-on.
|
||||
services.AddZbTelemetry(o =>
|
||||
{
|
||||
o.ServiceName = "scadabridge";
|
||||
o.SiteId = config["ScadaBridge:Node:SiteId"] ?? "central";
|
||||
o.NodeRole = config["ScadaBridge:Node:Role"];
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user