client: expose a method to create a trace client to replace the delegated tracer #4758
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change removes the delegated tracer and replaces it with exposing
a method to create the trace client.
The primary benefit is it separates a client functionality from server
functionality. The delegation was only used by clients and it would
often happen automatically. If you initialized a client, it would
potentially report the same traces multiple times.
For the detect functionality, it was possible to turn off delegation on
the clients by enabling tracing or metrics from there. This prevents the
detect functionality from conflicting with the client delegation so it
always works properly now.
It also refactors the delegated span exporter a bit so its usage is not
tied to the
detect.Exporter()
method. It also only delegates to asingle span exporter which should help prevent accidentally sending
traces multiple times to the same client.
Clients are expected to use the new method and register a separate span
processor rather than use the tracer delegate.