Commit Graph

97 Commits

Author SHA1 Message Date
Olga Maciaszek-Sharma
3ed6ef475c Merge remote-tracking branch 'origin/2.2.x'
# Conflicts:
#	spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/feign/TraceLoadBalancerFeignClient.java
#	tests/spring-cloud-sleuth-instrumentation-feign-tests/src/test/java/org/springframework/cloud/sleuth/instrument/feign/issues/issue1125/ManuallyCreatedLoadBalancerFeignClientTests.java
#	tests/spring-cloud-sleuth-instrumentation-feign-tests/src/test/java/org/springframework/cloud/sleuth/instrument/feign/issues/issue1125delegates/ManuallyCreatedDelegateLoadBalancerFeignClientTests.java
2020-04-08 11:12:54 +02:00
Olga Maciaszek-Sharma
20e29f2d80 Adjust method name to previous changes. 2020-04-07 13:46:37 +02:00
Olga Maciaszek-Sharma
15ee807b85 Refactor tests and make them not rely on LoadBalancerFeignClient side effects. 2020-04-07 13:43:37 +02:00
Adrian Cole
b92db4ce51 Stops propagating Sleuth 1.x spring-messaging headers
To reduce confusion and overhead, the following custom spring-messaging headers added in Sleuth 1.0 are no longer sent, and a log warning is issued once if they are by outside code.

* spanId
* spanSampled
* spanParentSpanId
* spanTraceId
* spanFlags

Sending the above headers actually increases the headers by up to 10 because they are duplicated in the "native" part of messages. This overhead is extreme especially if messages never leave the process.

The solution is to only send [b3 single format](https://github.com/openzipkin/b3-propagation#single-header), which has been in sleuth since 2.0 and is compatible with JMS. The B3 single format is always parsed and takes precedence, even if multiple headers are sent, so this is a safe change.

Note: Unlike RPC, messaging spans never join with their parent. Better performance is achieved by not propagating the producer's parentId downstream.

Note: Deprecated spring-messaging headers such "spanTraceId" as are still read in Sleuth 3.x. However, they will not be at some point in the future. Please pay attention to the log messages and update your code if you are accidentally using them.
2020-04-07 10:58:49 +08:00
Adrian Cole
501073819d checkstyle 2020-04-07 07:09:44 +08:00
Adrian Cole
b46ad7b591 fixed 2020-04-07 02:53:50 +08:00
Adrian Cole
dd48571b15 jupiter 2020-04-06 23:11:36 +08:00
Adrian Cole
44a7f4b7ad Reorganizes code under o.s.c.sleuth.baggage
This moves code and properties under org.springframework.cloud.sleuth.baggage
Properties are now under "spring.sleuth.baggage"

Those coming from 2.x should migrate with the following:
 * spring.sleuth.baggage-keys -> `BaggagePropagationCustomizer`
 * spring.sleuth.local-keys -> spring.sleuth.baggage.local-fields
 * spring.sleuth.propagation-keys -> spring.sleuth.baggage.remote-fields
 * spring.sleuth.propagation.tag.whitelisted-keys -> spring.sleuth.baggage.tag-fields
 * spring.sleuth.log.slf4j.whitelisted-mdc-keys -> spring.sleuth.baggage.correlation-fields
 * spring.sleuth.log.slf4j.enabled -> spring.sleuth.baggage.correlation-enabled

Those using MDC should know that for performance reasons, we no longer
set the following fields: `parentId` `spanExportable`.

We also do not set fields to "dirty" by default. Doing this by default
raised the overhead substantially, especially in reactive applications.

Those who want sleuth to override manual `MDC.put` operations as
described in #1416, or with to add back `parentId` `spanExportable` need
to define their own bean:

Ex. this is the former setup:

```java
@Bean CorrelationScopeDecorator oldConfig(List<String> myFieldNames) {
	CorrelationScopeDecorator.Builder builder = MDCScopeDecorator.newBuilder().clear()
			.add(SingleCorrelationField.create(BaggageFields.TRACE_ID))
			.add(SingleCorrelationField.create(BaggageFields.PARENT_ID))
			.add(SingleCorrelationField.create(BaggageFields.SPAN_ID))
			.add(SingleCorrelationField.newBuilder(BaggageFields.SAMPLED)
					.name("spanExportable").build());

        // Set all fields dirty, so that any changes made by MDC directly are reverted.
	for (String name : myFieldNames) {
		builder.add(SingleCorrelationField.newBuilder(BaggageField.create(name))
				.dirty().build());
	}
	return builder.build();
}

```
2020-04-06 23:06:10 +08:00
Adrian Cole
5e1f7f9c0c Merge branch '2.2.x' 2020-04-04 14:39:36 +08:00
Adrian Cole
3d677d0090 Fixes bugs in skip pattern code and Feign tests (#1598)
Before, the client sampler would only skip the path named ""! This was
the path used in one of the failing Feign tests, which made
troubleshooting like a murder mystery.

The "" is a regression in spring-cloud-openfeign noted below:
https://github.com/spring-cloud/spring-cloud-openfeign/pull/245/files#r40342437
2020-04-04 13:37:26 +08:00
Adrian Cole
3cde42a45e Merge branch '2.2.x' 2020-04-04 10:03:47 +08:00
Adrian Cole
b9b2357fb5 Merge branch '2.2.x' 2020-04-03 16:17:24 +08:00
Adrian Cole
60820379f1 Updates to latest brave and removes all static thread local use (#1594) 2020-04-03 08:01:22 +08:00
Marcin Grzejszczak
35472366b2 Ignored flakey tests 2020-04-02 12:03:18 +02:00
Marcin Grzejszczak
32e915dae4 Ignoreing both reactor tests 2020-03-31 15:06:53 +02:00
Marcin Grzejszczak
15d2de8eb4 Ignored 2 tests 2020-03-31 14:59:16 +02:00
Marcin Grzejszczak
b7d8fc2f87 Trying to fix Reactor tests 2020-03-31 14:27:17 +02:00
Marcin Grzejszczak
729df801ab Merge branch '2.2.x' 2020-03-31 14:20:34 +02:00
Marcin Grzejszczak
d325756acc Going back to Junit4 2020-03-31 14:10:56 +02:00
Marcin Grzejszczak
a7858671d6 Fixed the build 2020-03-31 13:43:31 +02:00
Adrian Cole
d0a3e6952b Tries higher read timeout for jenkins 2020-03-26 17:41:00 +08:00
Marcin Grzejszczak
3e8d842de9 Merge branch '2.2.x' 2020-03-26 10:20:01 +01:00
Adrian Cole
1e1e1f04bf Finalizes reactor-netty HttpClient implementations (#1586) 2020-03-26 17:10:01 +08:00
Adrian Cole
dd13f09844 Adds first unit test for HttpClientBeanPostProcessor (#1580) 2020-03-06 11:07:00 +08:00
Adrian Cole
656c4720cb Switches to a less flakey span reporter (#1579) 2020-03-06 10:43:54 +08:00
Adrian Cole
d467cc7529 Merge branch '2.2.x' 2020-03-05 12:46:30 +08:00
Adrian Cole
42add19daa Adds base integration test for reactor clients and adds cancelation tests (#1578) 2020-03-05 12:30:01 +08:00
buildmaster
2674fba171 Bumping versions to 2.2.3.BUILD-SNAPSHOT after release 2020-03-04 16:59:42 +00:00
buildmaster
5dd714da5c Going back to snapshots 2020-03-04 16:59:42 +00:00
buildmaster
151218b30a Update SNAPSHOT to 2.2.2.RELEASE 2020-03-04 16:57:41 +00:00
Marcin Grzejszczak
3ce018bc51 Upgrades to JUnit5; fixes gh-1567 2020-03-03 19:53:57 +01:00
Marcin Grzejszczak
a59bfb00cf Merge branch '2.2.x' 2020-03-03 19:44:56 +01:00
Marcin Grzejszczak
2024e28937 Added example with Stream Bridge 2020-03-03 16:22:18 +01:00
Adrian Cole
27fe606c83 polish 2020-03-02 16:24:59 +08:00
Adrian Cole
eec55b9a6c Adds wiring for HttpRequestParser and HttpResponseParser (#1575) 2020-03-02 09:12:47 +08:00
Adrian Cole
db2d9aeaaa Merge branch '2.2.x' 2020-02-26 16:51:58 +08:00
Adrian Cole
7262790717 Performs minimal work to update to Brave 5.10 (#1573)
A later PR will handle new features/deprecation
2020-02-26 16:43:14 +08:00
Adrian Cole
0446918fcf Ensures spring context is closed in brave tests (#1572) 2020-02-26 15:11:18 +08:00
Adrian Cole
51c9158837 Fixes WebClient propagation errors and adds Brave Tests (#1562)
In many places, the trace context of callbacks was accidentally set to
the client span, not the invocation context. I noticed a hack trying to
work around this. This code fixes all the problems around context. It
also removes some sporadic logging, which was only applied to a few
hooks.

Finally, this adds Brave tests which would have caught the problems
earlier. Notably, there is still more work to do as this will not help
with duplicate instrumentation, which is normal when reactor-netty is
the WebClient's HTTP connector.
2020-02-24 14:34:25 +08:00
Olga Maciaszek-Sharma
4634585c35 Adjust to changes in FeignBlockingLoadBalancer client constructor. 2020-02-20 13:45:44 +01:00
Marcin Grzejszczak
0d237b564f Removed deprecated apis; fixes gh-1564 2020-02-18 13:30:00 +01:00
Adrian Cole
47416a8eef Reduces scope copies when desired context is already current (#1558) 2020-02-13 14:56:47 -08:00
Marcin Grzejszczak
3813cf9dd4 Removes modules in maintenance more.
Zuul, ribbon and hystrix
2020-02-12 11:03:04 +01:00
Marcin Grzejszczak
8f2823814f Should really make tests less brittle this time for reactor 2020-02-10 10:41:20 +01:00
Marcin Grzejszczak
cc2a2ce4b8 Should make tests less brittle 2020-02-10 09:33:08 +01:00
Adrian Cole
905ef2cc6f yolo attempt to deflake build 2020-02-07 16:14:39 +08:00
Adrian Cole
4de484504e refactoring flakey test 2020-02-06 15:36:57 +08:00
Adrian Cole
af04d9d431 Corrects HookRegisteringBeanDefinitionRegistryPostProcessor.setupHooks (#1546)
Probably due to code drift, `HookRegisteringBeanDefinitionRegistryPostProcessor.setupHooks`
was used as an object method, which led to a confusing no-op chain in
tests.

This ensures it is used consistently as a static method, and also
corrects a bean accidentally marked static for testing.
2020-02-04 10:16:55 +08:00
Adrian Cole
241f536aef Uses ConfigurableApplicationContext consistently in Reactor (#1545)
Before, we used ConfigurableApplicationContext or BeanFactory eventhough
we already had a reference to ConfigurableApplicationContext. This uses
the latter consistently, avoiding a state condition that caused more
code.

This also corrects some misnamed tests and adjusts them to verify only
what they are responsible for.
2020-02-03 19:26:38 +08:00
Adrian Cole
8a4002d288 Cleanups of build including upgrade of Brave (#1530)
In efforts to dig deep into benchmarks, I noticed we were a bit out of
date on Brave. Then, noticed some other artifacts could be bumped
safely. Finally, a find/replace on http/https was over zealous and
tripped up XML.

One change to test expectations and Brave is explained here:
https://github.com/openzipkin/brave/blob/master/instrumentation/RATIONALE.md#calling-spanfinish-while-the-context-is-in-scope
2020-01-22 19:31:50 +08:00