Skip to content

client: report caller line for OpenStack debug logs#3108

Open
SAY-5 wants to merge 1 commit intokubernetes:masterfrom
SAY-5:fix/client-debugger-caller-line-2300
Open

client: report caller line for OpenStack debug logs#3108
SAY-5 wants to merge 1 commit intokubernetes:masterfrom
SAY-5:fix/client-debugger-caller-line-2300

Conversation

@SAY-5
Copy link
Copy Markdown

@SAY-5 SAY-5 commented May 5, 2026

What this PR does / why we need it:

The OpenStack API debugger logs every line as client.go:128 regardless of the caller. The wrapper walks the stack with a hard-coded window [10..20] and a substring of /github.com/gophercloud/gophercloud, which no longer spans gophercloud/utils (where the RoundTripper now lives) and fails to reach the real caller through modern net/http frames, so skip stays at 0 and klog.InfoDepth reports its own line.

This walks the whole stack and picks the frame above the deepest /github.com/gophercloud/ frame so klog attributes the entry to the originating call site (e.g. openstack_volumes.go:82).

Which issue this PR fixes(if applicable):
fixes #2300

Special notes for reviewers:
The added test reproduces the bug: it captures klog output via SetOutput while issuing a request through the wrapper and asserts the source location is the test file, not client.go. The test fails on master and passes with this change.

Release note:

Fix OpenStack API debug logs always being attributed to client.go instead of the caller.

The Logger.Printf wrapper used a hard-coded stack-frame window
[10..20] and matched only /github.com/gophercloud/gophercloud, which
fails to span gophercloud/utils where the RoundTripper now lives.
With modern net/http the real caller is outside that window, so klog
falls back to the wrapper's own line and every debug entry is shown
as client.go:128.

Walk the full stack and pick the frame above the deepest gophercloud
frame (matching both gophercloud/gophercloud and gophercloud/utils)
so klog attributes the log to the originating call site.

Fixes kubernetes#2300

Signed-off-by: SAY-5 <say.apm35@gmail.com>
@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. do-not-merge/invalid-commit-message Indicates that a PR should not merge because it has an invalid commit message. labels May 5, 2026
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

Invalid commit message issues detected

Invalid commit messages

Keywords which can automatically close issues and hashtag(#) mentions are not allowed.

  • a710dc8 client: report caller line for OpenStack debug logs

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign zetaab for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot requested review from kayrus and stephenfin May 5, 2026 13:24
@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label May 5, 2026
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

Hi @SAY-5. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels May 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/invalid-commit-message Indicates that a PR should not merge because it has an invalid commit message. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[all]: openstack API debugger shows client.go:128 for all calls

2 participants