Skip to content

feat(observability): add configurable target_addr log field (host/path/full)#92

Merged
qarlosh merged 2 commits intomasterfrom
feat/configurable-target-addr-logging
May 8, 2026
Merged

feat(observability): add configurable target_addr log field (host/path/full)#92
qarlosh merged 2 commits intomasterfrom
feat/configurable-target-addr-logging

Conversation

@qarlosh
Copy link
Copy Markdown
Collaborator

@qarlosh qarlosh commented May 7, 2026

Adds observability.log_target_addr (env: CHAPERONE_OBSERVABILITY_LOG_TARGET_ADDR) so operators can opt in to logging the upstream target with more detail. Three modes: host (default — authority only, same behavior PR #68 introduced), path (scheme + host + path, no query), full (full URL incl. query, userinfo always stripped).

Renames the target_host field to target_addr everywhere (15 log sites) so the same key carries the formatted value across the entire log pipeline. A single observability.FormatTargetAddr helper replaces three duplicated extract*Host helpers and guarantees byte-identical output across every site for a given request.

Emits an informational INFO at startup for path and a loud slog.Warn for full, mirroring the existing body-logging warning. Includes a cross-site consistency test that fails if any future log emits a different target_addr value than the rest within a single request.

arnaugiralt
arnaugiralt previously approved these changes May 7, 2026
Copy link
Copy Markdown
Member

@arnaugiralt arnaugiralt left a comment

Choose a reason for hiding this comment

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

LGTM, two minor comments, good work

Comment thread internal/config/validate.go Outdated
Comment thread chaperone.go
qarlosh added a commit that referenced this pull request May 8, 2026
…valid-modes list

Per Arnau's review on #92:
- config.ObservabilityConfig.LogTargetAddr is now observability.TargetAddrMode
  instead of string, eliminating casts at every use site (chaperone.go,
  loader.go, proxy server).
- Validation in validate.go now delegates to observability.ParseTargetAddrMode,
  removing the duplicate ValidLogTargetAddrModes slice from defaults.go.
  The observability package is the single source of truth for valid modes.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
qarlosh and others added 2 commits May 8, 2026 11:40
…h/full)

Adds observability.log_target_addr (env: CHAPERONE_OBSERVABILITY_LOG_TARGET_ADDR)
so operators can opt in to logging the upstream target with more detail. Three
modes: host (default — authority only, same behavior PR #68 introduced), path
(scheme + host + path, no query), full (full URL incl. query, userinfo always
stripped).

Renames the target_host field to target_addr everywhere (15 log sites) so the
same key carries the formatted value across the entire log pipeline. A single
observability.FormatTargetAddr helper replaces three duplicated extract*Host
helpers and guarantees byte-identical output across every site for a given
request.

Emits an informational INFO at startup for path and a loud slog.Warn for full,
mirroring the existing body-logging warning. Includes a cross-site consistency
test that fails if any future log emits a different target_addr value than the
rest within a single request.

Closes LITE-34062.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…valid-modes list

Per Arnau's review on #92:
- config.ObservabilityConfig.LogTargetAddr is now observability.TargetAddrMode
  instead of string, eliminating casts at every use site (chaperone.go,
  loader.go, proxy server).
- Validation in validate.go now delegates to observability.ParseTargetAddrMode,
  removing the duplicate ValidLogTargetAddrModes slice from defaults.go.
  The observability package is the single source of truth for valid modes.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@qarlosh qarlosh force-pushed the feat/configurable-target-addr-logging branch from d43746b to a8f1532 Compare May 8, 2026 09:42
@qarlosh qarlosh merged commit 90ed620 into master May 8, 2026
12 checks passed
@qarlosh qarlosh deleted the feat/configurable-target-addr-logging branch May 8, 2026 10:15
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