Skip to content

Conversation

@dt
Copy link
Contributor

@dt dt commented Jan 7, 2026

If it is determined that something waited for a span of time only after it waited, it could still be helpful to reflect that it waited for that span in the trace. As such, the ability to add a span to the trace which reflect that it started at some prior time is introduced. For now this is restricted to adding already-finished spans, as this is the only use-case identified so far for a backdated span.

Release note: none.
Epic: none.

@dt dt requested a review from dhartunian January 7, 2026 22:22
@dt dt requested review from a team as code owners January 7, 2026 22:22
@dt dt requested review from visheshbardia and removed request for a team January 7, 2026 22:22
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Collaborator

@sumeerbhola sumeerbhola left a comment

Choose a reason for hiding this comment

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

@sumeerbhola reviewed all commit messages and made 1 comment.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @dhartunian, @dt, and @visheshbardia).


pkg/util/tracing/context.go line 86 at r1 (raw file):

		return
	}
	// Create a child span with the custom start time, then immediately finish it.

(drive-by)
is there any requirement that spans should be started on the parent, with monotonic start times, that this could violate by starting one in the past?

Copy link
Contributor Author

@dt dt left a comment

Choose a reason for hiding this comment

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

@dt made 1 comment.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @dhartunian, @sumeerbhola, and @visheshbardia).


pkg/util/tracing/context.go line 86 at r1 (raw file):

Previously, sumeerbhola wrote…

(drive-by)
is there any requirement that spans should be started on the parent, with monotonic start times, that this could violate by starting one in the past?

I think no: the comments in the existing code already suggest spans starts can be out of order here: https://github.com/cockroachdb/cockroach/blob/master/pkg/util/tracing/tracingpb/recording.go#L201-L205

If it is determined that something waited for a span of time only after
it waited, it could still be helpful to reflect that it waited for that
span in the trace. As such, the ability to add a span to the trace which
reflect that it started at some prior time is introduced. For now this is
restricted to adding already-finished spans, as this is the only use-case
identified so far for a backdated span.

Release note: none.
Epic: none.
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.

3 participants