Skip to content

Feat/client httptrace#453

Merged
fredbi merged 2 commits into
go-openapi:masterfrom
fredbi:feat/client-httptrace
May 14, 2026
Merged

Feat/client httptrace#453
fredbi merged 2 commits into
go-openapi:masterfrom
fredbi:feat/client-httptrace

Conversation

@fredbi
Copy link
Copy Markdown
Member

@fredbi fredbi commented May 14, 2026

Change type

Please select: 🆕 New feature or enhancement|🔧 Bug fix'|📃 Documentation update

Short description

Fixes

Full description

Checklist

  • I have signed all my commits with my name and email (see DCO. This does not require a PGP-signed commit
  • I have rebased and squashed my work, so only one commit remains
  • I have added tests to cover my changes.
  • I have properly enriched go doc comments in code.
  • I have properly documented any breaking change.

fredbi and others added 2 commits May 14, 2026 23:28
Opt-in r.Trace flag that narrates the HTTP client lifecycle via
net/http/httptrace: DNS, dial, TLS handshake, idle-pool reuse,
request and response body chunks, time-to-first-byte and a
trailing per-request summary. Designed as a problem-investigation
tool (curl -vvv equivalent), orthogonal to Debug (wire-byte dumps)
and OpenTelemetry (distributed traces).

The toggle is not coupled to SWAGGER_DEBUG / DEBUG environment
variables: it defaults to false and is only enabled by explicit
assignment.

Includes issue-go-openapi#336 annotations: a HEADS-UP line on reused idle
conns older than 30s, plus a tail diagnostic block when round-trip
fails on a stale-idle reuse.

TLS-failure diagnostic mode and prose documentation follow in
subsequent commits.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
When the TLS handshake fails, Runtime.Trace now emits a structured
diagnostic block that classifies the failure into one of three axes
and renders actionable context for each:

- protocol-version: client-offered range, error class, suggested
  fix. Detected via the protocol_version TLS alert (70) or local
  "unsupported protocol" errors.
- cipher-suite: configured CipherSuites, note that the server's
  set is not exposed by the stdlib. Detected via handshake_failure
  alert (40) with a non-empty client-side restriction.
- cert-chain: distinguishes expired / unknown-CA / hostname-mismatch
  via errors.As against x509.CertificateInvalidError,
  x509.UnknownAuthorityError and x509.HostnameError. Each reason
  renders the relevant cert fields, the trust store in use and a
  targeted suggestion.

The diagnostic introspects the http.Transport.TLSClientConfig when
reachable, falling back to "configured: not introspectable" for
custom transports. Tests cover all four failure axes plus the
happy-path summary line.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented May 14, 2026

Codecov Report

❌ Patch coverage is 66.90647% with 138 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.45%. Comparing base (eaa96ed) to head (159e452).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
client/httptrace_tls.go 52.19% 78 Missing and 9 partials ⚠️
client/httptrace.go 77.02% 44 Missing and 7 partials ⚠️

❌ Your patch check has failed because the patch coverage (66.90%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #453      +/-   ##
==========================================
- Coverage   85.06%   83.45%   -1.62%     
==========================================
  Files          60       62       +2     
  Lines        3970     4387     +417     
==========================================
+ Hits         3377     3661     +284     
- Misses        449      567     +118     
- Partials      144      159      +15     

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

@fredbi fredbi merged commit 0a653d3 into go-openapi:master May 14, 2026
19 of 21 checks passed
@fredbi fredbi deleted the feat/client-httptrace branch May 14, 2026 21:32
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