Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tracing: clean up receivers #56045

Merged
merged 5 commits into from
Oct 29, 2020
Merged

Conversation

tbg
Copy link
Member

@tbg tbg commented Oct 28, 2020

Assorted cleanups that are possible now, that we have moved off the opentracing
interfaces.
There will be more cleanups.

  • tracing: move recordings to new file
  • tracing: use receivers for everything
  • tracing: allow Finish() on nil *Span
  • tracing: remove (*Tracer).SetForceRealSpans
  • tracing: improve comment on otSpan

tbg added 4 commits October 28, 2020 13:20
When `Span` and `Tracer` were exposed only via the `opentracing`
interfaces, we weren't able to freely add methods to them, which
led to a number of methods being added to the tracing package
that took an `opentracing.Span` or `opentracing.Tracer` and internally
unwrapped the underlying type.
Now that we're not using these interfaces any more, we can be more
idiomatic and put all methods on their proper receivers.

This is done on this commit as a prelude to being more opinionated
about our APIs.

Release note: None
This is one of the immediate useful outcomes of moving off the
`opentracing.Span` interface: we now get to decide what `(nil).Finish()`
does, removing the need for workarounds.

Release note: None
It was a testing crutch that is no longer necessary now that
we've moved off the opentracing interfaces.

Release note: None
@tbg tbg requested a review from a team October 28, 2020 12:21
@tbg tbg requested review from a team as code owners October 28, 2020 12:21
@tbg tbg requested review from pbardea, knz and irfansharif and removed request for a team October 28, 2020 12:21
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@tbg tbg removed the request for review from pbardea October 28, 2020 12:21
@tbg tbg force-pushed the tracing-more-cleanup branch from b00e688 to a0dc6a5 Compare October 28, 2020 16:09
Copy link
Member

@RaduBerinde RaduBerinde left a comment

Choose a reason for hiding this comment

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

:lgtm:

Very nice, it's great that we can do this now!

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @irfansharif, @knz, and @tbg)


pkg/util/tracing/span.go, line 148 at r5 (raw file):

}

// otSpan is an span for an external opentracing compatible tracer

[nit] a span


pkg/util/tracing/span.go, line 153 at r5 (raw file):

	// shadowTr is the shadowTracer this span was created from. We need
	// to hold on to it separately because shadowSpan.Tracer() returns
	// the wrapper tracer directly and we lose the ability to find out

[nit] maybe remove "directly", I found it confusing

@tbg tbg force-pushed the tracing-more-cleanup branch from a0dc6a5 to b25946e Compare October 29, 2020 08:34
Copy link
Member Author

@tbg tbg left a comment

Choose a reason for hiding this comment

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

TFTR!

bors r=RaduBerinde

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @irfansharif and @knz)

@craig
Copy link
Contributor

craig bot commented Oct 29, 2020

Build succeeded:

@craig craig bot merged commit f945cae into cockroachdb:master Oct 29, 2020
@tbg tbg deleted the tracing-more-cleanup branch October 29, 2020 09:17
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