Skip to content

Add traceID in error logging of stackit api calls - #1659

Open
whtssub wants to merge 2 commits into
mainfrom
feature_traceid
Open

whtssub wants to merge 2 commits into
mainfrom
feature_traceid

Conversation

@whtssub

@whtssub whtssub commented Sep 14, 2026

Copy link
Copy Markdown

How to categorize this PR?

/kind enhancement
/cc @stackitcloud/ske-infrastructure

What this PR does / why we need it:

This PR adds STACKIT trace IDs to API errors so they are available in controller and CSI logs during troubleshooting.

Ref: Log failed to ensure load balancer: [trace-id:1e7c1f4a6b48af6cbe944153d3125c91]: 400 Bad Request, status code 400, Body

@ske-prow
ske-prow Bot requested a review from a team September 14, 2026 14:50
@ske-prow ske-prow Bot added the kind/enhancement Enhancement, improvement, extension label Sep 14, 2026
@ske-prow

ske-prow Bot commented Sep 14, 2026

Copy link
Copy Markdown

[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 xoxys 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

@ske-prow ske-prow Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Sep 14, 2026
@aniruddha2000

Copy link
Copy Markdown
Member

/lgtm

@ske-prow ske-prow Bot added the lgtm Indicates that a PR is ready to be merged. label Sep 15, 2026
@ske-prow

ske-prow Bot commented Sep 15, 2026

Copy link
Copy Markdown

LGTM label has been added.

DetailsGit tree hash: fac620d6f3aed9fab26e00aa34761263704506d0

return 0, errors.New("api error")
})

Expect(err).To(MatchError("[X-Request-Id:request-456]: [trace-id:trace-123]: api error"))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I would format the key in a similar fashion. Now we have the request ID with upper and lowercase + the X- upfront, while the trace-id is all lowercase and without the prefix.
We should keep one scheme

@nschad nschad Sep 15, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I agree maybe we should switch the format to something like structured logging? I would prefer if we just could do a.logger.WithValues("Trace-ID", "128382189429")

But this will probably be an extra story.

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

Labels

kind/enhancement Enhancement, improvement, extension lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants