Skip to content

feat: add Hijack support for WebSocket upgrades in metrics handler#106

Merged
Suhaibinator merged 1 commit intomainfrom
websocketSupportMetricsHandler
Dec 21, 2025
Merged

feat: add Hijack support for WebSocket upgrades in metrics handler#106
Suhaibinator merged 1 commit intomainfrom
websocketSupportMetricsHandler

Conversation

@Suhaibinator
Copy link
Owner

No description provided.

@codecov
Copy link

codecov bot commented Dec 21, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.48%. Comparing base (2efa456) to head (f2bd869).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #106   +/-   ##
=======================================
  Coverage   97.48%   97.48%           
=======================================
  Files          18       18           
  Lines        1867     1872    +5     
=======================================
+ Hits         1820     1825    +5     
  Misses         35       35           
  Partials       12       12           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Suhaibinator Suhaibinator merged commit 41d9e05 into main Dec 21, 2025
16 checks passed
@Suhaibinator Suhaibinator deleted the websocketSupportMetricsHandler branch December 21, 2025 06:59
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds Hijack interface support to the metrics middleware's response writer wrapper to enable WebSocket upgrades and other connection hijacking scenarios to work properly through the metrics layer.

  • Implements the http.Hijacker interface on the responseWriter struct
  • Delegates hijack calls to the underlying ResponseWriter when supported
  • Returns http.ErrNotSupported for ResponseWriters that don't support hijacking

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
pkg/metrics/handler_method.go Adds Hijack() method to responseWriter that delegates to underlying ResponseWriter when it implements http.Hijacker
pkg/metrics/metrics_test.go Adds MockHijackResponseWriter mock and two test cases covering both successful hijack and unsupported hijack scenarios

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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

Comments