From 368390ea9d9684251128239f7cc70a86c99e8d04 Mon Sep 17 00:00:00 2001 From: Joseph Doherty Date: Mon, 1 Jun 2026 15:29:46 -0400 Subject: [PATCH 1/4] build(otopcua): reference ZB.MOM.WW.Telemetry packages from Gitea feed --- Directory.Packages.props | 2 ++ NuGet.config | 2 ++ src/Server/ZB.MOM.WW.OtOpcUa.Host/ZB.MOM.WW.OtOpcUa.Host.csproj | 2 ++ 3 files changed, 6 insertions(+) diff --git a/Directory.Packages.props b/Directory.Packages.props index 95f12360..3cfe564c 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -99,6 +99,8 @@ + + diff --git a/NuGet.config b/NuGet.config index b7b4042e..779fb609 100644 --- a/NuGet.config +++ b/NuGet.config @@ -15,6 +15,8 @@ + + diff --git a/src/Server/ZB.MOM.WW.OtOpcUa.Host/ZB.MOM.WW.OtOpcUa.Host.csproj b/src/Server/ZB.MOM.WW.OtOpcUa.Host/ZB.MOM.WW.OtOpcUa.Host.csproj index 667dd36a..9317e6c4 100644 --- a/src/Server/ZB.MOM.WW.OtOpcUa.Host/ZB.MOM.WW.OtOpcUa.Host.csproj +++ b/src/Server/ZB.MOM.WW.OtOpcUa.Host/ZB.MOM.WW.OtOpcUa.Host.csproj @@ -30,6 +30,8 @@ + + From 26bae36f8b90117a4bbb17e743292840031a3865 Mon Sep 17 00:00:00 2001 From: Joseph Doherty Date: Mon, 1 Jun 2026 15:33:28 -0400 Subject: [PATCH 2/4] feat(otopcua): wire OTel via AddZbTelemetry (shared Resource + std instrumentation) --- .../Observability/ObservabilityExtensions.cs | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/Server/ZB.MOM.WW.OtOpcUa.Host/Observability/ObservabilityExtensions.cs b/src/Server/ZB.MOM.WW.OtOpcUa.Host/Observability/ObservabilityExtensions.cs index be79d120..9257cdf6 100644 --- a/src/Server/ZB.MOM.WW.OtOpcUa.Host/Observability/ObservabilityExtensions.cs +++ b/src/Server/ZB.MOM.WW.OtOpcUa.Host/Observability/ObservabilityExtensions.cs @@ -1,6 +1,5 @@ -using OpenTelemetry.Metrics; -using OpenTelemetry.Trace; using ZB.MOM.WW.OtOpcUa.Commons.Observability; +using ZB.MOM.WW.Telemetry; namespace ZB.MOM.WW.OtOpcUa.Host.Observability; @@ -17,14 +16,12 @@ public static class ObservabilityExtensions /// The service collection to add observability services to. public static IServiceCollection AddOtOpcUaObservability(this IServiceCollection services) { - services.AddOpenTelemetry() - .WithMetrics(b => b - .AddMeter(OtOpcUaTelemetry.MeterName) - .AddPrometheusExporter()) - .WithTracing(b => b - .AddSource(OtOpcUaTelemetry.ActivitySourceName)); - - return services; + return services.AddZbTelemetry(o => + { + o.ServiceName = "otopcua"; + o.Meters = [OtOpcUaTelemetry.MeterName]; + o.ActivitySources = [OtOpcUaTelemetry.ActivitySourceName]; + }); } /// @@ -35,7 +32,7 @@ public static class ObservabilityExtensions /// The endpoint route builder. public static IEndpointRouteBuilder MapOtOpcUaMetrics(this IEndpointRouteBuilder app) { - app.MapPrometheusScrapingEndpoint("/metrics"); + app.MapZbMetrics(); return app; } } From 60017177cb8848295b445104804bb5e5c3f0a2ea Mon Sep 17 00:00:00 2001 From: Joseph Doherty Date: Mon, 1 Jun 2026 15:41:21 -0400 Subject: [PATCH 3/4] feat(otopcua): adopt AddZbSerilog (shared enrichers + trace correlation); sinks to config --- src/Server/ZB.MOM.WW.OtOpcUa.Host/Program.cs | 10 +++++----- src/Server/ZB.MOM.WW.OtOpcUa.Host/appsettings.json | 10 +++++++++- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/Server/ZB.MOM.WW.OtOpcUa.Host/Program.cs b/src/Server/ZB.MOM.WW.OtOpcUa.Host/Program.cs index 4a9dd50c..9ae0abb7 100644 --- a/src/Server/ZB.MOM.WW.OtOpcUa.Host/Program.cs +++ b/src/Server/ZB.MOM.WW.OtOpcUa.Host/Program.cs @@ -20,6 +20,7 @@ using ZB.MOM.WW.OtOpcUa.Runtime; using ZB.MOM.WW.OtOpcUa.Security; using ZB.MOM.WW.OtOpcUa.Security.Endpoints; using ZB.MOM.WW.OtOpcUa.Security.Ldap; +using ZB.MOM.WW.Telemetry.Serilog; // Roles drive the entire conditional wiring below — see ZB.MOM.WW.OtOpcUa.Cluster.RoleParser. var roles = RoleParser.Parse(Environment.GetEnvironmentVariable("OTOPCUA_ROLES")); @@ -45,11 +46,10 @@ var roleSuffix = roles.Length == 0 ? null : string.Join('-', roles.OrderBy(r => if (roleSuffix is not null) builder.Configuration.AddJsonFile($"appsettings.{roleSuffix}.json", optional: true, reloadOnChange: true); -// Serilog — rolling daily file sink per CLAUDE.md. Console for local dev. -builder.Host.UseSerilog((ctx, lc) => lc - .ReadFrom.Configuration(ctx.Configuration) - .WriteTo.Console() - .WriteTo.File("logs/otopcua-.log", rollingInterval: RollingInterval.Day)); +// Serilog — shared ZB.MOM.WW.Telemetry bootstrap. Sinks (Console + rolling daily file) +// now live in appsettings.json (ReadFrom.Configuration); AddZbSerilog layers in the +// shared NodeHostname / TraceContext / Redaction enrichers and trace correlation. +builder.AddZbSerilog(o => o.ServiceName = "otopcua"); // Windows-service registration is handled at install time by scripts/install/Install-Services.ps1 // (Task 62) rather than in-process, so the binary stays cross-platform-compilable. diff --git a/src/Server/ZB.MOM.WW.OtOpcUa.Host/appsettings.json b/src/Server/ZB.MOM.WW.OtOpcUa.Host/appsettings.json index 0967ef42..ec8ed457 100644 --- a/src/Server/ZB.MOM.WW.OtOpcUa.Host/appsettings.json +++ b/src/Server/ZB.MOM.WW.OtOpcUa.Host/appsettings.json @@ -1 +1,9 @@ -{} +{ + "Serilog": { + "Using": [ "Serilog.Sinks.Console", "Serilog.Sinks.File" ], + "WriteTo": [ + { "Name": "Console" }, + { "Name": "File", "Args": { "path": "logs/otopcua-.log", "rollingInterval": "Day" } } + ] + } +} From c05ffc7b39e3f1043109f7e0803662c24ddde9dd Mon Sep 17 00:00:00 2001 From: Joseph Doherty Date: Mon, 1 Jun 2026 16:03:15 -0400 Subject: [PATCH 4/4] build(otopcua): add to NuGet.config packageSources for supply-chain hygiene parity --- NuGet.config | 1 + 1 file changed, 1 insertion(+) diff --git a/NuGet.config b/NuGet.config index 779fb609..10fb209a 100644 --- a/NuGet.config +++ b/NuGet.config @@ -1,6 +1,7 @@ +