Commit Graph

129 Commits

Author SHA1 Message Date
Marcin Grzejszczak
3ea7460913 Merge branch '2.2.x' 2020-06-30 14:36:13 +02:00
Ivo Smid
18c27d9a43 Optional/Null parameter used within @SpanTag 2020-06-30 14:26:54 +02:00
Roberto Tassi
791f729f49 Adds tracing on every factory methods in KafkaListenerContainerFactory (#1665) 2020-06-29 15:13:52 +02:00
Ivo Smid
62225e6905 Optional/Null parameter used within @SpanTag 2020-06-21 20:56:17 +02:00
buildmaster
93ea0d6b00 Going back to snapshots 2020-05-29 19:03:35 +00:00
buildmaster
640faa7c30 Update SNAPSHOT to 3.0.0-M2 2020-05-29 19:02:42 +00:00
buildmaster
6b8dd82346 Bumping versions to 2.2.4.BUILD-SNAPSHOT after release 2020-05-28 20:00:54 +00:00
buildmaster
4b961dcdf3 Going back to snapshots 2020-05-28 20:00:54 +00:00
buildmaster
fdf4c647df Update SNAPSHOT to 2.2.3.RELEASE 2020-05-28 19:57:31 +00:00
Adrian Cole
a6573bc2a5 Uses B3 single for non-remote spans (2.2.x) (#1655)
This makes sure there cannot be JMS problems related to use of
hyphenated headers unless someone overrides the `Propagation.Factory`.

To avoid this, we set non-remote spans to B3 single format as done on
the 3.x branch here:
https://github.com/spring-cloud/spring-cloud-sleuth/pull/1607/files#diff-db43b7e91bd69d063333c20b947c902bR83-R84
2020-05-26 14:42:27 +08:00
Marcin Grzejszczak
de399c8959 Merge branch '2.2.x' 2020-05-22 14:02:11 +02:00
Marcin Grzejszczak
473549f000 Removed / ignored flakey tests; fixes gh-1635; fixes gh-1652 2020-05-22 13:51:14 +02:00
Adrian Cole
ddea6860cb Merge branch '2.2.x' 2020-05-20 08:59:03 +08:00
Adrian Cole
d02493ca40 Reverts JmsTracingConfigurationTest test configuration
JmsTracingConfigurationTest flakes in Jenkins for some reason that appears
like either the test rule not being honored or tests run concurrently.
2020-05-20 08:30:01 +08:00
Adrian Cole
4ed3db9a27 Drops zipkin dependency from spring-cloud-sleuth-core (#1649)
There was emmense work to prepare for decoupling of spring-cloud-sleuth-core
from Zipkin. This included complete test conversion and deprecations between
2.2.x and 3.0.x.

This moves all Zipkin related code to spring-cloud-sleuth-zipkin, making the
primary data recording tool `SpanHandler` as opposed to `Reporter<zipkin2.Span>`

For example, Wavefront and soon Stackdriver can implement `SpanHandler` and
skip conversion into the Zipkin model first. `SpanHandler` also includes
begin and end hooks which allow data extensions to be developed.

see https://github.com/wavefrontHQ/wavefront-spring-boot
2020-05-19 08:22:54 +08:00
Adrian Cole
31fb3001c5 Merge branch '2.2.x' 2020-05-18 23:58:46 +08:00
Adrian Cole
30bc36ea81 Last deprecation cleanup on master (3.x) (#1646) 2020-05-18 21:51:00 +08:00
Adrian Cole
453be43b5a bump 2020-05-18 21:13:23 +08:00
Adrian Cole
3da9de053e Merge branch '2.2.x' 2020-05-18 20:20:40 +08:00
Adrian Cole
40785d642a Removes Zipkin dependency from all tests (#1645)
Brave's SpanHandler can report natively in other formats which have different
constraints than Zipkin and often extensions to the data model.

This change ports all tests away from Zipkin's types so that it is more clear
what's actually recorded vs what's a side-effect of Zipkin conversion.

This removes `BlockingQueueSpanReporter` which was never released, also.
2020-05-18 17:02:29 +08:00
Adrian Cole
a27d634645 Hides exposed configuration and properties types (#1642)
This completes #1638 by addressing deprecations on master (3.x)
2020-05-17 21:30:45 +08:00
Adrian Cole
048227806a undeprecate the entry-level zipkin things as they are documented 2020-05-17 20:48:03 +08:00
Adrian Cole
946486b20a Merge branch '2.2.x' 2020-05-17 18:54:30 +08:00
Adrian Cole
60bf5ce497 Rewrites async test to be less circuitous and more valid (#1641)
I had flakes on TraceAsyncIntegrationTests and it was hard to tell why
as there were so many problems with it. It used a normal list in async
setting, it unnecessarily created extra spans, it added a hook inside
the async method which if passed only told you it was in the middle of
an op, not the end of it. The method danced around making failure in
console almost impossible to decipher.

This took me a few hours to make just a normal test. Hopefully, the
others will keep passing as I can't afford time to redo all of them.
2020-05-17 14:21:30 +08:00
Adrian Cole
8ae5e13d31 Merge branch '2.2.x' 2020-05-16 15:15:37 +08:00
Adrian Cole
b1d39ce291 Updates to Brave 5.12 and introduces SpanHandler (#1632)
`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
2020-05-16 14:01:38 +08:00
Adrian Cole
f9821495e1 Deprecates ExceptionLoggingFilter and disables it by default (#1633)
`ExceptionLoggingFilter` logs "Uncaught exception thrown" to error level
when there is a synchronous exception not otherwise swallowed. This is a
cure worse than the disease. This disables it by default and the 3.x
should end the years of problems it caused.
2020-05-15 20:27:13 +08:00
Adrian Cole
6fb92a5f66 Merge branch '2.2.x' 2020-04-23 19:42:38 +08:00
Adrian Cole
16fb8e3ac6 Moves responsibility to import SamplerAutoConfiguration to core
Before, spring-cloud-sleuth-zipkin had to import `SamplerAutoConfiguration`
directly to unwind a sampler ordering problem caused by `TraceAutoConfiguration`
defining the default `Sampler` bean.

This fixes that by moving the default `Sampler` to where it belongs
(`SamplerAutoConfiguration`) and having `TraceAutoConfiguration` import
the sampling configuration directly as opposed to relying on auto-configuration
ordering. Finally it removes the mistake of setting `SamplerAutoConfiguration`
as auto-configuration in the first place.

The name `SamplerAutoConfiguration` was left alone because changing it would
interfere with 3rd party code that formerly imported it to correct this issue
in their non-zipkin setups.

Fixes #1618
2020-04-22 19:04:19 +08:00
buildmaster
d41d75a3eb Bumping versions 2020-04-17 14:53:39 +00:00
buildmaster
08a575141d Going back to snapshots 2020-04-09 22:48:15 +00:00
buildmaster
66b540f0b9 Update SNAPSHOT to 3.0.0.M1 2020-04-09 22:47:21 +00:00
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