feat(telemetry): 0.3.0 ApplyConfiguration reads an app's telemetry section (#55)

Exporter, OtlpEndpoint, ServiceVersion, SiteId, NodeRole, ExportLogs and
ResourceAttributes:<key> from <App>:Telemetry, absent keys keep code defaults, so
the four apps stop re-implementing the exporter parse and gain the identity keys.

Claude-Session: https://claude.ai/code/session_01GT67ACmpMR7b9LGRPLijMi
This commit is contained in:
Joseph Doherty
2026-11-12 21:03:29 -05:00
parent cfc7168ace
commit 2011c8d6b9
3 changed files with 141 additions and 3 deletions
+7 -3
View File
@@ -83,6 +83,10 @@ intact (not reallocated). See the `ILogRedactor` XML doc for the full contract.
The same attribute set goes to metrics, traces and the OTLP log sink.
`options.ApplyConfiguration(config.GetSection("<App>:Telemetry"))` reads the operator keys from an
app's own section — `Exporter`, `OtlpEndpoint`, `ServiceVersion`, `SiteId`, `NodeRole`, `ExportLogs`,
`ResourceAttributes:<key>` — leaving any absent key at the code default the app set before the call.
## Exporter options
Prometheus is **always wired** for metrics regardless of the `Exporter` setting. OTLP is an
@@ -156,9 +160,9 @@ backend):
| Assembly | Tests |
|---|---|
| `ZB.MOM.WW.Telemetry.Tests` | 35 |
| `ZB.MOM.WW.Telemetry.Tests` | 38 |
| `ZB.MOM.WW.Telemetry.Serilog.Tests` | 39 |
| **Total** | **74** |
| **Total** | **77** |
The log-export tests start a loopback OTLP/gRPC receiver on Kestrel (no external collector).
@@ -185,7 +189,7 @@ lockstep from `Directory.Build.props`.
## Status
**`0.3.0`** (scadaproj#55) is the current release on the Gitea feed: `service.version` defaults from the
entry assembly, `ResourceAttributes` for extra Resource attributes, logs follow `AddZbTelemetry`'s OTLP
entry assembly, `ResourceAttributes` for extra Resource attributes, `ApplyConfiguration` for an app's telemetry config section, logs follow `AddZbTelemetry`'s OTLP
exporter, and the 0.2.1 review fixes (including the stricter OTLP endpoint check: a scheme-less
`host:port` now fails at startup when `Exporter = Otlp`). Feed versions: `0.1.0`, `0.2.0`, `0.3.0`
(`0.2.1` was never published). Consumer pins: see `CLAUDE.md`. Adoption history is in the component backlog: