Fix all baseline code-review findings across the six shared libraries
Resolves the 35 findings from the 2026-06-01 baseline (commit 26ba1c7),
test-first for every behavioral change. +51 tests (331 -> 382 passing, 0 failed).
- Telemetry-001 (HIGH): RedactionEnricher now honours property removal, so a
redactor that drops a key actually scrubs the secret from the event.
- Auth: LDAP validator ValidateOnStart; API-key verify no longer fails on a
best-effort MarkUsed write or a corrupt scopes column (fail-closed); LDAP cert
validation hook; KeyPrefix persistence aligned; README algorithm corrected.
- Health: Akka checks return Degraded (not throw) when the cluster isn't up yet;
GrpcDependencyHealthCheck catch-all; null 'description' rendered; composite
endpoint builder; XML docs shipped.
- Audit: CompositeAuditWriter no longer re-throws OperationCanceledException;
TruncatingAuditRedactor over-redact scrubs Target + safe negative max; options
record; XML docs shipped.
- Configuration: TryAddEnumerable idempotent registration; consistent port
quoting; strict invariant port parsing; XML docs + README packaged.
- Theme: mobile toggle is now CSS-only (no Bootstrap JS); token/CSS hygiene;
XML docs on the public parameter surface.
Shared-contract/spec docs updated where the code was the source of truth
(observability service.instance.id, MapZbMetrics, redactor reach). All changes
additive/back-compatible at v0.1.0. code-reviews bookkeeping follows separately.
This commit is contained in:
@@ -124,17 +124,32 @@ public static class ZbTelemetryExtensions
|
||||
/// Used internally by AddZbTelemetry. Exposed for tests and custom pipelines.
|
||||
public static class ZbResource
|
||||
{
|
||||
/// Deterministic, process-stable service instance identifier, formatted as
|
||||
/// "MachineName:ProcessId". Populates OTel Resource service.instance.id on every signal
|
||||
/// (metrics, traces, logs). The OTel SDK's random-GUID default is disabled in favour of this
|
||||
/// value so all signals from one process share one restart-stable instance id, enabling
|
||||
/// cross-signal correlation. Always present (not optional).
|
||||
public static string InstanceId { get; }
|
||||
|
||||
/// Returns a ResourceBuilder pre-populated with service.name, service.namespace,
|
||||
/// service.version, site.id, node.role, and host.name (always Environment.MachineName).
|
||||
/// Attributes with null values are omitted from the Resource.
|
||||
/// service.version, service.instance.id (always — see InstanceId), site.id, node.role, and
|
||||
/// host.name (always Environment.MachineName). Attributes with null/empty values are omitted.
|
||||
public static ResourceBuilder Build(ZbTelemetryOptions options);
|
||||
|
||||
/// The single source of truth for the shared Resource attribute set. Both the OTel SDK
|
||||
/// metrics/traces pipeline and the Serilog OTLP log sink derive their attributes from this one
|
||||
/// map, so logs cannot drift from metrics/traces. service.name/namespace/instance.id/host.name
|
||||
/// are always present; service.version/site.id/node.role are included only when the option is
|
||||
/// non-null/non-empty.
|
||||
public static IReadOnlyDictionary<string, object> BuildAttributes(ZbTelemetryOptions options);
|
||||
}
|
||||
|
||||
/// Endpoint extension for mounting the Prometheus /metrics scrape endpoint.
|
||||
public static class ZbMetricsEndpointExtensions
|
||||
{
|
||||
/// Mounts the Prometheus /metrics endpoint.
|
||||
/// Only valid when ZbTelemetryOptions.Exporter = ZbExporter.Prometheus (or both).
|
||||
/// Mounts the Prometheus /metrics endpoint. Valid under ANY ZbTelemetryOptions.Exporter value:
|
||||
/// AddZbTelemetry always wires the Prometheus exporter, and OTLP (ZbExporter.Otlp) is only an
|
||||
/// additive overlay — so /metrics serves scrape data even when Exporter = ZbExporter.Otlp.
|
||||
/// Call after app.UseRouting().
|
||||
public static IEndpointConventionBuilder MapZbMetrics(
|
||||
this IEndpointRouteBuilder endpoints);
|
||||
|
||||
Reference in New Issue
Block a user