Skip to content

[log] Add debug logging to LoadGatewayTLS#5971

Merged
lpcox merged 2 commits into
mainfrom
log/gateway-tls-logging-dd1b6e94d612dd20
May 19, 2026
Merged

[log] Add debug logging to LoadGatewayTLS#5971
lpcox merged 2 commits into
mainfrom
log/gateway-tls-logging-dd1b6e94d612dd20

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

Summary

Enhances internal/server/gateway_tls.go with additional debug logging calls in LoadGatewayTLS to improve observability during TLS configuration setup.

Changes

File modified: internal/server/gateway_tls.go

Log calls added/improved:

  1. (improved) Log leaf certificate count after key pair loaded
  2. (new) Log CA certificate pool built successfully (mTLS path)
  3. (new) Log one-way TLS configured (no client certs required)
  4. (new) Log final TLS configuration ready with mtls status

Validation

  • go build ./... passes
  • go vet ./... passes

Logger

Reuses existing var logGatewayTLS = logger.New("server:tls") — no new logger declaration needed.

Generated by Go Logger Enhancement · ● 9.9M ·

Enhance LoadGatewayTLS with additional logging to improve
observability during TLS setup:

- Log leaf certificate count after server key pair is loaded
- Log success when CA pool is built (mTLS path)
- Log when one-way TLS is configured (no client certs required)
- Log final TLS configuration summary with mtls status

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot added automation enhancement New feature or request labels May 18, 2026
@lpcox lpcox marked this pull request as ready for review May 19, 2026 03:40
Copilot AI review requested due to automatic review settings May 19, 2026 03:40
Copy link
Copy Markdown
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

Adds debug logging in LoadGatewayTLS to improve observability around gateway TLS and mTLS setup.

Changes:

  • Logs certificate chain count after loading the server key pair.
  • Logs CA pool creation and one-way TLS path selection.
  • Logs final TLS configuration readiness and mTLS status.
Show a summary per file
File Description
internal/server/gateway_tls.go Adds debug logs throughout TLS configuration loading.

Copilot's findings

Tip

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

  • Files reviewed: 1/1 changed files
  • Comments generated: 2

Comment thread internal/server/gateway_tls.go Outdated
return nil, fmt.Errorf("failed to load server TLS certificate/key: %w", err)
}
logGatewayTLS.Print("server TLS key pair loaded")
logGatewayTLS.Printf("server TLS key pair loaded: leafCertCount=%d", len(serverCert.Certificate))
Comment thread internal/server/gateway_tls.go Outdated
logGatewayTLS.Print("one-way TLS configured: client certificates not required")
}

logGatewayTLS.Printf("gateway TLS configuration ready: minVersion=TLS1.2, mtls=%v", caPath != "")
@lpcox
Copy link
Copy Markdown
Collaborator

lpcox commented May 19, 2026

@copilot address the review feedback

- Rename leafCertCount to certChainLen to accurately reflect that
  len(serverCert.Certificate) is the DER cert chain length, not a leaf count
- Replace hard-coded "TLS1.2" with tls.VersionName(cfg.MinVersion) so the
  logged value always reflects the actual configured minimum version
Copy link
Copy Markdown
Contributor

Copilot AI commented May 19, 2026

@copilot address the review feedback

Both issues addressed in the latest commit:

  1. leafCertCountcertChainLenlen(serverCert.Certificate) counts the DER-encoded certs in the loaded chain (can be >1 for full chains), so the field name now reflects that accurately.
  2. Hard-coded "TLS1.2"tls.VersionName(cfg.MinVersion) — the logged version is now derived directly from cfg.MinVersion, so it stays accurate if the minimum version ever changes.

Copilot finished work on behalf of lpcox May 19, 2026 05:06
Copilot AI requested a review from lpcox May 19, 2026 05:06
@lpcox lpcox merged commit e06554f into main May 19, 2026
16 checks passed
@lpcox lpcox deleted the log/gateway-tls-logging-dd1b6e94d612dd20 branch May 19, 2026 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants