feat(telemetry): Telemetry 0.3.0 - service.version, site.id/node.role, logs over OTLP (scadaproj#55)
ci / java (push) Failing after 11m45s
ci / windows-x86 (push) Successful in 3m47s
ci / portable (push) Failing after 26m59s
ci / nightly-windev (push) Failing after 14m4s

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
This commit is contained in:
Joseph Doherty
2026-11-12 21:07:30 -05:00
parent 31f7f9fc6e
commit d9d9ff489b
2 changed files with 9 additions and 7 deletions
@@ -121,11 +121,13 @@ public static class GatewayApplication
{ {
o.ServiceName = "mxgateway"; o.ServiceName = "mxgateway";
o.Meters = [GatewayMetrics.MeterName]; // "MxGateway.Server" — name unchanged o.Meters = [GatewayMetrics.MeterName]; // "MxGateway.Server" — name unchanged
if (Enum.TryParse<ZbExporter>(builder.Configuration["MxGateway:Telemetry:Exporter"], ignoreCase: true, out var exporter)) // Resource identity (scadaproj#55): the gateway is one process per box, so node.role
o.Exporter = exporter; // defaults to "standalone"; site.id has no natural value and comes from config.
var otlp = builder.Configuration["MxGateway:Telemetry:OtlpEndpoint"]; // service.version defaults from the entry assembly (the git SHA).
if (!string.IsNullOrWhiteSpace(otlp)) o.NodeRole = "standalone";
o.OtlpEndpoint = otlp; // 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<ILogRedactor, GatewayLogRedactorSeam>(); builder.Services.AddSingleton<ILogRedactor, GatewayLogRedactorSeam>();
builder.Services.AddSingleton<MxAccessGrpcMapper>(); builder.Services.AddSingleton<MxAccessGrpcMapper>();
@@ -18,8 +18,8 @@
<PackageReference Include="ZB.MOM.WW.Theme" Version="0.5.0" /> <PackageReference Include="ZB.MOM.WW.Theme" Version="0.5.0" />
<PackageReference Include="ZB.MOM.WW.Configuration" Version="0.1.0" /> <PackageReference Include="ZB.MOM.WW.Configuration" Version="0.1.0" />
<PackageReference Include="ZB.MOM.WW.Health" Version="0.3.0" /> <PackageReference Include="ZB.MOM.WW.Health" Version="0.3.0" />
<PackageReference Include="ZB.MOM.WW.Telemetry" Version="0.1.0" /> <PackageReference Include="ZB.MOM.WW.Telemetry" Version="0.3.0" />
<PackageReference Include="ZB.MOM.WW.Telemetry.Serilog" Version="0.1.0" /> <PackageReference Include="ZB.MOM.WW.Telemetry.Serilog" Version="0.3.0" />
<PackageReference Include="ZB.MOM.WW.GalaxyRepository" Version="0.2.0" /> <PackageReference Include="ZB.MOM.WW.GalaxyRepository" Version="0.2.0" />
<PackageReference Include="ZB.MOM.WW.Secrets" Version="0.6.2" /> <PackageReference Include="ZB.MOM.WW.Secrets" Version="0.6.2" />
<PackageReference Include="ZB.MOM.WW.Secrets.Abstractions" Version="0.6.2" /> <PackageReference Include="ZB.MOM.WW.Secrets.Abstractions" Version="0.6.2" />