`SpanHandler` is the base type for the now deprecated `FinishedSpanHandler`.
Notable, it can not just handle things at the end of a recording, but also the
beginning.
For example, this permits set-once baggage without the HTTP abstraction:
```java
static final BaggageField EPOCH_SECONDS = BaggageField.create("epoch_seconds");
static final class RootOnlyBaggage extends SpanHandler {
@Override
public boolean begin(TraceContext context, MutableSpan span, @Nullable TraceContext parent) {
if (EPOCH_SECONDS.getValue(context) == null) { // only set at the first span
long epochSeconds = System.currentTimeMillis() / 1000;
EPOCH_SECONDS.updateValue(context, String.valueOf(epochSeconds));
}
return true;
}
@Override public boolean end(TraceContext context, MutableSpan span, Cause cause) {
Tags.BAGGAGE_FIELD.tag(EPOCH_SECONDS, context, span);
return true;
}
}
```
As the parent is available, it can also facilitate advanced tasks like counting
children, or summarizing entire local roots.
See https://github.com/openzipkin/brave/tree/master/brave/src/test/java/brave/features/handler
and https://github.com/openzipkin/brave/blob/master/brave/src/main/java/brave/handler/SpanHandler.java for more
Since for some reason, the native headers sometimes are immutable even though the accessor says that the headers are mutable, then we have to ensure their
* mutability. We do so by first making a mutable copy of the native headers, then by removing the native headers from the headers map and replacing them with a mutable copy
fixes#1184
we wanted to improve the performance of wrapping reactor by introducing refactoring that used onLastOperator instead of onEach. ALthough the performance was improved, the code stopped working the way it should.
with this commit, we're coming back to making the feature work again but the performance might decline slightly.
fixes gh-1204
fixes gh-1147
fixes gh-1143