Skip to content

chore(logs): add HTTP trace logs - #79

Open
irby wants to merge 2 commits into
release-2.6from
chore/logs/httptrace
Open

irby wants to merge 2 commits into
release-2.6from
chore/logs/httptrace

Conversation

@irby

@irby irby commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

do not merge.

adds in http trace logs to help understand occasional transient networking issues caused when interacting with a proxy.

Signed-off-by: Matthew H. Irby <matt.irby@keyfactor.com>
Copilot AI balanced review requested due to automatic review settings October 26, 2026 20:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Tracing changes health-check timeout and validation behavior, misses constructor-time failures, and can misclassify failure stages.

6 open issues
What changed in this PR

Adds opt-in HTTP tracing to the Command client to help diagnose intermittent proxy-related networking failures. The PR is marked “do not merge.”

Changes:

  • Adds structured connection, timing, and error logs controlled by COMMAND_ISSUER_HTTP_TRACE.
  • Integrates tracing into client setup and adds health-check, SDK-request, and EOF tests.
  • Expands end-to-end environment-file ignore rules.
File Description
internal/​command/​httptrace.go Adds the tracing wrapper and request diagnostics.
internal/​command/​httptrace_test.go Tests tracing output, failures, and enablement.
internal/​command/​command.go Enables tracing during signer setup.
e2e/​.gitignore Ignores all *.env files.

Review effort: Balanced

Comment thread internal/command/httptrace.go Outdated
Comment on lines +284 to +288
if httpTraceEnabled() && client != nil && client.V1 != nil {
// Use the global logger: the client is cached for the process lifetime, so a
// logger derived from this reconcile's ctx would carry a stale reconcileID.
log.Info("HTTP tracing enabled; each request to Command will emit an 'http trace' log line", "env", EnvHTTPTrace)
client.V1.AuthClient = enableHTTPTrace(client.V1.AuthClient, serverConfig, ctrl.Log)
Comment thread internal/command/httptrace.go Outdated
Comment thread internal/command/httptrace.go Outdated
Comment on lines +225 to +226
case !r.wroteRequest.IsZero():
return "request-written-awaiting-response"
Comment on lines +233 to +234
case !r.connectStart.IsZero() && r.connectDone.IsZero():
return "tcp-connect"
Signed-off-by: Matthew H. Irby <matt.irby@keyfactor.com>
Copilot AI balanced review requested due to automatic review settings October 26, 2026 20:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Parallel connection attempts can produce mismatched addresses and timings, undermining the diagnostic logs.

3 open issues
1 previously missed issue

In code that hasn't changed since last review

Medium severity Correlate parallel dial attempts with results

internal/​command/​httptrace.go:190

Parallel dial attempts overwrite the same connectStart and connectAddr, while ConnectDone records a successful completion without correlating its address. For example, if IPv6 starts first, IPv4 starts later, and IPv6 wins, tcpConnect is measured from the IPv4 start and connectAddr incorrectly names the IPv4 endpoint. Track start times by network/address and select the matching successful attempt, or log each attempt separately, so the diagnostic reports consistent addresses and timings.

3 resolved since last review

Review effort: Balanced

This branch has not been deployed

No deployments
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.

2 participants