The `org.springframework.cloud.gateway.filter.NettyRoutingFilter` in SC Gateway
is adding only these headers that were set when the request came in. That means
that adding any additional headers (via instrumentation) is completely ignored.
That's why we're wrapping the `HttpClientRequest` in such a wrapper that
when `setHeaders` is called (that clears any current headers), will also add
the tracing headers
fixes gh-907
without this change we were not reusing a span context if there was no previous span. Instead we were overwrriting it with an empty one
with this change, if the context is there we are reusing it instead of overwriting it
fixes gh-897
Instrumentation around brave is more likely to use a simple bean name
like "tracing" vs "sleuthTracing". This changes the commodity beans to
simple names so that we can avoid having to teach naming prefixes unless
necessary.
This affects the following beans:
* httpTracing
* tracing
* tracer
* spanCustomizer
This came up when integrating dubbo, as their extension loader prefers
stable bean names. For example, loading `brave.Tracing` with their
spring extension silently failed because our bean was named
"sleuthTracing". Even if we can provide instructions to override this,
seems best to dodge.
* Aligned HTTP instrumentation with Brave
with this change we remove TraceFilter and make TraceHandlerInterceptor a legacy component. All HTTP instrumentation is done via Brave.
fixes gh-873
without this change whenever a span was to be skipped, a new trace was generated
with this change:
- we first check if a trace context is already in the request
- if sampled flag is set to 0, we reuse the Brave's mechanism of sampling
- if URI is to be skipped we create an unsampled span BUT we reuse the trace context to build it if it was already there in the request
fixes gh-874
@smaldini suggested 2 changes.
1) move the check for double instrumentation to WebClient from Netty's HttpClient. We don't want to duplicate tracing information and the perfect place to do this check is WebClient
2) Mono.defer(() -> ...) on the whole Netty HttpClient instrumentation. That way the logic of passing span around functions will be executed per request and not once.
without this change the Reactor Span operators where eagerly started. That means that beans like Tracing were required for an operation. Also, Sleuth requires to be the first to set a traceable scheduler factory. Unfortunately it wasn't always the case.
with this change the Reactor Span operators are lazy. They create span operators at runtime. Thanks to this we could create a HookRegisteringBeanDefinitionRegistryPostProcessor that ensures that the hooks are applied and the factory is set before other components get initialized.
fixes gh-866
without this change you always have to set the skip pattern. You can't append anything to the default pattern
with this change via the property you can provide some additional skip patterns
fixes gh-865