Skip to content

Guard nil metrics before request logging middleware#44

Merged
haasonsaas merged 1 commit intomainfrom
codex/asb-nil-metrics
Apr 14, 2026
Merged

Guard nil metrics before request logging middleware#44
haasonsaas merged 1 commit intomainfrom
codex/asb-nil-metrics

Conversation

@haasonsaas
Copy link
Copy Markdown
Collaborator

Summary

  • return the request-id wrapper directly when metrics are unavailable
  • add a regression covering the nil-metrics handler path

Testing

  • go test ./cmd/asb-api -count=1

@cursor
Copy link
Copy Markdown

cursor bot commented Apr 14, 2026

PR Summary

Low Risk
Low risk: small control-flow change to skip request logging/metrics middleware when metrics is nil, plus a regression test. Main behavior change is that requests still get X-Request-Id but no metrics/logging are recorded in this configuration.

Overview
newObservedHandler now guards against nil metrics by returning only the WithRequestID wrapper, avoiding invoking the request logging/metrics middleware when metrics aren’t configured.

Adds TestNewObservedHandlerAllowsNilMetrics to ensure the handler still serves requests successfully and includes an X-Request-Id header when metrics is nil.

Reviewed by Cursor Bugbot for commit c64989c. Bugbot is set up for automated code reviews on this repo. Configure here.

@haasonsaas haasonsaas merged commit 3c07489 into main Apr 14, 2026
4 checks passed
@haasonsaas haasonsaas deleted the codex/asb-nil-metrics branch April 14, 2026 04:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant