feat(telemetry): core review fixes (Prometheus+OTLP coexistence, ServiceName validation, null guards) + contract overload note
- Fix #1: Prometheus exporter always wired for metrics; OTLP is additive overlay when Exporter == ZbExporter.Otlp so /metrics + MapZbMetrics work in all modes. - Fix #2: BuildOptions throws ArgumentException when ServiceName is null/whitespace. - Fix #3: AddZbTelemetry(IHostApplicationBuilder) guard: ThrowIfNull(configure) added alongside existing ThrowIfNull(builder). - Fix #6: Contract doc adds IServiceCollection convenience overload signature. - Tests: +3 new tests (OtlpExporter still serves /metrics, empty ServiceName throws, whitespace ServiceName throws). Total: 7 passed (was 4).
This commit is contained in:
@@ -111,6 +111,13 @@ public static class ZbTelemetryExtensions
|
||||
public static IServiceCollection AddZbTelemetry(
|
||||
this IServiceCollection services,
|
||||
ZbTelemetryOptions options);
|
||||
|
||||
/// IServiceCollection convenience overload that accepts a configure delegate.
|
||||
/// Equivalent to calling BuildOptions(configure) then AddZbTelemetry(services, options).
|
||||
/// Use when only an IServiceCollection is available but the lambda form is preferred.
|
||||
public static IServiceCollection AddZbTelemetry(
|
||||
this IServiceCollection services,
|
||||
Action<ZbTelemetryOptions> configure);
|
||||
}
|
||||
|
||||
/// Builds the shared OTel ResourceBuilder from ZbTelemetryOptions.
|
||||
|
||||
Reference in New Issue
Block a user