refactor(otel): reduce NewTelemetry cyclomatic complexity from 20 to ≤16#378
Conversation
Extracts normalizeEndpoint, handleEmptyEndpoint, and initExporters helpers. No behavior change. X-Lerian-Ref: 0x1
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughThe Comment |
Summary
Reduces
NewTelemetrycyclomatic complexity from 20 to ≤16 by extracting three helper functions. No behavior change.Extracted Helpers
normalizeEndpoint(cfg *TelemetryConfig)— endpoint scheme stripping and insecure-mode inferencehandleEmptyEndpoint(cfg TelemetryConfig)— "enabled but no endpoint" noop fallback pathinitExporters(ctx, cfg)— OTLP exporter creation, provider setup, and rollback-on-failureTest plan
go build ./...passesgolangci-lint run ./commons/opentelemetry/...— 0 issues