Skip to content

fix(preflight): add tracing span and align error handling for host collector redaction - #2102

Merged
banjoh merged 2 commits into
mainfrom
fix/host-preflight-redaction-follow-up
Aug 10, 2026
Merged

fix(preflight): add tracing span and align error handling for host collector redaction#2102
banjoh merged 2 commits into
mainfrom
fix/host-preflight-redaction-follow-up

Conversation

@xavpaice

Copy link
Copy Markdown
Member

Follow-up to #2101.

#2101 added redaction for local host preflight collectors, which was the only collection path that skipped redaction entirely. This PR addresses the review feedback that was not included before #2101 was merged:

  1. Adds an OpenTelemetry span around the redaction step, matching the tracing already present for host and in-cluster collectors in the support-bundle path.
  2. Aligns the error handling: when redaction fails, "CollectHostWithContext" now returns the unredacted "collectResult" along with the error, matching the behavior of "remote_collector.RunCollectorSync" and "supportbundle.runHostCollectors". This prevents SDK consumers from seeing inconsistent return behavior across collection paths.

The regression test added in #2101 ("TestCollectHostWithContext_RedactsSensitiveEnvValues") continues to verify that "run" host collector environment variables are redacted before being written to the bundle.

…llector redaction

Follow-up to #2101.

Adds an OpenTelemetry span around host collector redaction and returns the
unredacted collectResult on redaction failure, matching the behavior of
remote host collectors and in-cluster support-bundle collectors.
@greptile-apps

greptile-apps Bot commented Aug 10, 2026

Copy link
Copy Markdown

Reviews (1): Last reviewed commit: "fix(preflight): add tracing span and ali..." | Re-trigger Greptile

Comment thread pkg/preflight/collect.go
@xavpaice

Copy link
Copy Markdown
Member Author

Good catch — fixed. collectResult.AllCollectedData is now assigned before the redaction call, so if redaction fails the returned result still contains the unredacted collected data, consistent with the other collection paths.

@greptile-apps

greptile-apps Bot commented Aug 10, 2026

Copy link
Copy Markdown

Reviews (2): Last reviewed commit: "fix(preflight): assign collected data be..." | Re-trigger Greptile

@banjoh
banjoh merged commit b9faedf into main Aug 10, 2026
29 checks passed
@banjoh
banjoh deleted the fix/host-preflight-redaction-follow-up branch August 10, 2026 15:17
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