Skip to content

Add ParallelStep method to Trace to support logging concurrent work with an explicit duration#348

Open
richabanker wants to merge 1 commit intokubernetes:masterfrom
richabanker:parallel-event-traces
Open

Add ParallelStep method to Trace to support logging concurrent work with an explicit duration#348
richabanker wants to merge 1 commit intokubernetes:masterfrom
richabanker:parallel-event-traces

Conversation

@richabanker
Copy link
Copy Markdown

@richabanker richabanker commented Apr 14, 2026

What type of PR is this?
/kind feature

What this PR does / why we need it:
Adds ParallelStep method to Trace to support logging concurrent work with an explicit duration.

Which issue(s) this PR fixes:

Issue #kubernetes/kubernetes#136002

Special notes for your reviewer:

Release note:


…ith an explicit duration

Signed-off-by: Richa Banker <richabanker@google.com>
@k8s-ci-robot k8s-ci-robot added kind/feature Categorizes issue or PR as related to a new feature. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Apr 14, 2026
@k8s-ci-robot k8s-ci-robot requested a review from aojea April 14, 2026 01:28
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: richabanker
Once this PR has been reviewed and has the lgtm label, please assign danwinship 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 a review from deads2k April 14, 2026 01:28
@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Apr 14, 2026
Comment thread trace/trace.go
for _, stepOrTrace := range t.traceItems {
stepOrTrace.rLock()
stepOrTrace.writeItem(b, formatter, lastStepTime, stepThreshold)
lastStepTime = stepOrTrace.time()
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@serathius @dashpole I am wondering how should lastStepTime behave for a parallel step?

If ParallelStep advances lastStepTime normally, any sequential step that follows is measured from when ParallelStep was recorded. But if we consider a case like

t=0    trace starts; background i/o goroutine launched, CPU work begins on main thread
t=50  i/o finishes - ParallelStep("i/o", 50ms) advances lastStepTime to t=50
t=70   CPU finishes - Step("cpu computation") shows 20ms ---> should this be 70ms ?

so, should ParalleStep freeze lastStepTime to support this case ?

@serathius
Copy link
Copy Markdown

cc @p0lyn0mial

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. kind/feature Categorizes issue or PR as related to a new feature. 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.

3 participants