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

otelhttp: handle nil base http transport #713

Merged
merged 3 commits into from
Apr 6, 2021

Conversation

kjschnei001
Copy link
Contributor

@kjschnei001 kjschnei001 commented Mar 26, 2021

The purpose of this PR is to add a nil check in the otelhttp.NewTransport function. I noticed this issue while I was using this library on a codebase where the transport was optionally nil. When calling Do on the wrapped client, it was throwing a nil pointer.

Rather than put the onus on the user to make this check, it would be good to just transparently handle this case with a sane default (i.e. use the http.DefaultTransport).

@codecov
Copy link

codecov bot commented Mar 26, 2021

Codecov Report

Merging #713 (7089298) into main (e8c2192) will increase coverage by 0.0%.
The diff coverage is 100.0%.

Impacted file tree graph

@@          Coverage Diff          @@
##            main    #713   +/-   ##
=====================================
  Coverage   78.4%   78.4%           
=====================================
  Files         60      60           
  Lines       2712    2714    +2     
=====================================
+ Hits        2128    2130    +2     
  Misses       452     452           
  Partials     132     132           
Impacted Files Coverage Δ
instrumentation/net/http/otelhttp/transport.go 78.5% <100.0%> (+1.0%) ⬆️

@MrAlias MrAlias requested a review from paivagustavo as a code owner April 6, 2021 15:22
@MrAlias MrAlias merged commit ae2c628 into open-telemetry:main Apr 6, 2021
plantfansam referenced this pull request in plantfansam/opentelemetry-go-contrib Mar 18, 2022
* Update CODEOWNERS

* Add Evan Torrie to CONTRIBUTING

Co-authored-by: Tyler Yahn <[email protected]>
@pellared pellared added this to the untracked milestone Nov 8, 2024
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.

5 participants