From d9d9ff489ba4355b4179b7c3d73cd29d89952ce3 Mon Sep 17 00:00:00 2001 From: Joseph Doherty Date: Thu, 12 Nov 2026 21:07:30 -0500 Subject: [PATCH] feat(telemetry): Telemetry 0.3.0 - service.version, site.id/node.role, logs over OTLP (scadaproj#55) Pins ZB.MOM.WW.Telemetry(.Serilog) 0.1.0 -> 0.3.0. AddZbTelemetry now reads the whole MxGateway:Telemetry section through the shared ApplyConfiguration: node.role defaults to "standalone" (one gateway per box), MxGateway:Telemetry:SiteId / :NodeRole / :ServiceVersion / :ResourceAttributes:* are operator keys, and service.version defaults to the entry assembly's informational version (the git SHA). With MxGateway:Telemetry:Exporter=Otlp the Serilog logs go to the same collector too. Claude-Session: https://claude.ai/code/session_01GT67ACmpMR7b9LGRPLijMi --- src/ZB.MOM.WW.MxGateway.Server/GatewayApplication.cs | 12 +++++++----- .../ZB.MOM.WW.MxGateway.Server.csproj | 4 ++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/ZB.MOM.WW.MxGateway.Server/GatewayApplication.cs b/src/ZB.MOM.WW.MxGateway.Server/GatewayApplication.cs index bd7e5e1a..312ef0f8 100644 --- a/src/ZB.MOM.WW.MxGateway.Server/GatewayApplication.cs +++ b/src/ZB.MOM.WW.MxGateway.Server/GatewayApplication.cs @@ -121,11 +121,13 @@ public static class GatewayApplication { o.ServiceName = "mxgateway"; o.Meters = [GatewayMetrics.MeterName]; // "MxGateway.Server" — name unchanged - if (Enum.TryParse(builder.Configuration["MxGateway:Telemetry:Exporter"], ignoreCase: true, out var exporter)) - o.Exporter = exporter; - var otlp = builder.Configuration["MxGateway:Telemetry:OtlpEndpoint"]; - if (!string.IsNullOrWhiteSpace(otlp)) - o.OtlpEndpoint = otlp; + // Resource identity (scadaproj#55): the gateway is one process per box, so node.role + // defaults to "standalone"; site.id has no natural value and comes from config. + // service.version defaults from the entry assembly (the git SHA). + o.NodeRole = "standalone"; + // MxGateway:Telemetry:{Exporter, OtlpEndpoint, ServiceVersion, SiteId, NodeRole, + // ExportLogs, ResourceAttributes:*}. Exporter=Otlp also sends the Serilog logs (0.3.0). + o.ApplyConfiguration(builder.Configuration.GetSection("MxGateway:Telemetry")); }); builder.Services.AddSingleton(); builder.Services.AddSingleton(); diff --git a/src/ZB.MOM.WW.MxGateway.Server/ZB.MOM.WW.MxGateway.Server.csproj b/src/ZB.MOM.WW.MxGateway.Server/ZB.MOM.WW.MxGateway.Server.csproj index e609290e..0a9a6361 100644 --- a/src/ZB.MOM.WW.MxGateway.Server/ZB.MOM.WW.MxGateway.Server.csproj +++ b/src/ZB.MOM.WW.MxGateway.Server/ZB.MOM.WW.MxGateway.Server.csproj @@ -18,8 +18,8 @@ - - + +