Pipeline builder for stdout trace exporter #224
Merged
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.
Part of #156
Implement the pipeline builder API for the stdout trace exporter, similar to the other exporters. With this a stdout trace pipeline can now be installed like this:
I made 2 small changes along the way, which seemed to make sense to me. Happy to change in either direction, though. These are:
Defer requirement of all additional writer traits to the
PipelineBuilder::install
function. BeforeDebug
was required for the builder andSend + 'static
were required only for the exporter. Now the builder is happy with onlyWrite
and requiresDebug + Send + 'static
for installation. I think I don't see any downsides here. We could also require all of these traits for the builder already. Not sure what's better.Defer wrapping writer in Mutex to when the exporter is created, which seems to be the point at which it's needed. Does this have any downsides?
Additional note:
This makes the pipeline the only way to construct a stdout exporter. This is in line with other exporters, but I'm not sure it's desired. Should we make
Exporter::new
public, so users can still create an exporter and setup a pipeline manually?Update:
Exporter::new
is now public.