Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the otelhttp Transport handle protocol switching #1628

Merged
merged 9 commits into from
Feb 10, 2022

Conversation

MrAlias
Copy link
Contributor

@MrAlias MrAlias commented Jan 31, 2022

Fixes #1329

The otelhttp.Transport type wraps the response body returned from the HTTP request. Response bodies from requests to protocol switch (e.g. WebSockets, h2c) will contain a writable response body implementing the io.ReadWriteCloser interface. This interface needs to continue being satisfied so these new protocols can write directly to the opened TCP socket. This changes the wrappedBody type to implement an io.ReadWriteCloser and appropriately scopes the response body implementation to match the original (removing the Write method of the wrappedBody when it is not supported).

@codecov
Copy link

codecov bot commented Jan 31, 2022

Codecov Report

❗ No coverage uploaded for pull request base (main@e3db96c). Click here to learn what that means.
The diff coverage is 100.0%.

Impacted file tree graph

@@          Coverage Diff           @@
##             main   #1628   +/-   ##
======================================
  Coverage        ?   69.5%           
======================================
  Files           ?     127           
  Lines           ?    5448           
  Branches        ?       0           
======================================
  Hits            ?    3787           
  Misses          ?    1519           
  Partials        ?     142           
Impacted Files Coverage Δ
instrumentation/net/http/otelhttp/transport.go 94.6% <100.0%> (ø)

@MrAlias MrAlias added the bug Something isn't working label Jan 31, 2022
@MrAlias MrAlias merged commit 1005161 into open-telemetry:main Feb 10, 2022
@MrAlias MrAlias deleted the fix-1329 branch February 10, 2022 16:09
@MrAlias MrAlias mentioned this pull request Feb 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

otelhttp.Transport is unable to properly handle protocol switching (e.g. for websockets)
3 participants