Skip to content

Comments

Improve tsh kubectl traces#63652

Merged
rosstimothy merged 1 commit intomasterfrom
tross/tsh_kubectl_tracing
Feb 12, 2026
Merged

Improve tsh kubectl traces#63652
rosstimothy merged 1 commit intomasterfrom
tross/tsh_kubectl_tracing

Conversation

@rosstimothy
Copy link
Contributor

@rosstimothy rosstimothy commented Feb 9, 2026

The tracing support for tsh kubectl was in a semi-working, but mostly not functional state. The spans were disjoint instead of all being associated with a singular SpanContext partly because we didn't pass the SpanContext from parent to child process and partly due to kubectl limitations. This addresess those limitations by passing the SpanContext as an environment variable from the parent tsh process to the child. This gets all Teleprot originated spans unified in the same Span, however, the kubectl originated spans - by way of us setting a custom http.RoundTripper were not grouped because kubectl uses a context.TODO for all requests. To work around this the custom http.RoundTripper was updated to take a parent context and inject it into the http.Request before it is passed along to the tracing machinery.

Manual test plan

  • No traces are generated without --trace flag
  • Traces are generated and forwarded to auth with --trace flag
  • tsh kubectl behavior is unchanged

Changelog

Changelog: Improved tracing support via tsh --trace kubectl.

@rosstimothy
Copy link
Contributor Author

Traces captured on this branch via tsh --trace kubectl get all -n echo

image

@rosstimothy rosstimothy marked this pull request as ready for review February 9, 2026 22:13
@rosstimothy rosstimothy requested a review from jakealti February 9, 2026 22:13
@github-actions github-actions bot added size/sm tsh tsh - Teleport's command line tool for logging into nodes running Teleport. labels Feb 9, 2026
@rosstimothy rosstimothy force-pushed the tross/tsh_kubectl_tracing branch 4 times, most recently from 80ef4f4 to fdbf2e8 Compare February 12, 2026 15:00
@rosstimothy
Copy link
Contributor Author

Trace from the latest commit

image

The tracing support for tsh kubectl was in a semi-working, but mostly
not functional state. The spans were disjoint instead of all being
associated with a singular SpanContext partly because we didn't pass
the SpanContext from parent to child process and partly due to kubectl
limitations. This addresess those limitations by passing the SpanContext
as an environment variable from the parent tsh process to the child. This
gets all Teleport originated spans unified in the same Span, however, the
kubectl originated spans - by way of us setting a custom http.RoundTripper
were not grouped because kubectl uses a context.TODO for all requests. To
work around this the custom http.RoundTripper was updated to take a
parent context and inject it into the http.Request before it is passed
along to the tracing machinery.
@rosstimothy rosstimothy force-pushed the tross/tsh_kubectl_tracing branch from fdbf2e8 to 1362e30 Compare February 12, 2026 15:29
@rosstimothy rosstimothy added this pull request to the merge queue Feb 12, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 12, 2026
@rosstimothy rosstimothy added this pull request to the merge queue Feb 12, 2026
Merged via the queue into master with commit bc5ce85 Feb 12, 2026
42 checks passed
@rosstimothy rosstimothy deleted the tross/tsh_kubectl_tracing branch February 12, 2026 16:29
@backport-bot-workflows
Copy link
Contributor

@rosstimothy See the table below for backport results.

Branch Result
branch/v18 Create PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport/branch/v18 size/sm tsh tsh - Teleport's command line tool for logging into nodes running Teleport.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants